Setting up Moodle on Hetzner using Webmin/Virtualmin

Hetzner is a physical server provider as compared to cloud where you have virtual machine. if you are setting up a new machine on hetzner , you may walk through “Must do list for setting up hetzner server

Webmin & virtualmin

Webmin is a web-based interface for system administration on Unix-like systems. It allows you to manage your server’s services, users, and configurations through a user-friendly interface.

Virtualmin is an add-on for Webmin that provides a powerful and easy-to-use interface for managing virtual hosts, domains, and server configurations.

Alternatives for Webmin

There are many alternative available for webmin like VestaCP, hestiaCP, aapanel etc.

For virtualizaion, you may consider Proxmox

For me, webmin is good enough as it has all the needful things without cluttering. Easy , neat and clean dashboard

Moodle, you know that worl best open source LMS

Setting Up Webmin and Virtualmin

Add the Webmin repository

wget -qO - http://www.webmin.com/jcameron-key.asc | sudo apt-key add -
echo "deb http://download.webmin.com/download/repository sarge contrib" | sudo tee /etc/apt/sources.list.d/webmin.list

Install Webmin

sudo apt update
sudo apt install webmin

Access Webmin: Open your web browser and navigate to https://your_server_ip:10000.

— make sure 10000 port is open on Hetzner firewall or OS firewall

— loging using system credential. If you do not have password for operating system user, please create a new user and login through that.

Install Virtualmin

wget http://software.virtualmin.com/gpl/scripts/install.sh
sudo chmod +x install.sh
sudo ./install.sh

After install, virutalmin will be available on the UI

Setting Up Moodle

As webmin does not come with any other php envrionment , you need to setup this separately.
vestacp / hestia cp comes with php environment, but they are not supporting latest version of ubuntu

Install apache and php

apt update
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt update

sudo apt install apache2 mysql-client mariadb-server php8.2 php8.2-fpm
sudo apt install graphviz aspell ghostscript clamav php8.2-pspell php8.2-curl php8.2-gd php8.2-intl php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-ldap php8.2-zip php8.2-soap php8.2-mbstring

sudo apt install git
sudo apt install php-apcu
sudo a2enconf php8.2-fpm
sudo a2enmod proxy_fcgi

service apache2 restart

MySql Database and user and password : run under mysql prompt

CREATE DATABASE lms DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
create user 'lmsdbuser'@'localhost' IDENTIFIED BY 'lmsdbNHkjU';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON lms.* TO 'lmsdbuser'@'localhost';
flush privileges;

change in php.ini or create new local.ini under /etc/php/8.2/fpm/local.ini

post_max_size=128M
upload_max_size=128M
max_input_vars=5000

After setting up the env, I am assuming, you may have created one virtual host under virutalmin from webmin interface.

  • Creating virtualhost will create a new user and directory structure under /home directory
  • navigate to public_html folder and checkout the moodle latest code from https://github.com/moodle/moodle
  • create a dataroot directory out of public_html that will store mediafiles for moodle
  • permission for dataroot should be 777 to ease
  • access the virtualhost url and proceed with installaion of moodle

More Enhancement

  • You can setup SSL on virutal min and it will automatically renewed
  • setup cron job for moodle
  • set up domainname for webmin so that you access the interface from domainname rather than ip
  • Setup ready to install application

Leave a Reply

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