How to Install Webmin on Ubuntu 22.04

Choose a different version or distribution

Introduction

Before we begin talking about how to install Webmin on Ubuntu 22.04, let's briefly understand – What is Webmin?

Webmin is a powerful web-based system administration tool that simplifies the management of Linux servers. It provides a user-friendly interface to configure and control various aspects of the server, including network settings, user accounts, file systems, and more.

With Webmin, even users without advanced technical knowledge can easily perform essential administrative tasks. It supports multiple modules and plugins, allowing customization and integration with other software. Webmin is an indispensable tool for efficiently managing Linux servers, enhancing productivity, and ensuring smooth server operation.

In this tutorial, you will install and set up Webmin on your server and secure access to the user interface with a legitimate Let's Encrypt certificate. We will also address a few FAQs to install Webmin on Ubuntu 22.04.

Advantages of Webmin

  1. User-Friendly Interface: Webmin offers an intuitive web-based interface, making server management tasks accessible to users without extensive technical expertise.
  2. Comprehensive Server Control: It allows easy configuration and control of various server aspects, such as network settings, user accounts, and file systems.
  3. Time and Effort Savings: Webmin simplifies complex administrative tasks, saving valuable time and effort for system administrators.
  4. Customization and Integration: With support for modules and plugins, Webmin can be customized and integrated with other software to meet specific server management needs.
  5. Cross-Platform Compatibility: Webmin is compatible with various Linux distributions, making it a versatile tool for server administration across different environments.

Prerequisites to Install Webmin on Ubuntu 22.04

Before we begin, you will need the following:

Step 1 – Installing Webmin

First, if you haven't done so already, update your server's package index:

sudo apt update

The Webmin repository has to be added next so that we can use our package manager to install and update Webmin. This is achieved by including the repository in the /etc/apt/sources.list file.

Open the file in the editor of your choice. In this instance, we will use nano:

sudo nano /etc/apt/sources.list

Then, to add the new repository, add the following line to the bottom of the file:

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

Save the document, then close the editor. If you used nano, exit by pressing CTRL+X, Y, then ENTER.

The Webmin PGP key will then be added so that your system can trust the new repository. However, you need to install the gnupg1 package, which is GNU's tool for secure data storage and communication, in order to achieve that.

After that, use wget to download the Webmin PGP key and add it to the list of keys on your system:

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

Then, add the newly-trusted Webmin repository to the updated list of packages:

sudo apt update 

Install Webmin next:

sudo apt install webmin 

After the installation is complete, check its status:

sudo systemctl status webmin
Output

