Introduction
Webmin is a modern web control panel that allows you to manage your Linux server through a browser-based interface. With Webmin, you can manage user accounts, configure DNS settings, and change common packet settings on the fly.
In this tutorial, you will install and configure Webmin on your server and secure access to the interface with a valid Let’s Encrypt certificate. You will then use Webmin to add new user accounts and update all packages on your server from the dashboard.
Prerequisites To
complete this tutorial, you will need:
- An Ubuntu 20.04 server. This server must have a non-root user with sudo privileges and a UFW firewall configured. Set this up by following our Ubuntu 20.04 server initial setup guide.
- installed by following our tutorial on how to install Apache web server on Ubuntu 20.04. As you follow this prerequisite guide, be sure to configure a virtual host.
- fully qualified domain name (FQDN), with a DNS A record that points to the IP address of the server. To set this up, follow these instructions on DNS hosting on DigitalOcean.
Apache
A
Step 1 — Installing
Webmin
First, update your server’s package index if you haven’t done so recently:
- sudo apt
update
Then we need to add the Webmin repository so we can install and update Webmin using our package manager. We do this by adding the repository to the /etc/apt/sources.list file.
Open the file in your preferred editor. Here, we’ll use
nano:
- sudo nano /etc/apt/sources.list
Then add this line to the end of the file to add the new repository:
. . . deb http://download.webmin.com/download/repository sarge contrib
Save the file and exit the editor. If you used nano, do so by pressing CTRL + X, Y, and then ENTER.
Next, you’ll add the Webmin PGP key for your system to trust the new repository. To do that, however, you must install the gnupg1 package, which is GNU’s tool for secure communication and data storage.
After that, download the Webmin PGP key with wget and add it to your system’s key list: wget
-q -O- http://www.webmin.com/jcameron-key.asc | sudo apt-key add
Then update the package list again to include the now trusted
Webmin repository: sudo apt update Then install Webmin:
- sudo apt install webmin
After the installation is complete, you will be presented with the following output:
Output . . .
Complete Webmin installation. You can now log in to https://your_server:10000 as root with your root password, or as any user who can use sudo.
Let’s secure access to Webmin by adding a valid certificate.
Step 2 — Add a valid certificate with Let’s Encrypt
Webmin is already configured to use HTTPS, but uses a self-signed and untrusted certificate. Let’s replace it with a valid Let’s Encrypt certificate.
Navigate to https://your_domain:10000 in your web browser, replacing your_domain with the domain name pointing to your server’s IP address.
You will be presented with a login screen. Log in with the non-root user that you created by meeting the prerequisites for this tutorial.
Once you log in, the first screen you will see is the Webmin control panel. Before you can apply a valid certificate, you must set the host name of the server. Find the System Hostname field and click the link on the right, as shown in the following figure:
This will take you to the DNS Host and Client Name page. Locate the Host Name field and enter your Full Domain Name in the field. Then click the Save button at the bottom of the page to apply the settings.
After setting your hostname, click the Webmin drop-down menu in the left navigation bar and then click Webmin Settings.
On the Webmin Settings page, select SSL Encryption from the list of icons, and then click the Let’s Encrypt tab. You will see a screen like the following figure:
On this page, you will tell Webmin how to obtain and renew your certificate. Let’s Encrypt certificates expire after 3 months, but you can instruct Webmin to try to automatically renew the Let’s Encrypt certificate every month. Let’s Encrypt looks for a verification file on the server, so we’ll configure Webmin to place the verification file inside the /var/www/your_domain folder, which is the folder used by the Apache web server you configured in the prerequisites. Follow these steps to configure
the certificate:
- Populate the host names of the certificate with the FQDN
- For Website root directory for the validation file, select the Other Directory button and enter the document root for your website. Assuming you followed the Apache tutorial as a prerequisite, it will be /var/www/your_domain.
- In the Months between auto-renewal section, deselect the Renew only manually by typing 1 option in the input box and select the radio button to the left of the entry box.
.
Click the Request Certificate button. After a few seconds, you will see a confirmation screen.
To use the new certificate, click the Back to Webmin Settings button on the confirmation screen. From that page, scroll down and click the Restart Webmin button. Wait about 30 seconds, and then reload the page and sign in again. Your browser should now indicate that the certificate is valid.
Step 3 – Using
Webmin
You have now set up a secure working instance of Webmin. Let’s see how to use it.
Webmin has many different modules that can handle everything from the BIND DNS server to adding users to the system. Let’s see how to create a new user and then explore how to update your system packages using Webmin.
Managing Users and
Groups Let’s explore how to manage the users
and groups on your server. First, click the System drop-down menu in the left sidebar, and then click the Users & Groups
link
. From here, you can add and manage users and groups.
Let’s create a new user called deploy that you can use to host web applications. When you create a user, you can set options for password expiration, the user’s shell, and whether or not they are allowed a home directory.
To add a user,
click Create a new user, which is located at the top of the user table. This displays the Create User screen, where you can provide the user name, password, groups, and other options. Follow these instructions to create the user:
Fill in User name with
- deploy. Select Automatic
- for user ID
- Fill in Real Name with a descriptive name such as Deployment User
- Home Directory, select Automatic
- bin/bash from the drop-down list.
- type a password of your choice
- Go to Parent Group and select New Group with the same name as the user
- Secondary group, select sudo from the All Groups list. This should be automatically added to the In Groups list, but if it isn’t, press the -> button to add it.
.
. Under
. In the Shell, select /
Under Password, select Normal password and
.
. Under
After you make those selections, press Create. This will create the deployment user in no time.
Next, let’s see how to install updates on our system.
Updating
Webmin packages allows you to update all your packages through its user interface. To update all your packages, first, click the Panel button above the left sidebar and then find the Package Updates field. If updates are available, you’ll see a link indicating the number of available updates.
Click this link, and then press Update Selected Packages to start the update. You may be prompted to restart the server, which you can also do through the Webmin interface.
Conclusion
You now have a secure working instance of Webmin and have used the interface to create a user and update packages. Webmin gives you access to many things that you would normally need to access through the console, and organizes them in an intuitive way. For example, if you have Apache installed, you’ll find the configuration tab for it under Servers and then Apache.
Explore the interface or read the official Webmin wiki to learn more about managing your system with Webmin.