To install LAMP (Linux, Apache, MySQL, PHP) and Webmin on Ubuntu 22.04, follow the steps below:

Step 1: Update the System

Run the following commands to ensure your system is up-to-date:

sudo apt update
sudo apt upgrade -y

Step 2: Install Apache

sudo apt install apache2 -y

Enable and start Apache:

sudo systemctl enable apache2
sudo systemctl start apache2

You can verify by visiting http://localhost or your server’s IP address in a browser.

Step 3: Install MySQL

sudo apt install mysql-server -y

Secure MySQL installation:

sudo mysql_secure_installation

Follow the prompts to set the root password and secure your installation.

Step 4: Install PHP

sudo apt install php libapache2-mod-php php-mysql -y

Test PHP installation: Create a test file in the Apache root directory:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

Visit http://localhost/info.php or your server’s IP address to verify.

Step 5: Install Webmin

1. Add the Webmin Repository:

sudo nano /etc/apt/sources.list.d/webmin.list

Add the following line to the file:

deb http://download.webmin.com/download/repository sarge contrib

2. Import the GPG Key:

wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc

3. Update and Install Webmin:

sudo apt update
sudo apt install webmin -y

Access Webmin: Webmin is accessible via https://your-server-ip:10000. You can log in using your root credentials or a user with sudo privileges.

Step 6: Adjust Firewall Settings (if applicable)

Allow traffic for Apache and Webmin:

sudo ufw allow OpenSSH
sudo ufw allow 'Apache Full'
sudo ufw allow 10000
sudo ufw enable

Step 7: Enable SSL for Apache (Optional)

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache

Follow the prompts to set up an SSL certificate from Let's Encrypt.
Installing LAMP and Webmin in Ubuntu (Linux)

Post navigation