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
Update Your System
Connect to your Ubuntu 24.04 server via SSH and ensure all packages are up to date:
sudo apt update && sudo apt upgrade -y
Add the Webmin Repository
Webmin is not included in the default Ubuntu repositories.
Run the following official setup script to download and configure the Webmin repository and its GPG key:
sudo curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
sudo bash setup-repos.sh
Install Webmin
Update your package index again to register the new repository, then install Webmin along with its dependencies: [1, 2]
sudo apt update
sudo apt install webmin --install-recommends -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.
Configure the Firewall (if required)
Webmin listens on port 10000. If you are using UFW (Uncomplicated Firewall), allow traffic through this port so you can reach the web interface:
sudo ufw allow 10000/tcp
sudo ufw reload
Step 6: 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.
