logo smart home family kruse

Kruse Smart Home

Easy living in our smart home & Garden

Install Virtualmin on a Raspberry Pi

Install Virtualmin on a Raspberry Pi - Hosting multiple websites on a Raspberry Pi 4 with Virtualmin

8 March 2026

Jan-Willem

1. Introduction

When hosting multiple websites on a Raspberry Pi you need to setup so called virtual servers as the web server needs to forward used URL’s to the correct folder of the website. This can be done via manual configuration, but it handier to Install Virtualmin on a Raspberry Pi (a virtual hosting platform) as it is a web based interface preventing the use of Unix commands.

Virtualmin is a powerful and flexible web hosting control panel for Linux and BSD systems available as open-source version and a commercial version having more features.

This article describes how to install Virtualmin on a Raspberry Pi, which will also install Webmin. Installation and configuration instructions will be provided. Additional documentation can by found on the website of Virtualmin.

2. Requirements

For hosting multiple websites the following is required before we start to install Virtualmin on a Raspberry Pi:

  • Working Raspberry Pi with at least 1GB RAM and 1GB free disk space
    In our case a Raspberry Pi 5 model B with 8 Gb RAM and a 500 Gb Samsung sata SSD in a Geekworm NASPi 2.0 case as development/testserver and a Raspberry Pi 5 with 16Gb RAM and a 500Gb NVMe SSD as operational server.
  • Internet connection (with reasonable up- and download speeds (in our case we have 250 Mbp).
  • Access to your router to setup port forwarding
  • Preferably domain name for your server

3. Preparation

Before we install Virtualmin on a Raspberry Pi  we need to make sure:

  • Hostname is a proper Fully Qualified Domain Name (FQDN)

    Update the hosts file:

    Assure it has entry looking like:

    And check via:

    Prevent it gets overwritten after a reboot:

    Find ‘preserve_hostname: false’ and change into true. Reboot and test again the hostname of your server:

  • Assure system is up to date:

  • Remove conflicting packages as the Virtualmin installer wants a clean system:

  • Check swap file size as SpamAssassin + ClamAV can spike RAM usage. Even with 8 or 16 GB RAM, Virtualmin works best with 2-4 GB swap. Check current settings:

    If none or not 4GB:

    Add swapfile to fstab. Open the file for editing:

    and add:

    Save the file and close the editor. Reboot the system to check all goes fine:

  • the NVMe SSD(s) are configured; in our case 512Gb SSD as bootdrive and a 4TB SSD as datadrive. Also move the home folder to the second SSD.
    Note: skip this part if only one SSD!

    Create the proper mount point. As /home already exists, create a temporary mount point first:

    Mount the 2nd SSD:

    Copy existing /home data as even on fresh systems there may be default files. Use rsync to preserve permissions:

    Mount NVMe permanently as /home by adding it to fstab. Open the editor with fstab:

    Add (we use the UUID of the SSD as the safest option):

    note; the UUID can be found via:

    Check before reboot everything is fine:

    If sudo mount -a prints nothing and /home shows the expected contents, you’re good. Additional check:

    It should for show something like: nvme1n1p1   3.7T   /home

    Reboot the system:

    Check again with df -h.

    The old /home data files still exist under the root filesystem but hidden by the mount. You can later remove them safely by booting into rescue or by temporarily mounting root elsewhere — but on a fresh system this it is usually negligible.

    Final note:  Mounting a separate disk at /home is fine, but only if the second disk has the home directory and is mounted without issues. If not, users will appear to have “lost” their files / websites will fail.

  • DNS for the hostname points at the server; we use our hosting provider DNS server to point to our home public IP address. Assure the required tools are installed:

    Run the following commands and check your public IP address is linked to your domain name:

  • Tune the filesystem and some Linux kernel settings before installing Virtualmin. By doing so the server handles large numbers of small files and heavy PHP/WordPress traffic efficiently. On a 4 TB NVMe dedicated to /home, these tweaks improve metadata performance and reduce unnecessary writes.Increase filesystem watch limits (important for many sites) as hosting servers often hit Linux’s default file-watch limits. Create a sysctl config:

    Add:

    Save and close the editor. Apply via:

    Increase open file limits to prevent problems when many domains or logs are open simultaneously. Open limits.conf:

    Add:

    Save and close the editor.

  • Optional, but recommended; add better directory hashing, which dramatically improves performance when directories contain thousands of files (common in hosting).For NVME SSD
    Check by:

    You want to see ‘dir_index’. If it is missing use:

    For SATA SSD
    Be it only works on ext4 type partition, so not on the vfat type boot partition (sda1), but on the second psartition (sda2). Check by:

    You want to see ‘dir_index’. If it is missing use:

  • Optional; reduce number of reserved blocks on SSD. Default is 5% being reserved which for a 4TB SSD wastes about 200GB of space. This can be reduyced to 1% which frees up 160-180GB:
    For NVME SSD

    For SATA SSD

  • Disable unnecessary services. Check enabled services via:

    Things safe to disable for servers if present:
    – bluetooth
    – avahi-daemon
    – triggerhappy
    – ModemManager
    Stop the services:

    To disable these:

    Check with:

  • Install minimal required utilities:

  • Make sure ports 80, 443, and 10000 are pointing to your server. These ports need to be forwarded to your server. Virtualmin notes it may automatically request a real cert for the hostname during install if resolution and ports are correct. Optional:
    – 25   → mail
    – 587 → mail submission
    – 993 → IMAP

  • Reboot the server

4. Installation

Follow the next steps to install Virtualmin on a Raspberry Pi (based on the Automated Virtualmin Installation):

  1. Via Raspberry Pi connect open a remote shell (terminal).
  2. Download and start the installation script:

    The installation script will display info and ask if ok to continue. Confirm.
  3. The installer will first perform some checks and then start the installation.

    Wait till installation has finished. This can take a while. The progress will be show and if finished it will indicate how the installation went. In our case the firewalld / fail2ban has not been installed, but that won’t be an issue as we will install a firewall later.
  4. You can now login into Virtualmin via https://server.example.com:10000. Or via the servers internal network IP address like https://192.168.1.22:10000.
  5. Log in as the Raspberry Pi default/root user, or any user with sudo ALL access.

5. Initial configuration via the Post-installation Wizard

When logged in into Virtualmin the Post-Installation wizard will be shown in Virtualmin.

Click on the next button to start answering a series of setup questions.

  1. Mail performance: slower mail processing as we will not use the RPi as mailserve
  2. Enable virus scanning for receiving emails; disable as we will not setup receive large amounts of mail, we will mainly sent notifications out.
  3. Spam filtering (if shown):  set to no.
  4. Database servers; leave at default.
  5. MariaDB password; keep or change the default password. At least make sure you remember!

  6. DNS Configuration; we won’t use the internal DNS server, but the one from the hosting provider.
  7. Set email address for notifications from Webmin/Virtualmin:
  8. All done.

    Click on Finish.
  9. Click on “Re-check and refresh configuration”.
  10. A status overview will displayed.
    If no warnings/errors are displayed the configuration is finished.
  11. Reboot the system and check everything is working fine.
  12. Disable DNS feature globally in Virtualmin for new servers:

    And for existing ones use:

Now the install is finished you will see that the Virtualmin dashboard contains a Webmin tab and a Virtualmin tab in the left-hand menu. We can switch between the Webmin menu and Virtualmin menu. What is the difference?

  • Webmin provides general purpose systems management features, such as user/group management, listing processes, managing installed packages, network settings, and firewall settings.
  • Virtualmin provides access to domain accounts management functionality, including creating new domain accounts, new databases associated with those accounts, and installing applications.

6. Install latest PHP version

The default installed PHP version during our installation of Virtualmin was PHP version 8.4.16. The recommended version currently is version 8.4. Virtualmin makes it possible to install multiple PHP versions and allows you to choose execution mode and PHP version used for a given virtual web server. We focus on v8.4 with execution mode php-fpm.

  1. Install the latest version and common extensions:
  2. Restart PHP and apache server
  3. Configure Virtualmin to use PHP-FPM as default execution mode. Go to System Settings > Server Templates and edit each of the templates PHP Options (see section dropdown for eacht template).  Assure the indicated setttings are made:

7. Finally

This concludes this article “Install Virtualmin on a Raspberry Pi”.

 

Article by <a href="https://smarthome.familykruse.eu/author/iamjwk/" target="_self">Jan-Willem</a>

Article by Jan-Willem

Position

Writen by the website owner

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *