Webmin offers administration of a Linux system via a web interface. It is implemented as a set of Perl scripts that includes a small web server. Part of the appeal of Webmin is that it’s extremely comprehensive as there are modules for most typical administration tasks. This includes core system areas such as management of printers and users, and package-specific tasks such as configuration of Apache and Squid. In addition, it includes some handy tools like basic file backup and transfer, and system resource monitoring.
Step by step
Fetch the latest version
Head on over to the Webmin site and proceed to the Download page to fetch the latest version of Webmin. Alternatively, download the latest version as a DEB file by typing:
$ wget http://www.webmin.com/download/ deb/webmin-current.deb.
$ wget http://www.webmin.com/ download/rpm/webmin-current.rpm
Install Webmin (for DEB)
In the case of Debian-derived distributions, like Ubuntu, install the DEB file by typing sudo dpkg -i [name of .deb you downloaded]. This won’t satisfy all of the required dependencies for the package, so don’t worry if it throws up some errors. To fix this, type:
$ sudo apt-get -f install
Install Webmin (for RPM)
In the case of Red Hat-derived distributions such as CentOS, first make yourself root by typing su. To install, type: yum install [nameofRPM fileyou’vedownloaded].
Connect to Webmin
Fingers crossed, Webmin is now working. You can test it by navigating to https://[your hostname]:10000/. You can discover your hostname by typing hostname at the command prompt. If everything is working, you should see the web interface for Webmin.
Log in with root
Typically, you will give Webmin your ‘root’ username and password, when prompted. On a system such as Ubuntu that has no root account, you can use the username and password of the regular user so long as that user can execute sudo.
Set a static IP address
For convenience, you might want to assign a static IP address to the host machine, so that it can be consistently identified on the network. In Webmin, go to Networking>Network Configuration>Network Interfaces to see a list of currently activated network interfaces. Click on the name of the network adaptor used to connect to the rest of your network (‘eth0’ or similar for a wired network; ‘wlan0’ for a Wi-Fi one). From here, change the IP address to something congruent to your current numbering scheme but higher. For example from 192.168.1.5 to 192.168.1.200.
Configure your local firewall
If you can’t access Webmin from other machines on your network (by using http://[IP address:10000]/), don’t panic: it probably means that a local firewall is blocking port 10000. You can configure the local firewall using Webmin itself, too. Go to Networking> Local Firewall and click on the add button. Most of the fields on the next page can ignored, but set Network Protocol to equals TCP and Source TCP port to equals 10000. Click on Create to apply.
Configure your router
How you enable access from the internet is specific for each router, so you’ll need to examine the instructions for your router or visit portforward.com. In short, you need to allow incoming transmissions for port 10000 and forward that port to the IP address of the host computer on your network. This is usually very straightforward, but since every router is different, it’s impossible to explain in detail here.
Webmin package management
In this example, we’ll install OpenJDK to a stock Ubuntu machine using the Webmin package management facilities. Open the System submenu from the sidebar and select Software Packages. Note that the Search… button opens a window that allows searching of the APT database.
We’ll install Java support on Ubuntu in this example, but things work in much the same way on other platforms. On the main page, select the package from APT and enter default-jdk into the text box. Now select Install. Like many of the Webmin modules, this window contains quite a lot of useful text output. At the top it shows the Apt command that it shall execute (apt-get -y –force-yes -f install default-jdk in this case). Beneath this, it shows the output of Apt and below this, a tabular summary of all packages installed.
Manage cron jobs
The syntax of specifying a new scheduled UNIX job, or cron job, is notoriously fiddly, and Webmin offers a neat front-end for this. Begin by entering the System>Scheduled Cron Jobs page. On this page, you can create new jobs or edit jobs already on the system.
Create a cron job
We’re going to create a nightly job that deletes the contents of /var/log/mylogs using the Scheduled Cron Jobs page. Select the ‘Create a new scheduled cron job’ option and this takes you to the cron job editing page. In the job details section, specify that the job will be executed by user root. Type rm /var/log/mylogs/* into the Command text box. Add a description for the job to the Description text box. In the ‘When to execute’ section, select Simple schedule and Daily (at midnight). Finally, click on Create.
Search system documentation
The System Documentation module (accessed from within the System section), offers a complete man page browser, usefully, accessing the man files on the host system. To use it, simply enter a search term. It operates much the same way as the standard ‘man’ command, but many will find the web-based interface more convenient.
The Webmin Actions Log is a serious feather in Webmin’s cap. If you don’t add anything to the default form and click on search, you will be given a summary of configuration changes made that day. You can further refine your search by, for example, widening the date range.
Clone a module to have a second (or more) version with different settings. Go to Webmin> Webmin Configuration>Webmin Modules. Now select the Clone tab. From here, select a module to clone from the drop-down and give it a new name. Click on ‘Clone module’ and it will be added to the sidebar.
Webmin has basic facilities for the execution of commands on the host machine, with a display of the output using the Command Shell page. If there’s a command that you want to assign to a clickable button for frequent use, add it in the Custom Commands page.
If you need a bit more flexibility than the execute commands page allows, but you don’t want to (or aren’t able to) install SSH, try Others> Text Login. This offers a full terminal in which you can run text-mode programs, all from within the browser.
Back up config files
You can back up any configuration that Webmin modules can access to a local or remote file for later restoration on the Webmin>Backup Configuration Files page. You can independently select which modules to back up and restore (Ctrl- or Shift-click), and there’s a facility for scheduled backups.
File system backup
Webmin includes a simple facility to back up files and directories. To use it, go to System>Filesystem Backup. Specify a directory and click on ‘Add backup directory’. From here you can specify details such as a schedule for the backups and the remote (SSH, FTP) or local destination for the archive.
Go to Networking>Bandwidth Monitoring and click on ‘Set up now’. Once it’s set up, you have to create some traffic on that interface before a report can be generated. When you’ve done this, specify a time range and click on ‘Generate report’. Note that this function has a performance overhead.
Add a disk-space monitor
Webmin monitors alert you when certain conditions are met. Go to Others>System and Server Status. Click on Scheduled Monitoring and specify your SMTP email details. Select Disk Space from the drop-down and specify a 5% minimum size. Click on Create. Congratulations, you’ve started to master Webmin!