Skip to content

Other Linux Distributions

Managing Debian, Ubuntu, Red Hat, Alpine, and Devuan systems
Section titled “Managing Debian, Ubuntu, Red Hat, Alpine, and Devuan systems”

Although my tutorials (and my learning journey) focus on Debian and Ubuntu Linux distributions, administrators may occasionally need to work with other Linux distributions as well.

This tutorial aims to help Debian/Ubuntu administrators adapt to other Linux distributions, specifically Red Hat, Alpine, and Devuan.

Main topics covered:

  • Package Management
  • Network Configuration
  • Installing LAMP Stack
  • Service Management

Distributions covered:

  • Debian 13 and 12
  • Ubuntu 24.04 and 22.04 LTS
  • RHEL (CentOS, AlmaLinux, Rocky Linux) 10.x, 9.x
  • Alpine 3.23
  • Devuan 6 and 5


Commands require root or sudo privileges.

Terminal window
sudo apt update
Terminal window
sudo apt upgrade
Terminal window
sudo apt install apache2
Terminal window
sudo apt remove apache2
Terminal window
sudo apt search apache2
Terminal window
sudo apt autoremove
Terminal window
sudo apt show apache2

Network adapter names typically follow patterns like enp0s3. To find the exact name:

Terminal window
ls /sys/class/net

The interface with an en* format is usually your network adapter. If unsure, use:

Terminal window
ip a

Edit the network interfaces file (replace enp0s3 with your actual interface name):

Terminal window
sudo nano /etc/network/interfaces

Static IP configuration:

auto enp0s3
iface enp0s3 inet static
address 192.168.1.135/24
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1

DHCP configuration:

auto enp0s3
iface enp0s3 inet dhcp
Terminal window
sudo nano /etc/resolv.conf

Add DNS servers:

nameserver 46.196.235.35
nameserver 178.233.140.110
nameserver 46.197.15.60

Replace enp0s3 with your interface name:

Terminal window
sudo ifdown enp0s3 && sudo ifup enp0s3

Alternatively:

Terminal window
sudo systemctl restart networking.service

Note: If connected via SSH, your connection will drop. Reconnect using the new IP address.

Terminal window
sudo apt update
sudo apt install --yes apache2 mariadb-server php \
libapache2-mod-php php-mysql

We’ll create a test database, table, and PHP file to verify all components work together.

Create test database and user:

Terminal window
sudo mariadb

Run in MariaDB shell:

CREATE DATABASE mysampledb;
USE mysampledb;
CREATE TABLE Employees (Name char(15), Age int(3), Occupation char(15));
INSERT INTO Employees VALUES ('Joe Smith', '26', 'Ninja');
INSERT INTO Employees VALUES ('John Doe', '33', 'Sleeper');
INSERT INTO Employees VALUES ('Mariadb Server', '14', 'RDBM');
GRANT ALL ON mysampledb.* TO 'appuser'@'localhost' IDENTIFIED BY 'password';
exit

Create test PHP file:

Terminal window
sudo nano /var/www/html/test.php

Add the following content:

