0% found this document useful (0 votes)
44 views4 pages

Moodle Installation

This document provides a step-by-step guide for installing Moodle on Ubuntu 24.04, including updating the system, installing necessary dependencies, downloading and configuring Moodle, setting up a MariaDB database, and configuring the Nginx web server. It also details how to create a Cloudflare tunnel for external access to the Moodle application. The final step confirms that the setup is complete and the application can be accessed via a browser.

Uploaded by

Parulian Sirait
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views4 pages

Moodle Installation

This document provides a step-by-step guide for installing Moodle on Ubuntu 24.04, including updating the system, installing necessary dependencies, downloading and configuring Moodle, setting up a MariaDB database, and configuring the Nginx web server. It also details how to create a Cloudflare tunnel for external access to the Moodle application. The final step confirms that the setup is complete and the application can be accessed via a browser.

Uploaded by

Parulian Sirait
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Moodle Installation

Ubuntu 24.04 - Noble Numbat

⚠ Before starting, please log in to the root user

Install Dependencies
Update repository and upgrade systems:

apt update;apt full-upgrade -y

Install this packages:

apt install nginx unzip mariadb-server php8.3-fpm php8.3-curl \


php8.3-gd php8.3-intl php8.3-mbstring php8.3-xml \
php8.3-zip php8.3-mysql php8.3-ldap php8.3-soap \
php8.3-xmlrpc

Download & Install Moodle


Download the latest moodle:

wget "https://packaging.moodle.org/stable500/moodle-latest-500.zip"

Extract zip:

unzip moodle-latest-500.zip

Move to /var/www/ :

mv moodle /var/www/

Change the moodle directory ownership and group to www-data :

chown -R www-data:www-data /var/www/moodle

Create the moodle data directory:

mkdir -p /var/lib/moodledata

Change the moodledata directory ownership and group to www-data :

chown -R www-data:www-data /var/lib/moodledata


Create Database
Execute this command for the first time install the mariadb package:

mysql_secure_installation

Just follow the instruction and setup mysql based on your preferences.

Execute mysql in root, and run the following SQL Syntax:

CREATE DATABASE moodle;


CREATE USER 'moodle'@'localhost' IDENTIFIED BY '123passwordKuat!';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodle'@'localhost';
FLUSH PRIVILEGES;

Setting Up Web Server


We are using nginx and php8.3-fpm . Follow this instruction!
Go to directory /etc/nginx/sites-enabled and delete the default configuration:

rm /etc/nginx/sites-enabled/default

Create new nginx configuration file.


cbt.conf

# Settingan khusus cloudflared tunnel


# By Keitaro Kurikuri for Master Lian Sirait

server {
listen 80 default;
server_name cbt-vm.liansirait.my.id;

root /var/www/moodle;
index index.php;

location / {
try_files $uri $uri/ =404;
}

# pass PHP scripts to FastCGI server


location ~ [^/]\.php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 300;
fastcgi_param HTTPS on;
fastcgi_param HTTP_X_FORWARDED_PROTO https;
}

location ~ /\.ht {
deny all;
}
}

Create Tunnel
To access our project to the internet, we need Cloudflare Zero Trust.
Download and Install the package:

wget -O cloudflared.deb
https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-
linux-amd64.deb
apt install ./cloudflared-linux-amd64.deb

Login to Cloudflare and allow this server:

cloudflared tunnel login

⚠ You will be given a json file containing the tunnel information

Create the new tunnel:

cloudflared tunnel create cbt-vm

Route tunnel to DNS:

cloudflared tunnel route dns cbt-vm cbt-vm.liansirait.my.id

Create cloudflared config directory:

mkdir -p /etc/cloudflared

Before the next step, please check the TunnelID in /root/.cloudflare/<tunnel>.json .


Create new configuration named config.yml :

tunnel: <tunnel>
credentials-file: /root/.cloudflared/<tunnel>.json

ingress:
- hostname: cbt-vm.liansirait.my.id
service: http://localhost:80
- service: http_status:404

Execute this command to set up the systemd service:

cloudflared service install

Enable and start the systemd service:


systemctl enable --now cloudflared

Check status:

systemctl status cloudflared

Done
Access your app on browser!

Documented by Kurikuri

You might also like