Webmin is an everyday tool for the sysadmin who would rather not leave his or her browser. It provides an all-in-one tool to manage your Linux box without the need to open a console. From backups to clustering, filesystems and system update, many aspects of your system is only a few clicks away with this compact tool.
In this tutorial we will install the latest stable Webmin to a freshly installed Ubuntu 20.04 system. It is a nice characteristic of Webmin that it does not really care if this distribution's release only came out a few days back, it does have a package for it, and it does install and run on it without any issues. To test this tool's capabilities, we'll perform a full system update of the operating system using the WUI (Web-based User Interface).In this tutorial you will learn:
- How to install required dependencies for Webmin
- How to download Webmin .deb package from the command line
- How to install Webmin from .deb package
- How to access the Webmin interface with a browser
- How to perform a full system update with Webmin
- How to administer the Webmin server with systemd
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||Ubuntu 20.04 LTS|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
Introduction to the environment
Our lab machine is a simple virtual machine with 1 CPU core, 2 GB of RAM, and 10 GB of disk space. The installation is a fresh Ubuntu 20.04 Desktop install. This is so because we'll demonstrate the WUI actions from within the virtual machine's screen, and for that we need a graphical interface and a browser.
In case of Webmin, a real world scenario most likely wouldn't involve a graphical interface at all, because Webmin will provide the ways to manage the machine from any browser that can reach the machine's specific port. Our machine's hostname will be
ubuntu-20, which will be needed later on. You'll need to replace it with your own hostname in case you are following step by step.
Install required dependencies for Webmin
Installing Webmin will be only a package install, but for that to work, we can install all required packages beforehand (remember that or lab machine is a basic Desktop install). We will use
apt to install all required packages:
$ sudo apt-get install libauthen-pam-perl libio-pty-perl apt-show-versions python libapt-pkg-perl python2 python2-minimal python2.7 libpython2-stdlib python2.7-minimal libpython2.7-stdlib libpython2.7-minimal
All of these packages are available in the official Ubuntu repositories, which are enabled on a fresh install by default.
Downloading Webmin .deb package from the command line
We can go to the official Webmin download page and search for the package we need, but in this case we already know the URL where we can find the package. So we will use
wget to download the
.deb package to a suitable folder:
$ wget http://prdownloads.sourceforge.net/webadmin/webmin_1.941_all.deb
What does stands out of the crowd here, and you will notice if you check the download site, that there is a single package for Debian, Ubuntu, and all other derivative distros - no package by distribution, and no package by release of that given distribution. A single package for all, and this single package works out of the box. Refreshingly simple.
Installing Webmin from .deb package
Since all dependencies already resolved in the first step of this tutorial, all that is left is to install the downloaded package. We'll use
$ sudo dpkg --install webmin_1.941_all.deb
Installation will provide output. At the end of it, you may find a notice regarding the URL we'll need to access Webmin:
Webmin install complete. You can now login to https://ubuntu-20:10000/ as root with your root password, or as any user who can use sudo to run commands as root.
There are also instructions on user privileges needed. In our case we are the primary user of our lab machine with sudo privileges set up when the system was installed.
How to access the Webmin interface with a browser
With the URL the installer mentioned we can now access the WUI of our running
webmin service using a browser. Note that you'll need to use your own machine's hostname or IP address. If accessing the URL from within the machine, you can also use
localhost for hostname.
In our case the hostname is
ubuntu-20, we are accessing TCP port 10000 (which is the default for Webmin), and we are using
https protocol. Because the certificate used by Webmin is self-signed, the browser will most likely raise an alarm about it. We can safely accept this certificate in this case, the lab environment (with the browser included) is isolated from the rest of the world.
Upon login, a beautiful showcase of information greets us about the various aspects of our system, including system load, resource consumption, and so on. We also got an alarm (notice the red number next to the bell to the right) indicating that something isn't right with our system.
If we click on the bell icon, we can see the details.
From the information provided a number highlighted in red stands out: we have 159 package updates available. That's quite a lot! And it is of no surprise, the lab machine is installed from a recent ISO image, but the official release is only happened a few days back: many fixes issued since. We'll solve this issue in the next step by the means provided by the Webmin tool.
Performing a full system update with Webmin
Clicking on the highlighted red sign brings us directly to the Software Package Updates page, where we can solve the issue by updating our system. The default is to update all, which is generally a good idea. Even more so in the case of a fresh release.
By executing a full package update we get a neat console output where we can follow the process. Webmin also detects if a system reboot is required at the end of the update process, and will give us the option to do so from the web interface.
And with this we solved the problem detected by Webmin with the tools provided by Webmin, and our system is up to date without any alarms.
Administering the Webmin server with systemd
Not only Webmin is easy to install, it is also easy to manage as a service. The single package we installed also takes good care of integration with the init system, even if only by the means of an InitV script. Any recent
systemd can read it and can manage it out of the box:
# systemctl status webmin.service ● webmin.service - LSB: web-based administration interface for Unix systems Loaded: loaded (/etc/init.d/webmin; generated) Active: active (running) since Sat 2020-05-02 17:22:34 CEST; 5min ago Docs: man:systemd-sysv-generator(8) Process: 744 ExecStart=/etc/init.d/webmin start (code=exited, status=0/SUCCESS) Tasks: 1 (limit: 2319) Memory: 44.0M CGroup: /system.slice/webmin.service └─984 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf May 02 17:22:29 ubuntu-20 systemd: Starting LSB: web-based administration interface for Unix systems... May 02 17:22:30 ubuntu-20 perl: pam_unix(webmin:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=root May 02 17:22:33 ubuntu-20 webmin: Webmin starting May 02 17:22:34 ubuntu-20 systemd: Started LSB: web-based administration interface for Unix systems.
Which in turn means that we can manage the
webmin.service mostly as it where a systemd service, by using
systemctl start/stop/enable/disable, as the need arises.
Webmin is a valuable tool in a sysadmin's hand, bringing many building blocks of the system into a single place to manage. It's capability of highlighting possible problems is also a great weapon for stability, and the real time performance metrics render many fancy graphical tools to child's toys, just to name two of it's many features.
With it's great power also comes the need to protect it, however. Do not expose Webmin to the wide Internet, because that will show a door to your box that can be opened by cracking a single username/password pair for full control.