Cheap VPS Hosting

Oct 11, 2024

23 min read

Simple Guide – How to Install Webmin on Debian 12 and How to Use it

Written by

Abdelhadi Dyouri

Introduction

Are you searching for a step-by-step guide to install Webmin on Debian 12? This simple tutorial is for you!

Webmin is a free, open-source web-based control panel that simplifies Linux server management right from your browser. Its intuitive dashboard lets you handle various configurations, including user accounts, disk quotas, DNS settings, services, web servers, and much more. If you're using a LAMP stack, Webmin makes it easy to manage your Apache web server, MySQL, PHP applications, and even technologies like PostgreSQL and Python. Plus, you can manage your server remotely from any browser.

Install Webmin on Debian 12

In this guide, we’ll walk through installing Webmin on an Debian 12 server. We'll also cover basic system administration tasks like monitoring your system, adding users with custom permissions, managing packages, and running software or commands on your server.

Prerequisites

  • A Debian 12 server with root access or a sudo user. If you haven't noticed, we offer extremely powerful Debian Linux servers at the globe's absolute lowest price. Take a look at our offerings and prepare for your mind to be blown 🤯.
  • Access your sever via SSH, check out How to access your server using SSH for instructions.

Note

If you want to skip all the technical steps of setting up Webmin and have it installed in minutes, you can use our tried and tested 1-click Webmin application. Just choose a server, click Customize Your Own Server, under Select Server Image go to the Apps tab, then choose Webmin. This will set up Webmin in minutes!

Step 1: Updating the Package Cache

Start by updating the packages in the package manager cache to the latest available versions using the following command:

sudo apt update

Step 2: Install Webmin on Debian 12

To install the Webmin control panel on Debian 12, you'll first add the Webmin repository that will enable you to install the Webmin packages and update them with apt, then you'll update the package cache, and finally you'll use the apt install webmin command.

Install the Required Packages

First, install curl to use it to download the Webmin repository setup script, and gnupg2 to verify Webmin signatures:

sudo apt install gnupg2 curl -y

Download and Run the Setup Script

Next, download the setup script:

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

Run this script:

sh setup-repos.sh

Update the package cache:

sudo apt update

Install Webmin

After the Webmin repositories setup, you can now install Webmin:

sudo apt install webmin --install-recommends

Once the installation finishes, check that the webmin service is running properly using the following command:

sudo systemctl status webmin
● webmin.service - Webmin server daemon
     Loaded: loaded (/lib/systemd/system/webmin.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-09-08 11:57:14 UTC; 1h 22min ago
    Process: 6352 ExecStart=/usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf (code=exited, status=>
   Main PID: 6353 (miniserv.pl)
      Tasks: 5 (limit: 9476)
     Memory: 106.4M
        CPU: 2min 39.979s
     CGroup: /system.slice/webmin.service
             ├─ 6353 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
             ├─ 6833 /usr/bin/perl /usr/share/webmin/authentic-theme/stats.pl 555
             ├─ 6910 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
             ├─18708 sh -c "(vmstat 1 2 2>/dev/null)"
             └─18709 vmstat 1 2

Note: Webmin is accessible via port 10000. If you have a firewall, you need to allow Webmin's port through the firewall:

sudo ufw allow 10000

Warning: You should be extremely careful with your security practices. It is best to allow only a few trusted IP addresses or IP ranges to access your Webmin control panel.

With the Webmin package installed, use your browser to visit the following URL, replacing your_ip_address_or_domain with your server's IP address or domain name:

https://your_ip_address_or_domain:10000

If you haven't set up an SSL certificate from a trusted Certificate Authority like Let's Encrypt, your browser will show a "Not Secure" or "Connection is not private" error. This happens because the connection to your server isn't recognized as secure. Don't worry though—this is expected. Webmin uses a self-signed certificate for encryption, but since your server isn't a known certificate authority, the browser flags it as untrusted.

The following is an example of the error in the Google Chrome browser. Don't worry, we'll fix this later.

Webmin Server Initial Connection on Debian

Click the Advanced button or More information depending on the browser, and choose to proceed.

Webmin on Debian 12 Login Page

Login using the Unix username and password you've set up on the server. Or you can use your server's root account.

You’ll be moved to the dashboard:

Webmin Dashboard on a Debian 12 System

With this, you have Webmin installed on your Debian 12 server and ready to be used.

Reader Alert!

To avoid all these steps and install Webmin in minutes, you can use our tried and tested 1-click Webmin application. Just choose a server, click Customize Your Own Server, under Select Server Image go to the Apps tab, then choose Webmin. This will set up Webmin in minutes!

Step 3: Using Webmin to Perform Basic Sysadmin Tasks

Webmin comes with a variety of modules that help you control and configure different aspects of your system. In this step, you'll get familiar with some of these modules and how to use them effectively. You'll learn how to install and update packages, manage system users and groups, and handle Webmin user accounts directly from the Webmin interface.

Installing Packages

To install a software package using Webmin, follow these steps:

  1. On the left-hand Webmin menu click System then Software Packages.
  2. Click Install a new package, then Select the Package from APT radio button.
  3. Type in the package name you want to install, for example nginx, then click Install. You'll be taken to a page that asks you to confirm installing the package and it's dependencies, which will be listed in a table.
  4. Click Install Now.

Installing Packages on Webmin

This way you can install any package using Webmin directly.

Updating Packages

To update all your packages to the latest version using Webmin, follow these steps:

  1. On the left-hand menu click System then Software Package Updates. You’ll get a list of all the packages that need to be updated. You can check and uncheck packages to be updated.
  2. To update all packages, make sure they are all checked, then click Update Selected Packages. You'll be taken to a page with the complete list of the packages that will be updated.
  3. Click Install Now.

Updating Packages on Webmin
The update process will begin, and once it’s complete, you might be prompted to reboot the system if any of the updated packages require it. To reboot your server through Webmin, simply click on the "Reboot Now" button.

Managing Unix Users and Groups

A Unix user is a regular user who connects to your server via SSH or FTP, owns files and folders, and has a personal home directory. In this section, we'll use Webmin to create a new user with a dedicated home directory. We'll also add the user to the sudo group to grant them administrative privileges. In this tutorial, we’ll name the user example_user but you can use any name you prefer.

To create a system user on your server using Webmin, follow these steps:

  1. On the left-hand menu, click on System then Users and Groups. You'll be taken to the Users and Groups Webmin module, where you have a table for all the current system users under Local Users and a table for the current system groups under Local Groups.
  2. In the Local Users table, click Create a new user. This will take you to the Create User page.
  3. Type in example_user in the Username field.
  4. Select Automatic for the User ID field.
  5. Set the Real Name to the full name of the user or use a descriptive name such as Monitoring User or Updates User.
  6. Select Automatic for the Home Directory field.
  7. Set Shell to bin/bash.
  8. Set Password to Normal password and type in a strong password for your user.
  9. In the Group Membership menu, select New group with same name as user for the Primary group.
  10. In the Secondary groups, click on sudo in the All groups list then click the right arrow. This adds sudo to the In groups list.
  11. Click Create.

With this, you now have a new user called example_user on your system with sudo privileges.

Managing Webmin Users

Creating Webmin Users on Debian 12

Besides creating Unix users, you can also grant others access to Webmin by creating Webmin user accounts. You can control what they can do by selecting specific modules for them to use. For instance, you could allow a user access only to the Software Package Updates module. You can also fine-tune permissions within modules—like creating a user who can only view the list of updates, or one who can both view and apply them.

Webmin allows you to create two different kinds of users, a safe user, and a privileged user. A safe user can have access to only safe modules, and a privileged user can be granted all privileges on the system.

To create a Webmin account:

  1. Click Webmin in the left menu, then Webmin Users. You'll see root as the default user with full control.
  2. Enable password expiry prompts: Go to Webmin Configuration > Authentication, check Prompt users with expired passwords to enter a new one, then click Save.
  3. To create a privileged user:
    • Go to Webmin Users, click Create a new privileged user.
    • Enter a Username and set a strong password.
    • Check Force change at next login.
    • Set a Real Name or a descriptive name like "Monitoring User."
    • Under Security and limits options, set Inactivity logout time to 30 minutes, Minimum password length to 15, and optionally restrict access by IP and time.
    • In Available Webmin modules, either select all or choose specific ones.
    • Click Create.

Log out from Webmin by clicking the red logout icon at the bottom of the left-hand menu, and log in with the new user. Change the password if prompted. If access is limited, the left menu will show only the selected modules.

Step 4: Adding a Let’s Encrypt SSL Certificate to Webmin

  1. On the left-hand menu, click Networking, then Network Configuration.
  2. Click on Hostname and DNS Client.
  3. Fill in the Hostname field with your domain, such as example.com or www.example.com.
  4. Click Save

After setting up your domain name, install a Let's Encrypt certificate by following these steps:

  1. Click Webmin in the left-hand menu, then Webmin Configuration.
  2. Click on SSL Encryption.
  3. Go to the Let’s Encrypt tab.
  4. Click Install Now to install the Let’s Encrypt Certbot client.
  5. Once the installation is complete, click Return to SSL Encryption.
  6. Type in your domain name in the Hostnames for certificate field.
  7. Under Let's Encrypt validation method, select Certbot built-in webserver.
  8. In the Months between automatic renewal field, type in 1. This attempts to renew the Let's Encrypt certificate each month.
  9. Click Request Certificate.
Requesting a new certificate for webmin.example.com, using the Certbot webserver ..
.. request succeeded!

Configuring Webmin to use new cert and key ..
.. done!

Restart Webmin and wait for a few seconds while Webmin reboots, then refresh the page, and you'll see that the Let's Encrypt certificate is enabled.

(Optional) Step 5: Using Webmin’s Let’s Encrypt Certificate With Nginx and Apache on Debian

Note: This section will be a brief description of how to use your SSL certificate with Nginx and Apache, for more on SSL certificates and Let’s Encrypt, check out How to Create a Self-Signed Certificate on Ubuntu 24.04 for Apache and Nginx and How To Install Let's Encrypt on Ubuntu 24.04 With Certbot for Apache and Nginx.

To configure your web server with your Let's Encrypt certificate:

  1. Click Webmin in the left menu, then Webmin Configuration.
  2. Click SSL Encryption.

Here, you'll find details about your SSL certificate, including the paths to the private key file and certificate file.

Webmin Let's Encrypt Certificate

Here, you have the following:

  • The private key file's path: Under Private key file, in this case, the path is /etc/webmin/letsencrypt-key.pem.
  • The certificate file's path: Under Certificate file, in this case, the path is /etc/webmin/letsencrypt-cert.pem.

Note: Make sure to set these paths properly in your web server's configuration in the next steps.

Configuring Nginx to Use the Let's Encrypt Certificate

First, open your Nginx configuration file in your /etc/nginx/sites-enabled directory, this could be the default configuration file, in which case you can open it using the following command:

sudo nano /etc/nginx/sites-available/default

Otherwise, if you have disabled the default configuration and configured Nginx for your domain, the following command should be used instead. Remember to replace your_domain with your domain name:

sudo nano /etc/nginx/sites-available/your_domain

Change the values of the ssl_certificate and ssl_certificate_key directives, by setting ssl_certificate to the path of your certificate file, and ssl_certificate_key to the path of your private key file, like so:

server {
   listen 80;
   listen [::]:80;
   server_name your_domain;
   access_log off;
   location / {
         rewrite ^ https://$host$request_uri? permanent;
   }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name your_domain;
    root /var/www/your_domain;
    index index.php index.html index.htm index.nginx-debian.html;
    autoindex off;
    ssl_certificate /etc/webmin/letsencrypt-cert.pem;
    ssl_certificate_key /etc/webmin/letsencrypt-key.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;

    location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
    }
}

Save and close the file.

In addition to setting the ssl_certificate and ssl_certificate_key directives. Remember to also change your_domain in the preceding configuration with your domain name, and make sure to set the value of the root directive to your web root directory.

If you are using a custom configuration file, link it to the configuration file from NGINX’s sites-enabled directory, if you haven't already:

sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled

To check that your configuration file has been properly linked to NGINX’s sites-enabled directory, run the following command:

sudo ls -l /etc/nginx/sites-enabled

You should have a line similar to the following as part of the output:

lrwxrwxrwx 1 root root 33 Aug  4 10:07 your_domain -> /etc/nginx/sites-available/your_domain

Next, check for syntax errors in your configuration files using the following command:

sudo nginx -t

The output should let you know that the configuration file test is successful.
Now, restart NGINX:

sudo systemctl restart nginx

Now visit your website’s domain name or IP address using https:// at the beginning:

https://your_domain_name

Reload your browser and you will notice a secured padlock with a valid certificate.

Configuring Apache to Use the Let's Encrypt Certificate

To configure Apache to use the Let's Encrypt certificate you obtained using Webmin, first open your Apache configuration file, which is located by default at /etc/apache2/sites-enabled/000-default.conf:

sudo nano /etc/apache2/sites-available/000-default.conf

Otherwise, you might have set up an Apache configuration file for your site at /etc/apache2/sites-available/your_domain.conf, with your_domain representing your domain name as usual, in which case you may use the following command:

sudo nano /etc/apache2/sites-available/your_domain.conf

Change the values of the SSLCertificateFile and SSLCertificateKeyFile directives, by setting SSLCertificateFile to the path of your certificate file, and SSLCertificateKeyFile to the path of your private key file, like so:

<VirtualHost *:80>
        Define servername your_domain
        ServerName ${SERVERNAME}
        RewriteEngine on
        RewriteRule ^/.*$ https://\${SERVERNAME}%{SCRIPT_FILENAME}?%{QUERY_STRING} [R=301]
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
        SSLEngine On
        SSLCertificateFile /etc/webmin/letsencrypt-cert.pem
        SSLCertificateKeyFile /etc/webmin/letsencrypt-key.pem
        ServerName ${SERVERNAME}
        DocumentRoot /var/www/your_domain
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Again, make sure to replace your_domain with your domain name.

Save and close the file.

If you haven't already, you should enable your your_domain.conf file using the a2ensite command:

sudo a2ensite your_domain.conf

You might also want to disable the default site in 000-default.conf:

sudo a2dissite 000-default.conf

Next, test for configuration errors:

sudo apache2ctl configtest

You should receive an output that contains the text Syntax OK, which means you can safely reload Apache, otherwise, you will get a very specific description pointing out the error you have to fix.

Next, restart Apache:

sudo systemctl restart apache2

Now, reload your website in the browser. You will notice a secured padlock with a message that informs you that your SSL certificate is valid.

With this, you now have HTTPS enabled in your Apache web server using the Let's Encrypt certificate you obtained using Webmin.

Conclusion

You've installed Webmin on Debian 12, and used it to perform many sysadmin tasks, such as installing and updating packages, managing Unix users and groups, and managing Webmin users. Additionally, you used it to set up Let’s Encrypt with both Nginx and Apache. For more on Webmin, check out the official documentation.

A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.

If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.

Leave a Reply