How to Install Virtualmin on Debian 12
Introduction
Virtualmin is an open-source flexible web hosting control panel designed for Linux and UNIX systems. It allows you to manage multiple domains, email accounts, databases, and applications using a single web-based interface. Virtualmin supports various web server, databases, and mail server applications to securely deliver services using virtual servers.
This article explains how to install and secure Virtualmin on a Debian 12 server.
Prerequisites
Before you begin:
- Deploy Debian 12 instance on Vultr.
- Create a domain name A record pointing to the server IP address. For example,
virtualmin.example.com
. - Access the server using SSH.
- Create a non-root account with sudo privileges and switch to the account.
Install Virtualmin
Virtualmin is not available in the default package repositories on Debian 12. Follow the steps below to download the latest installation script and install Virtualmin on your server.
Enter your domain as the new hostname on your server. Replace
virtualmin.example.com
with your actual domain.console$ sudo hostnamectl set-hostname virtualmin.example.com
View the active server hostname to verify your changes.
console$ sudo hostname -f
Output:
virtualmin.example.com
Download the latest Virtualmin installation script.
console$ wget http://software.virtualmin.com/gpl/scripts/install.sh
Enable execute permissions on the script.
console$ sudo chmod +x install.sh
Run the installation script and use the default LAMP package.
console$ sudo ./install.sh
Enter Y and press Enter when prompted to verify your package information to install Virtualmin.
[INFO] Log will be written to: /root/virtualmin-install.log Welcome to the Virtualmin GPL installer, version 7.4.0 ................ The selected package bundle is LAMP and the size of install is full. It will require up to 2 GB of disk space. Exit and re-run this script with --help flag to see available options. Continue? (y/n)
Wait between
5
to10
minutes for the Virtualmin installation process to complete on your server. Your output should look like the one below when successful.✔ [17/21] Configuring Upgrade ▒▒ ✔ [18/21] Configuring Usermin ▒▒ ✔ [19/21] Configuring Webmin ▒▒ ✔ [20/21] Configuring Fail2banFirewalld ▒▒ ✔ [21/21] Configuring Virtualmin ▒▒ ✔ ▣▣▣ Cleaning up [SUCCESS] Installation Complete! [SUCCESS] If there were no errors above, Virtualmin should be ready [SUCCESS] to configure at https://virtualmin.example.com:10000 (or https://139.84.239.226:10000).
Secure Virtualmin
Follow the steps below to generate trusted Let's Encrypt SSL certificates and secure all network connections to the Virtualmin web administration interface.
Stop the Apache service to ensure Certbot can bind to port
80
.console$ sudo systemctl stop apache2
Install the Certbot package Let's Encrypt client to manage your SSL certificates.
console$ sudo apt install certbot
Request a new SSL certificate using your domain. Replace
virtualmin.example.com
andvirtualmin@example.com
with your actual details.console$ sudo certbot certonly --standalone -d virtualmin.example.com -m virtualmin@example.com --agree-tos
Enter U and press the Enter when prompted key to update the default SSL key type to ECDSA and apply changes to the
/etc/webmin/miniserv.conf
configuration file.Saving debug log to /var/log/letsencrypt/letsencrypt.log An RSA certificate named virtualmin.example.com already exists. Do you want to update its key type to ECDSA? (U)pdate key type/(K)eep existing key type:
Your output should look like the one below when the SSL certificate request is successful.
Renewing an existing certificate for virtualmin.example.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/virtualmin.example.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/virtualmin.example.com/privkey.pem This certificate expires on 2024-10-15. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background. If you like Certbot, please consider supporting our work by: * Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate * Donating to EFF: https://eff.org/donate-le
Restart the Webmin service to apply your configuration changes.
console$ sudo systemctl restart webmin
Start the Apache service.
console$ sudo systemctl start apache2
Set Up Firewall Rules
Virtualmin uses the firewalld
utility to manage firewall processes on your server. Follow the steps below to allow all necessary Virtualmin ports and other services through the firewall.
View the
firewalld
service status and verify that it's running.console$ sudo systemctl status firewalld
Output:
● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/lib/systemd/system/firewalld.service; enabled; preset: enabled) Active: active (running) since Wed 2024-07-17 04:31:35 UTC; 35min ago Docs: man:firewalld(1) Main PID: 36516 (firewalld) Tasks: 2 (limit: 2299) Memory: 40.8M CPU: 4.132s CGroup: /system.slice/firewalld.service └─36516 /usr/bin/python3 /usr/sbin/firewalld --nofork --nopid
View all allowed ports in the firewall configuration.
console$ sudo firewall-cmd --zone=public --list-ports
Output:
20/tcp 2222/tcp 10000-10100/tcp 20000/tcp 49152-65535/tcp
View all allowed services.
console$ sudo firewall-cmd --zone=public --list-services
Output:
dhcpv6-client dns dns-over-tls ftp http https imap imaps mdns pop3 pop3s smtp smtp-submission smtps ssh
Access Virtualmin
Virtualmin runs on the default TCP port 10000
by default. Follow the steos below to access the Virtualmin web administration interface and create a new virtual server.
Access your domain on port
10000
to open the Virtualmin control panel interface.https://virtualmin.example.com:10000
Enter your sudo user account details to log in to the Virtualmin interface.
Click Next within the Post-Installation Wizard to set up any additional configurations on your server.
Find and click Dashboard on the left navigation bar to access the system performance page.
Conclusion
You have installed Virtualmin on your Debian 12 server and secured the web administration control panel with Let's Encrypt SSL certificates. You can use Virtualmin to manage your web hosting environment and create virtual servers to deliver web applications or services. For more information and configuration options, please visit the Virtualmin documentation.