Install and Secure Webmin on Ubuntu 22.04

Webmin is an open-source server management platform that provides a web-based GUI for Linux system administration. It includes core functions and additional modules to handle user accounts, disk quotas, networking, and applications.

This guide explains how to install Webmin on an Ubuntu 22.04 server, giving you a browser-based control panel to manage and monitor server functionalities.

Prerequisites

Before starting, make sure you have:

  • An Ubuntu 22.04 server.
  • A new subdomain DNS record pointing to your server IP address (e.g., webmin.example.com).
  • SSH access to the server as a non-root user with sudo privileges.
  • Updated your server packages.

Install Webmin

Webmin is not included in the default Ubuntu 22.04 APT repositories. Use the following steps to add the Webmin repository and install the application.

Download the repository script

$ curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh

Run the script

$ sudo bash setup-repos.sh

Install Webmin

$ sudo apt install --install-recommends webmin -y

Verify Webmin service

$ sudo systemctl status webmin

Sample output:

● webmin.service - Webmin server daemon
     Loaded: loaded (/usr/lib/systemd/system/webmin.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-06-06 04:53:54 UTC; 43s ago
    Process: 5537 ExecStart=/usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf (code=exited, status=0/SUCCESS)
   Main PID: 5538 (miniserv.pl)
      Tasks: 1 (limit: 2269)
     Memory: 136.3M (peak: 219.0M)
        CPU: 7.408s
     CGroup: /system.slice/webmin.service
             └─5538 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf

Secure Webmin with HTTPS

By default, Webmin is available on port 10000 using HTTP. To secure the interface, configure it with HTTPS and trusted SSL certificates from Let’s Encrypt.

Allow HTTP for certificate validation

Install Certbot

$ sudo apt install certbot -y

Generate SSL certificates

$ sudo certbot certonly --standalone -d webmin.example.com -m webmin@example.com --agree-tos

Successful output example:

Certificate is saved at: /etc/letsencrypt/live/webmin.example.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/webmin.example.com/privkey.pem
This certificate expires on 2025-07-04.

Merge and move SSL certificate


$ sudo cat /etc/letsencrypt/live/webmin.example.com/fullchain.pem /etc/letsencrypt/live/webmin.example.com/privkey.pem > webmin.pem


$ sudo mv webmin.pem /etc/webmin/

Edit Webmin configuration

$ sudo nano /etc/webmin/miniserv.conf

Update the configuration to reference the new SSL file:

keyfile=/etc/webmin/webmin.pem

Restart Webmin

$ sudo systemctl restart webmin

Set Up Firewall Rules

Ubuntu 22.04 enables UFW by default. Configure the firewall to permit Webmin and secure connections.

Allow Webmin port

Allow HTTPS connections

Deny HTTP connections

Reload UFW

Check UFW status

Example output:

Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
10000                      ALLOW       Anywhere                  
443                        ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
10000 (v6)                 ALLOW       Anywhere (v6)             
443 (v6)                   ALLOW       Anywhere (v6)

Access Webmin

Open your Webmin domain in a web browser (for example, Chrome) on port 10000:

https://webmin.example.com:10000

Log in with your sudo user account credentials and click Sign In to enter the Webmin control panel.

Webmin login page

All users with login privileges can sign in to Webmin, but only those with sudo rights can execute administrative actions.

Verify Server Information

In the Webmin dashboard, review system details such as CPU, memory, disk space, and processes.

Update Server Packages

Navigate to System > Software Package Updates to see packages that require updates. Select the ones you want and click Update Selected Packages.

Update Server Application Packages using Webmin

Click Install Now to apply updates to the chosen packages on your server.

Manage Files

Go to Tools > File Manager to browse and manage files on your server.

Access file manager

Use Terminal

Navigate to Tools > Terminal to open a new terminal shell session directly from your browser.

Access terminal

Conclusion

You have successfully installed Webmin on Ubuntu 22.04, secured it with SSL certificates, and accessed the interface to manage your server. With Webmin, you can keep packages updated, manage the filesystem, and control essential components like users and processes. For further details and configuration guides, consult the official Webmin documentation.

Source: vultr.com

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in: