How to install Webmin, cPanel, Apache, PHP, MySQL, Firewall, open-source antivirus, PHPMyAdmin and SSL on Ubuntu

Step 1: Update Ubuntu

Before starting, it's a good idea to update Ubuntu to make sure you have the latest packages. You can do this by running the following commands in the terminal:

sudo apt update
sudo apt upgrade

Step 2: Install Apache

Apache is the most popular web server on the internet. To install it, run the following command:

sudo apt install apache2


After installing Apache, you can start the service by running:

sudo systemctl start apache2

To check if the service is running, open your web browser and enter your server's IP address in the address bar. If everything is working correctly, you should see the Apache2 Ubuntu Default Page.

Step 3: Install PHP

PHP is a server-side scripting language that is used to build dynamic websites. To install it, run the following command:

sudo apt install php libapache2-mod-php


After installing PHP, you'll need to restart Apache to enable the PHP module:

sudo systemctl restart apache2

Step 4: Install MySQL

MySQL is a popular open-source database management system. To install it, run the following command:

sudo apt install mysql-server

During the installation, you'll be prompted to set a password for the root user. Make sure to choose a strong password and remember it.

After installing MySQL, you can start the service by running:

sudo systemctl start mysql


To secure the installation, run the following command:

sudo mysql_secure_installation

This will prompt you to answer a series of questions to secure your MySQL installation.

Step 5: Install Webmin

Webmin is a web-based interface for system administration tasks. To install it, run the following commands:

sudo sh -c 'echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list'
sudo sh -c 'wget -qO - http://www.webmin.com/jcameron-key.asc | sudo apt-key add -'
sudo apt update
sudo apt install webmin

After installing Webmin, you can access it by opening your web browser and entering your server's IP address followed by :10000 (for example, https://your_server_ip_address:10000).

Step 6: Install cPanel

cPanel is a popular web hosting control panel that allows you to manage your web server and websites. However, it's not available for Ubuntu. You can install alternatives like Plesk, CyberPanel or ISPConfig.

Step 7: Install Firewall

A firewall is an essential security tool that helps protect your server from unauthorized access. To install the UFW (Uncomplicated Firewall) firewall, run the following command:

sudo apt install ufw


After installing UFW, you can enable it and add rules to allow or block traffic. Here are some basic examples:

sudo ufw enable                 # enable the firewall
sudo ufw allow ssh              # allow incoming SSH connections
sudo ufw allow http             # allow incoming HTTP connections
sudo ufw allow https            # allow incoming HTTPS connections
sudo ufw status                 # check the firewall status

Step 8: Install ClamAV Antivirus

ClamAV is a popular open-source antivirus program. To install it, run the following command:

sudo apt install clamav clamav-daemon


After installing ClamAV, you can update the virus definitions by running:

sudo freshclam


To scan a directory for viruses, use the following command:

sudo clamscan -r /path/to/directory

Step 9: Install PHPMyAdmin

PHPMyAdmin is a web-based interface for managing MySQL databases. To install it, run the following command:

sudo apt install phpmyadmin

During the installation, you'll be prompted to select a web server. Choose Apache by pressing the space bar, then press Enter.

Next, you'll be prompted to configure the database for PHPMyAdmin. Choose Yes and enter the MySQL root user password when prompted.

After the installation is complete, you can access PHPMyAdmin by opening your web browser and entering your server's IP address followed by /phpmyadmin (for example, http://your_server_ip_address/phpmyadmin).

Step 10: Install SSL

SSL (Secure Sockets Layer) is a security protocol that encrypts data between a web server and a client. To install SSL, you'll need to obtain a certificate from a trusted certificate authority (CA). Here are the steps to obtain and install an SSL certificate from Let's Encrypt:

Install Certbot, which is a tool that automates the process of obtaining and installing SSL certificates:

sudo apt install certbot

Request a new SSL certificate by running the following command and replacing example.com with your domain name:

sudo certbot certonly --webroot --webroot-path /var/www/html -d example.com

This will create a new SSL certificate for your domain and store it in the /etc/letsencrypt/live/example.com directory.

Configure Apache to use the SSL certificate by editing the /etc/apache2/sites-available/default-ssl.conf file:

sudo nano /etc/apache2/sites-available/default-ssl.conf

Change the SSLCertificateFile and SSLCertificateKeyFile paths to match your SSL certificate:

SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

Enable the SSL module and the default SSL site by running the following commands:

sudo a2enmod ssl
sudo a2ensite default-ssl

Restart Apache to apply the changes:

sudo systemctl restart apache2

That's it ! Your server is up and running.


Did you find this article useful?