How to Install Webmin on Ubuntu 18.04 & Ubuntu 16.04 Server

Webmin is a free and open-source control panel for administering Unix-like servers. This tutorial will be showing you how to install Webmin on Ubuntu 18.04 & Ubuntu 16.04 server. Webmin gives users a graphical web-based user interface to configure common system tasks and settings. If you don’t like the idea of using command line to manage your server, then Webmin is a good graphical alternative to you.

Install Webmin on Ubuntu 18.04 & Ubuntu 16.04 From Webmin Repository

Webmin has been around since 1997. At the time of this writing, the latest stable version available is 1.941, which was released on January 16, 2020. Webmin isn’t in Ubuntu software repository. It’s recommended to install Webmin from its official repository so that you can always get the latest version.

To add Webmin repository, create a source list file with a command-line text editor such as nano.

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

Add the following line in the file.

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

webmin ubuntu

Save and close the file. To save the file in nano text editor, press CTRL+O, then press Enter to confirm. To close the file, press CTRL+X . Next, we need to run the following command to download and import Webmin PGP signing key to APT keyring so that the APT package manager can verify the integrity of packages downloaded from Webmin repository.

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

Then import it with:

sudo apt-key add jcameron-key.asc

Now we can update local package index and install Webmin.

sudo apt update

sudo apt install webmin

Once installed, the Wemin built-in web server will automatically start as can be seen by running the systemctl command below:

systemctl status webmin

Output:

 webmin.service - LSB: web-based administration interface for Unix systems
   Loaded: loaded (/etc/init.d/webmin; generated)
   Active: active (running) since Sun 2020-02-23 16:34:02 HKT; 37s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/webmin.service
           └─25792 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf

Webmin server listens on port 10000. Now you can access the web-based control panel via

https://your-server-ip:10000

Because it’s running in HTTPS mode and using a self-signed TLS certificate, so you will be told by the browser that the connection is not secure.

webmin ssl mode

But you know this is your own server, so simply click the Advanced tab in Firefox and add exception. If you are using Google Chrome, you can click Advanced -> Proceed.

And now you will be presented with Webmin login screen. You can use root or any other user accounts in the sudo group on your Ubuntu 18.04 & Ubuntu 16.04 system to login.

webmin ubuntu install

If you don’t like the default brown color on the navigation menu, you can change it to a different color by clicking the cog icon on the bottom of the navigation menu, then select navigation menu options and set the color palette. For example, I selected Midnight blue.

webmin navigation menu color

Save the change.

Setting Up Reverse Proxy

If you install Webmin on a production server, you might want to set up reverse proxy with Apache or Nginx so that you can use a domain name to access the Webmin interface without specifying the port number (10000). This also allows you to obtain and install a valid Let’s Encrypt TLS certificate for Webmin.

If you don’t have a real domain name, I recommend going to NameCheap to buy one. The price is low and they give whois privacy protection free for life.

Disable HTTPS Mode in Webmin

Before setting up the reverse proxy, we need to disable HTTPS mode in Webmin, because later we are going to terminate TLS connection at Apache/Nginx. Edit the Webmin configuration file.

sudo nano /etc/webmin/miniserv.conf

Find the following line.

ssl=1

Change it to the following to disable HTTPS mode in Webmin.

ssl=0

Save and close the file. Then restart Webmin.

sudo systemctl restart webmin

Apache

If you prefer to use Apache web server, then follow the instructions below to set up reverse proxy.

Install Apache web server.

sudo apt install apache2

To use Apache as a reverse proxy, we need to enable the proxy, proxy_http and rewrite module.

sudo a2enmod proxy proxy_http rewrite

Then create a virtual host file for Webmin.

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

Add the following texts into the file. Replace webmin.your-domain.com with your actual domain name and don’t forget to set an A record for it.

<VirtualHost *:80>
    ServerName webmin.your-domain.com

    ProxyPass / http://127.0.0.1:10000/
    ProxyPassReverse / http://127.0.0.1:10000/
</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite webmin.conf

Reload Apache for the changes to take effect.

sudo systemctl reload apache2

Now you can remotely access Webmin by entering the domain name (webmin.your-domain.com ) in browser address bar.

Nginx

If you prefer to use Nginx web server, then follow the instructions below to set up reverse proxy.

Install Nginx on Ubuntu.

sudo apt install nginx

Start Nginx web server.

sudo systemctl start nginx

Then create a new server block file in /etc/nginx/conf.d/ directory.

sudo nano /etc/nginx/conf.d/webmin.conf

Paste the following text into the file. Replace sabnzbd.your-domain.com with your preferred domain name and don’t forget to create A record for it. If you use a different port, change 8080 to your own port number.

server {
       listen 80;
       server_name webmin.your-domain.com;

       location / {
              proxy_pass http://127.0.0.1:10000;
              proxy_set_header Host $http_host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
        }
}

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx.

sudo systemctl reload nginx

Now you can access Webmin Web interface via webmin.your-domain.com.

Enable HTTPS

To encrypt the HTTP traffic when you visit Webmin web interface, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Ubuntu.

sudo apt install certbot

If you use Apache, then you need to install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

Next, run the following command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d webmin.your-domain.com

If you use Nginx, then you need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Next, run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d webmin.your-domain.com

Where:

  • --apache: Use the Apache plugin.
  • --nginx: Use the nginx plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed. And you will be able to access Webmin web interface over a secure HTTPS connection.

webmin ssl certificate

Add Trusted Referrers

Because Webmin itself is running in HTTP mode and we enabled HTTPS in Apache/Nginx, Webmin will think that https://webmin.your-domain.com is outside the Webmin server. So we need to add trusted referrers.

Edit the Webmin config file.

sudo nano /etc/webmin/config

Add the following line at the end.

referers=webmin.your-domain.com

Save and close the file. Then restart Webmin.

sudo systemctl restart webmin

Wrapping Up

I hope this tutorial helped you install Webmin on Ubuntu 18.04 & Ubuntu 16.04. As always, if you found this post useful, then subscribe to our free newsletter. You can also follow us on Twitter or like our Facebook page.

Rate this tutorial
[Total: 2 Average: 5]

2 Responses to “How to Install Webmin on Ubuntu 18.04 & Ubuntu 16.04 Server

  • maspram87
    3 weeks ago

    oke banget

  • Works great on Ubuntu 18 with webmin / virtualmin except statistics stopped working in the dashboard. Initially it refreshes 3 times and than it freezes. When using port 10000 it works correct. I cannot find anything relevant in the logs.

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.


The maximum upload file size: 2 MB.
You can upload: image.