<?php
$mycon = new mysqli("localhost", "appuser", "password", "mysampledb");
if ($mycon->connect_errno)
{
echo "Connection Error";
exit();
}
$mysql = "SELECT * FROM Employees";
$result = ($mycon->query($mysql));
$rows = [];
if ($result->num_rows > 0)
{
$rows = $result->fetch_all(MYSQLI_ASSOC);
}
?>
<!DOCTYPE html>
<html>
<body>
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Occupation</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($rows))
foreach($rows as $row)
{
?>
<tr>
<td><?php echo $row['Name']; ?></td>
<td><?php echo $row['Age']; ?></td>
<td><?php echo $row['Occupation']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</body>
</html>
<?php
mysqli_close($conn);
?>

Test: Access http://[your-server-ip]/test.php from a browser to verify the LAMP stack is working.

In Debian, services are typically enabled and started automatically upon installation.

Terminal window
systemctl status apache2
Terminal window
sudo systemctl stop apache2
sudo systemctl start apache2

Force stop:

Terminal window
sudo systemctl kill apache2

Reloads configuration without stopping:

Terminal window
sudo systemctl reload apache2
Terminal window
sudo systemctl restart apache2
Terminal window
sudo systemctl enable apache2
sudo systemctl disable apache2


Commands require root or sudo privileges.

Terminal window
sudo apt update
Terminal window
sudo apt upgrade
Terminal window
sudo install apache2
Terminal window
sudo remove apache2
Terminal window
sudo search apache2
Terminal window
sudo autoremove
Terminal window
sudo show apache2

2.2.1. Get the name of the network adapter

Section titled “2.2.1. Get the name of the network adapter”

Network adapter names typically follow patterns like enp0s3. To find the exact name:

Terminal window
ls /sys/class/net

The interface with an en* format is usually your network adapter. If unsure, use:

Terminal window
ip a

Ubuntu uses Netplan for network configuration. Edit the configuration file (filename may vary):

Terminal window
sudo nano /etc/netplan/00-installer-config.yaml

Replace enp0s3 with your interface name and adjust IP settings:

network:
ethernets:
enp0s3:
addresses:
- 192.168.1.182/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses:
- 8.8.8.8
- 192.168.1.1
search:
- x11.xyz
version: 2
Terminal window
sudo netplan apply

Note: SSH connections may drop; reconnect using the new IP.

Terminal window
sudo apt update
sudo apt install --yes apache2 mariadb-server php \
libapache2-mod-php php-mysql

Use the test scenario from section 1.3.2.

As a Debian derivative, Ubuntu behaves similarly for service management.

Terminal window
systemctl status apache2
Terminal window
sudo systemctl stop apache2
sudo systemctl start apache2

Force stop:

Terminal window
sudo systemctl kill apache2

Reads configuration file again

Terminal window
sudo systemctl reload apache2
Terminal window
sudo systemctl restart apache2
Terminal window
sudo systemctl enable apache2
sudo systemctl disable apache2

3. RHEL (AlmaLinux, Rocky Linux) 10.x, 9.x

Section titled “3. RHEL (AlmaLinux, Rocky Linux) 10.x, 9.x”

AlmaLinux and Rocky Linux are RHEL-compatible distributions, meaning commands and configurations for RHEL work on these distributions as well.

Commands require root or sudo privileges.

Terminal window
sudo dnf check-update

It is always called when installing or updating packages. So it is not necessary before installing or upgrading packages.

Terminal window
sudo dnf upgrade
Terminal window
sudo dnf install httpd
Terminal window
sudo dnf remove httpd
Terminal window
sudo dnf search httpd
Terminal window
sudo dnf autoremove
Terminal window
sudo dnf info httpd

Network adapter names typically follow patterns like enp0s3. To find the exact name:

Terminal window
ls /sys/class/net

The interface with an en* format is usually your network adapter. If unsure, use:

Terminal window
ip a

Replace enp0s3 with your interface name:

Terminal window
sudo nmcli con modify 'enp0s3' ifname enp0s3 ipv4.method manual \
ipv4.addresses 192.168.1.156/24 gw4 192.168.1.1
sudo nmcli con modify 'enp0s3' ipv4.dns 8.8.8.8
Terminal window
sudo nmcli con down 'enp0s3' && sudo nmcli con up 'enp0s3'

Note: Package names differ from Debian/Ubuntu (e.g., httpd instead of apache2).

Terminal window
sudo dnf -y install httpd mariadb-server php php-mysqlnd
Terminal window
sudo systemctl enable --now httpd
sudo systemctl enable --now mariadb

RHEL enables the firewall by default. Open HTTP and HTTPS ports:

Terminal window
sudo firewall-cmd --add-service=http --add-service=https
sudo firewall-cmd --add-service=http --add-service=https --permanent

Use the test scenario from section 1.3.2. Note: For RHEL 9, use sudo mysql instead of sudo mariadb.

Unlike Debian-based systems, RHEL does not automatically enable or start services after installation.

Terminal window
systemctl status httpd
Terminal window
sudo systemctl stop httpd
sudo systemctl start httpd

Force stop:

Terminal window
sudo systemctl kill httpd
Terminal window
sudo systemctl reload httpd

Stops and Starts

Terminal window
sudo systemctl restart httpd
Terminal window
sudo systemctl enable httpd
sudo systemctl disable httpd


Commands require root or sudo privileges.

Terminal window
sudo apk update
Terminal window
sudo apk upgrade
Terminal window
sudo apk add apache2
Terminal window
sudo apk del apache2
Terminal window
sudo apk search apache2

Not available in Alpine’s package manager.

Terminal window
sudo apk info apache2

Alpine typically uses eth0 style names:

Terminal window
ls /sys/class/net

or

Terminal window
ip a

Edit network interfaces (replace eth0 with your interface name):

Terminal window
sudo nano /etc/network/interfaces

File contents will be like below

auto lo
iface lo inet loopback
#auto eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.1.172/24
gateway 192.168.1.1
hostname alpine

Configure DNS:

Terminal window
sudo nano /etc/resolv.conf
nameserver 192.168.0.1
nameserver 8.8.8.8
Terminal window
sudo ifdown eth0 && sudo ifup eth0
Terminal window
sudo apk add apache2 php php-mysqli php-apache2 mariadb mariadb-client
Terminal window
sudo rc-update add apache2 default
sudo rc-service apache2 start
Terminal window
sudo mysql_install_db --user=mysql --datadir=/var/lib/mysql
sudo rc-update add mariadb default
sudo rc-service mariadb start

Use the test scenario from section 1.3.2. Note: Alpine’s default web directory is /var/www/localhost/htdocs.

Alpine uses OpenRC as its init system.

Terminal window
rc-service apache2 status
Terminal window
sudo rc-service apache2 stop
sudo rc-service apache2 start
Terminal window
sudo rc-service apache2 reload
Terminal window
sudo rc-service apache2 restart
Terminal window
sudo rc-update add apache2 default
sudo rc-update del apache2 default


Devuan is a Debian derivative without systemd. Devuan 6 & 5 are based on Debian 13 & 12.

Commands require root or sudo privileges.

Terminal window
sudo apt update
Terminal window
sudo apt upgrade
Terminal window
sudo apt install apache2
Terminal window
sudo apt remove apache2
Terminal window
sudo apt search apache2
Terminal window
sudo apt autoremove
Terminal window
sudo apt show apache2

Devuan typically uses eth0 style names:

Terminal window
ls /sys/class/net

or

Terminal window
ip a

Edit network interfaces (replace eth0 with your interface name):

Terminal window
sudo nano /etc/network/interfaces

Static IP:

auto eth0
iface eth0 inet static
address 192.168.1.176/24
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1

DHCP:

auto eth0
iface eth0 inet dhcp
Terminal window
sudo nano /etc/resolv.conf
nameserver 46.196.235.35
nameserver 178.233.140.110
nameserver 46.197.15.60
Terminal window
sudo ifdown eth0 && sudo ifup eth0

Note: SSH connections may drop; reconnect using the new IP.

Terminal window
sudo apt update
sudo apt install --yes apache2 mariadb-server php libapache2-mod-php php-mysql

Use the test scenario from section 1.3.2.

Devuan services are typically enabled and started automatically. During installation, you can choose from three init systems:

  • sysvinit (default)
  • runit
  • OpenRC

This tutorial assumes sysvinit.

Terminal window
sudo service apache2 status
Terminal window
sudo service apache2 stop
sudo service apache2 start
Terminal window
sudo service apache2 reload
Terminal window
sudo service apache2 restart
Terminal window
sudo update-rc.d apache2 defaults
sudo update-rc.d apache2 remove