Web Hosting Blog – Dewlance

How To Install Webmin on Ubuntu 18.04

Webmin is basically a web-based control panel which helps you in managing server of any Linux machine. It has a modern web-based interface which makes your work easier.

 

 

Prerequisites

For Installing Webmin on Ubuntu 18.04 we will require –

 

 

Steps to Install Webmin

Step 1:

First, add Webmin Repository as it will help us in easily installing and updating Webmin by the package manager. You can do it by simply adding the Repository to /etc/apt/sources.list file.

 

Now Open the file in your editor:

sudo nano /etc/apt/sources.list

 

Now add this line at the bottom of the file to add the new repository:
/etc/apt/sources.list

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

Now you have to just Save the file and exit the editor.

 

Next, for letting our system to trust the new Repository, we need to add the Webmin PGP key.

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

 

Next, to include the Webmin Repository, update the list of packages.

sudo apt update

 

Now install Webmin:

sudo apt install webmin

 

After successfully installing it, You will see the following output,

Output
Webmin install complete. You can now login to 
https://your_server_ip:10000 as root with your 
root password, or as any user who can use `sudo`.

 

Now, let’s secure access to Webmin by putting it behind the Apache web server and adding a valid TLS/SSL certificate.

Now, to secure access to Webmin we need to put Apache web server and add an SSL certificate.

 

Step 2:

To access Webmin, you need to specify port 10000 and make sure that the port is open on your firewall.

 

First, you need to create a new Apache virtual host file in the Apache’s configuration directory:

sudo nano /etc/apache2/sites-available/your_domain.conf

 

Now add the following line but replace the email address and domain of your own:

/etc/apache2/sites-available/your_domain.conf

        ServerAdmin your_email
        ServerName your_domain
        ProxyPass / http://localhost:10000/
        ProxyPassReverse / http://localhost:10000/

Now Save the file and exit the editor.

 

Next, we need to aware Webmin to stop using SSL as Apache will provide SSL afterward:

Open the file /etc/webmin/miniserv.conf in your editor:

sudo nano /etc/webmin/miniserv.conf

 

Find the following line:
/etc/webmin/miniserv.conf

ssl=1

Change 1 to 0 and it will stop Webmin from using SSL:

 

Now, we need to add our domain in the list of allowed domain:

Open the file /etc/webmin/config in your editor:

sudo nano /etc/webmin/config

 

Now add the following line at the bottom replacing your-domain with original domain:

/etc/webmin/config

referers=your_domain

Now Save the file and exit the editor.

 

Next, you need to restart Webmin:

sudo systemctl restart webmin

 

Then enable Apache’s proxy_http module:

sudo a2enmod proxy_http

 

After enabling you’ll see the following output:

Output
Considering dependency proxy for proxy_http:
Enabling module proxy.
Enabling module proxy_http.

 

To activate the new configuration, you need to run:

systemctl restart apache2

 

The output stells to restart Apache, but at first, you need to activate the virtual host which you created:

sudo a2ensite your_domain

 

Now you’ll see the following output informing that your site is enabled:

Output
Enabling site your_domain.

 

To activate the new configuration, you need to run:

systemctl reload apache2

 

Now, it’s time to restart Apache completely:

sudo systemctl restart apache2

Visit http://domain-here in your browser, and you will see the Webmin login page in front of you.

 

Note: You should not log in to Webmin, as we haven’t enabled SSL.

 

Now you need to configure a certificate so that your connection is encrypted while using Webmin. In order to do this, use Let’s Encrypt.

Next, Tell Certbot to generate a TLS/SSL certificate for your domain and configure Apache to redirect traffic to the secured site:

sudo certbot --apache --email your_email -d your_domain --agree-tos --redirect --noninteractive

 

You’ll see the following output:

Output
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for your_domain
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/your_domain-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/your_domain-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/your_domain-le-ssl.conf
Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/your_domain.conf to ssl vhost in /etc/apache2/sites-available/your_domain-le-ssl.conf

Now you have successfully enabled https://domain-here and setup Webmin.

 

Exit mobile version