● webmin.service - Webmin server daemon
     Loaded: loaded (/lib/systemd/system/webmin.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-06-20 06:30:48 UTC; 2s ago
    Process: 27605 ExecStart=/usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf (code=exited, status=0/SUCCESS)
   Main PID: 27606 (miniserv.pl)
      Tasks: 1 (limit: 2307)
     Memory: 26.8M
        CPU: 787ms
     CGroup: /system.slice/webmin.service
             └─27606 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf

Jun 20 06:30:45 ip-172-31-80-194 systemd[1]: Starting Webmin server daemon...
Jun 20 06:30:45 ip-172-31-80-194 perl[27605]: pam_unix(webmin:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=  user=root
Jun 20 06:30:48 ip-172-31-80-194 webmin[27605]: Webmin starting
Jun 20 06:30:48 ip-172-31-80-194 systemd[1]: Started Webmin server daemon.

Note: To allow Webmin past the firewall, you must run the following command if you installed and activated ufw during the prerequisite step:

sudo ufw allow 10000

You might wish to set up your firewall so that only specific IP ranges are permitted access to this port for added security.

By adding a valid certificate, let us secure access to Webmin.

Step 2 – Using Let's Encrypt to Add a Valid Certificate

Although Webmin already has HTTPS enabled, it does so with a self-signed, untrusted certificate. Let us substitute it with a Let's Encrypt certificate.

Use your web browser to go to https://your_domain:10000, substituting your_domain with the domain name that points to your server's IP address.

Note: An “Invalid SSL” warning will appear when you first log in. Depending on your browser, this warning can say something different, but it is there because the server has created a self-signed certificate. Accept the exception, then head to your domain to swap out the self-signed certificate for a Let's Encrypt one.

A login screen will be shown to you. Use the non-root user you made while completing the requirements for this tutorial to log in.

The Webmin dashboard will be the first screen you see after logging in. The hostname of the server must be established before you can apply a valid certificate. As seen in the following figure, locate the System hostname field and click the link to the right.

By doing so, you will be directed to the Hostname and DNS Client page. Find the Hostname field and fill it with your Fully-Qualified Domain Name. To apply the setting, click the Save button at the bottom of the page.

After you have chosen your hostname, select Webmin Configuration from the Webmin dropdown menu in the left navigation bar.

Choose SSL Encryption from the list of icons on the Webmin Configuration page, and then select the Let's Encrypt tab.

You will instruct Webmin on how to obtain and renew your certificate on this page. Let's Encrypt certificates expire after three months, however, you can tell Webmin to try to renew the certificate automatically every month. We will set Webmin to place the verification file inside the folder /var/www/your_domain. For certificate setup, follow these steps:

  1. Enter your FQDN in the Hostnames for certificate field.
  2. Select the Other Directory button and type the document root of your website when prompted for the Website root directory for the validation file. This will be /var/www/your_domain, assuming you followed the mandatory Apache tutorial.
  3. Deselect the Only renew manually option in the Months between automatic renewal section by typing 1 into the input box and selecting the radio button to the left of the input box.

Select the Request Certificate button. You will receive a confirmation page a few seconds later.

Click the Return to Webmin configuration button on the confirmation screen to begin using the new certificate. Scroll down and click the Restart Webmin option on that page. Wait around 30 seconds, then reload the website and log in again. Your browser should now display that the certificate is genuine.

Step 3 – Using Webmin

Now that you have established a secured working instance of Webmin. Let’s understand how it works.

The numerous modules available in Webmin can manage anything from the BIND DNS Server to adding users to the system. Let us start by learning how to create a new user before moving on to explore how to update your system’s packages using Webmin.

Managing Users and Groups

Let us look at how you may manage the users and groups on your server.

Click the Users and Groups link after selecting System from the left-sidebar dropdown menu. You may manage and add users and groups from here.

Let us create a new user named deploy so that you can use to host web applications. You can specify parameters for the user's shell, password expiry, and whether they are permitted to have a home directory when creating a user.

Click Create a new user at the top of the users table to add a new user. The Create User screen appears, allowing you to enter the username, password, groups, and other details. To create the user, adhere to the following instructions:

  1. Enter the Username with deploy.
  2. User ID should be set to Automatic.
  3. Add a descriptive name, like Deployment user in the Real Name field.
  4. Select Automatic for Home Directory.
  5. Click /bin/bash from the dropdown list for Shell.
  6. Select Normal Password under Password, then enter your preferred password.
  7. Select a New group with the same name as the user under Primary Group from the drop-down menu.
  8. Choose sudo from the All groups list for Secondary Group. If it is not automatically added to the In groups list, click the button to add it.

Press Create when you have made your selections. It will create the deploy user in short order.

Let us explore how to update our system.

Updating Packages

Webmin allows you to update all of your packages through its user interface. To update all of your packages, first, locate the Package updates field by clicking the Dashboard icon above the left-hand sidebar. If updates are available, you will notice a link with the number of updates listed.

To begin the update, click this link and then select Update selected packages. The server may need to be restarted, which you may easily do using the Webmin interface.

FAQs to Install Webmin on Ubuntu 22.04

Can I install Webmin on other Ubuntu versions?

Yes, Webmin can be installed on various Ubuntu versions, including 22.04, 20.04, 18.04, and others. The installation steps may vary slightly, so it's recommended to refer to the official documentation for specific instructions.

How do I access Webmin after installation?

After installation, you can access Webmin by opening a web browser and entering https://your-server-ip:10000. Replace your-server-ip with the IP address of your Ubuntu server.

What are the default login credentials for Webmin?

You can log in to Webmin using the root user or any user with sudo privileges on your Ubuntu server. Enter the corresponding username and password to access the Webmin interface.

How can I secure my Webmin installation?

To enhance security, it is recommended to configure Webmin to use SSL/TLS encryption. You can follow the instructions in the Webmin documentation to generate and install an SSL certificate for secure access.

Can I manage multiple servers with Webmin?

Yes, Webmin supports managing multiple servers from a single interface. You can add additional servers in the Webmin Configuration section and provide the necessary credentials to manage them.

Can I uninstall Webmin if needed?

Yes, you can uninstall Webmin by running sudo apt remove webmin. Additionally, you can remove its configuration files using sudo apt purge webmin.

Where can I find more information and documentation about Webmin?

You can find detailed information, documentation, and community support for Webmin on the official Webmin website at www.webmin.com.

Conclusion

Now you have a secure working instance of Webmin and you have used the interface to create a user and update packages. Many items that you would typically need to access through the console are now available through Webmin, and they are arranged in an intuitive manner. For instance, if Apache was installed, the configuration tab for it would be located under Servers, followed by Apache.

Learn more about managing your system with Webmin by navigating the interface or reading the Official Webmin Wiki.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them.