Tata Cara
Installing Moodle 4.5 via GitHub is a great choice—it makes future updates as simple as a git pull. Since you're on Debian 12 with a standard LAMP stack, here is the streamlined path to get it running.
1. Install System Dependencies
Moodle 4.5 requires several PHP extensions that aren't always installed by default.
apt update
apt install apache2 mariadb-server git php8.2 libapache2-mod-php8.2 \
php8.2-iconv php8.2-mbstring php8.2-curl php8.2-tokenizer php8.2-xmlrpc \
php8.2-soap php8.2-ctype php8.2-zip php8.2-gd php8.2-intl php8.2-xml \
php8.2-bcmath php8.2-sodium php8.2-mysql -y
2. Configure MariaDB
Log into your MariaDB Database with root user without password. Moodle requires specific settings for UTF-8 support. Create additional user other than root in MariaDB Database to access in local server ("localhost").
mysql -u root
Run the following queries (replace "your_user_name" and "your_strong_password" with your own):
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'your_user_name'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON moodle.* TO 'admin'@'localhost';
FLUSH PRIVILEGES;
Also create additional user in MariaDB Database as above but with IP address of the Web Server (not "localhost"). This is to gain access to the database when it hosted in different Server. Change the words "Your_Web_Server_IP" with your own web IP.
CREATE USER 'admin'@'Your_Web_Server_IP' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON moodle.* TO 'admin'@'Your_Web_Server_IP';
FLUSH PRIVILEGES;
EXIT;
3. Clone Moodle from GitHub
We will clone the repository directly into your web directory and switch to the stable 4.5 branch.
cd /var/www/html
git clone https://github.com/moodle/moodle.git
cd moodle
# List branches to confirm, then checkout 4.5
git checkout -b MOODLE_45_STABLE origin/MOODLE_45_STABLE
4. Create the Data Directory
Moodle needs a directory outside the web root to store files.
mkdir /var/www/moodledata
chown -R www-data:www-data /var/www/moodledata
chmod -R 770 /var/www/moodledata
Also, ensure the web server can temporarily write to the moodle code folder for the installer:
chown -R www-data:www-data /var/www/html/moodle
5. Configure PHP Settings
Moodle requires a high max_input_vars value. Edit your php.ini file:
nano /etc/php/8.2/apache2/php.ini
Find and update these values (remove the ; if they are commented out):
max_input_vars = 5000
memory_limit = 256M
post_max_size = 64M
upload_max_filesize = 64M
Save and exit, then restart Apache:
systemctl restart apache2
6. Run the Web Installer
Now, navigate to http://your-server-ip/moodle in your browser. Make sure the following is as follows
Web Address: http://localhost/moodle (or your IP)
Moodle Directory: /var/www/html/moodle
Data Directory: /var/www/moodledata
Database Type: Improved MariaDB (mariadb)
Database Settings: Use the credentials created in Step 2.
Note: Once the installation is finished, for security, you should change the permissions of the code directory so the web server can no longer write to it:
chown -R root:root /var/www/html/moodle
Check the result of your moodle in browser, matur nuwun.