install Webmin featured image

How to Install Webmin on Ubuntu 18.04

For system administrators, Webmin is a boon. It’s a web-based control panel that allows managing a Linux machine remotely, using a modern web-based interface. Webmin can change various system configurations on the fly, including web servers and databases. It can also manage users, groups, and software packages.

In this guide, we will walk you through the steps of installing and configuring Webmin on Ubuntu 18.04.

Webmin on Ubuntu

While Webmin is a popular tool for system admins, it’s not available from the official Ubuntu repositories. Thankfully, Webmin has a dedicated PPA for Ubuntu. It takes care of keeping the software up-to-date. Here are the prerequisites you will need before we begin:

Now, let’s start!

Installing Webmin on Ubuntu

To install Webmin, we need to add the Webmin PPA. First, ensure that the system contains all the necessary dependencies:

Next, import the Webmin PGP key:

Finally, add the Webmin repo:

Webmin repo

APT can now recognize the Webmin PPA. Update the APT cache:

Finally, install Webmin:

Once the installation is complete, it will show something like this, indicating that Webmin can directly be accessed through the following link. In this example, it’s using my system hostname:

system hostname

It states that to have full control over the system using Webmin, the user has to know the root password. However, that’s not enough to secure something as sensitive as Webmin. We will be putting it behind the Apache webserver with a valid TLS/SSL certificate as we mentioned earlier.

Securing Webmin

For accessing Webmin, the default method is to have the port 10000 open. In our case, this is not optimal. To solve the issue, we are going to configure an Apache virtual host as a proxy to Webmin’s server running on port 10000. Then, the virtual host will be secured using a TLS/SSL certificate obtained from Let’s Encrypt. This procedure requires that you have installed and properly configured the Apache web server and Certbot.

  • Creating a New Apache Virtual Host

The new virtual host will be defined by its configuration file. Open the configuration file in your text editor of choice:

In the file, add the following lines:

It tells Apache to pass requests coming to the virtual host to the Webmin server at the following location. It also ensures that Webmin-generated internal links will pass through Apache.

  • Disabling Webmin TLS/SSL

Because we are going to configure Apache with TLS/SSL, there is no need for Webmin to have its own TLS/SSL. It’s recommended to disable this feature from Webmin. Next, open the Webmin configuration file in your text editor of choice:

Then, search for the following line:

Here, the value “1” denotes that Webmin has SSL enabled. Next, set the value to “0” to disable Webmin SSL.

  • Adding the Domain to Webmin

By default, Webmin wouldn’t allow our domain to access it. It’s because such access can be part of a malicious attack, for example, a Cross-Site Scripting (XSS) attack.

To ensure that Webmin allows our domain, it has to be declared in the Webmin configuration. Open the configuration file with your favorite text editor:

At the bottom of the text, add the following line:

After that, save the text, exit the editor, and restart the Webmin service to take all the changes into effect:

  • Configuring Apache

We need the proxy_http module of Apache. The following command will enable it:

It suggests restarting Apache. However, you need to enable the new virtual host first:

Finally, restart Apache. It’ll enable the module and the virtual host:

The following command will configure the firewall to allow incoming traffic on ports 80 and 443 (Apache default ports for HTTP/HTTPS traffic):

To verify the configuration worked successfully, go to your domain. It should bring up the Webmin login page. However, DO NOT log in to Webmin. As TLS/SSL wasn’t yet implemented, it will communicate through HTTP, sending all the data in clear text format:

  • Configuring TLS/SSL

We need a certificate for our domain so that the connection is encrypted. To do so, we will be using Let’s Encrypt. It’s a free, automated, and open certificate authority (CA). It runs for the benefit of the public, provided by the Internet Security Research Group (ISRG).

To generate the certificate, certbot is the tool to use in the shell. Run the following certbot command to generate a TLS/SSL certificate for your domain and configure Apache to redirect the traffic to the secure site:

The output will look like this:

It indicates that the certificate installation was successful and Apache was successfully configured to redirect requests from http://<domain> to https://<domain>.

Using Webmin

Finally, we are ready to manage the system using Webmin. Open the Webmin domain from a web browser and log in as the root user (or any other user with sudo privileges).

  • Managing Users and Groups

First, let’s see how to manage users and groups using Webmin. From the left panel, go to System >> Users and Groups:

Managing Users and Groups

To create a new user, click Create a new user:

Create a new user

After that, fill in the required info for the new user. Click Create to finalize the procedure:

Create

  • Package Updates

Webmin can also check for available package updates. From the left panel, click the Dashboard icon:

Dashboard

The Dashboard will present a quick summary of the system stats. Under the System Information section, locate the Package updates label. It will report if there’s any update available to any package.

Alternatively, from the left panel, go to System >> Software Package Updates. Under the Package Updates tab, Webmin will report all the packages that have updates available:

Package Updates

Under the Scheduled Upgrades tab, Webmin offers the option to automate package update installation:

install Webmin image 4

Next, below the Package Repositories tab, Webmin offers an easy way of managing all the package repos configured in the system:

Package Repositories

  • Running Custom Commands

While Webmin offers a ton of options and customizations, there are still things that need to be done manually. Webmin can run any shell command. To run a command, from the left panel, go to Tools >> Command Shell:

install Webmin image 3

Next, enter the desired command, and click Execute command to run it:

Execute command

Running certain commands regularly? Consider marking them up in Webmin. From the left panel, go to Tools >> Custom Commands. No need to type those commands manually anymore:

Custom Commands

  • Managing Apache

In addition, if there is any server engine installed, Webmin can manage it. For this example, we used Apache. In order to manage Apache through Webmin, go to Servers >> Apache:

Apache

Final Thoughts

Webmin is a very useful tool for managing your entire system. It offers a comfortable way of doing things that would normally require boring interaction with the console screen. Moreover, it helps you finely organize your system. This guide showcases the most useful applications of Webmin. Feel free to explore your way around the official Webmin wiki to learn more about utilizing the tool to your best advantage.

Happy computing!