How to Install Moodle on Ubuntu 18.04

Moodle is a web-based open source software for e-learning or creating online learning classes. Moodle is widely applied in schools and colleges including in Indonesia.

The Moodle project is led by Moodle HQ which is financially supported by more than 80 Moodle partner companies.

Moodle features include:

· Modern, easy to use interface · Personalised Dashboard · Collaborative tools and activities · All-in-one calendar · Convenient file management · Simple and intuitive text editor

For a complete list of Moodle features, read here.

*0.Software used*

The software used in this tutorial is:

· OS: Ubuntu 18.04 · Web server: Apache 2.4 · PHP Engine: PHP v7.2 · Database: MariaDB 10.1 · Moodle: Moodle v3.8 · Subomain: moodle.defnex.com · SSL: Let’s Encrypt

*1.Install Apache*

Update Ubuntu first

[INPUT]

1 2 apt update apt upgrade -y

Install Apache web server

[INPUT]

1 2 apt install apache2 -y systemctl status apache2    

*2.Install PHP*

Install PHP

[INPUT]

1 apt install php php-common php-pspell php-curl php-gd php-intl php-mysql php-xml php-xmlrpc php-ldap php-zip php-soap php-mbstring libapache2-mod-php -y

*3.Install MariaDB*

Install MariaDB database

[INPUT]

1 2 3 apt install mariadb-server -y systemctl status mariadb mysql_secure_installation

Answer the question

[INPUT]

1 2 3 4 5 Set root password? [Y/n] y Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y    

Configure MariaDB

[INPUT]

1 vim /etc/mysql/mariadb.conf.d/50-server.cnf

Add the configuration under [mysqld] [INPUT]

1 2 3 4 default_storage_engine = innodb innodb_file_per_table = 1 innodb_file_format = Barracuda innodb_large_prefix = 1

MariaDB configuration

Restart MariaDB

[INPUT]

1 2 systemctl restart mariadb systemctl status mariadb    

Create a database for Moodle

[INPUT]

1 2 3 4 5 6 7 mysql -u root -p   CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;     CREATE USER ‘usrmoodle’@’localhost’ IDENTIFIED BY ‘secret’; GRANT ALL PRIVILEGES ON moodle.* TO ‘usrmoodle’@’localhost’; FLUSH PRIVILEGES; exit

Create database

*4.Download Moodle*

Download Moodle v3.8

[INPUT]

1 2 wget https://download.moodle.org/download.php/direct/stable38/moodle-latest-38.tgz tar xzvf moodle-latest-38.tgz

Create a folder for Moodle

[INPUT]

1 2 3 4 mkdir -p /var/www/moodle/data mv moodle /var/www/moodle/web chown -R www-data:www-data /var/www/moodle chmod -R 755 /var/www/moodle    

Configure the virtual host for moodle.defnex.com

[INPUT]

1 2 cd /etc/apache2/sites-available/ vim moodle.defnex.com.conf

Enter the virtual host configuration

[INPUT]

1 2 3 4 5 6 7 8 9 10 11     ServerName moodle.defnex.com     DocumentRoot /var/www/moodle/web              Options Indexes FollowSymLinks MultiViews         AllowOverride All         Require all granted          ErrorLog /var/log/apache2/moodle.defnex.com_error.log     CustomLog /var/log/apache2/moodle.defnex.com_requests.log combined   

Activate virtual host and restart Apache

[INPUT]

1 2 3 a2ensite moodle.defnex.com.conf systemctl restart apache2   systemctl status apache2    

*5.Install SSL Let’s Encrypt*

Download certbot-auto

[INPUT]

1 2 3 4 cd curl -O https://dl.eff.org/certbot-auto mv certbot-auto /usr/local/bin/certbot-auto chmod 0755 /usr/local/bin/certbot-auto

SSL request for the moodle.defnex.com subdomain

[INPUT]

1 certbot-auto –apache -d moodle.defnex.com

Install packages, Do you want to continue? [Y/n], answer y

[INPUT]

1 2 3 Need to get 66.4 MB of archives. After this operation, 194 MB of additional disk space will be used. Do you want to continue? [Y/n] y    

Enter email address

[INPUT]

1 Enter email address (used for urgent renewal and security notices) (Enter ‘c’ to cancel): hai@musaamin.web.id          

Agree Terms of Service

[INPUT]

1 2 3 Please read the Terms of Service at https://letsencrypt.org/documents/ LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory – – – – – – – – – – – – – – – – – – – – – – – – – – – (A)gree/(C)ancel: A

Consent to be sent information about Let”€™s Encrypt, you can answer Y or N.

[INPUT]

1 2 3 Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let’s Encrypt project and the non-profit organization that develops Certbot? We’d like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. – – – – – – – – – – – – – – – – – – – – – – – – – – – (Y)es/(N)o: N

An SSL certificate was created, changed and added a virtual host configuration for SSL.

[INPUT]

1 2 3 Obtaining a new certificate Performing the following challenges: http-01 challenge for moodle.defnex.com

Then enter 2 to redirect HTTP to HTTPS.

[INPUT]

1 2 3 4 5 6 Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – 1: No redirect – Make no further changes to the webserver configuration. 2: Redirect – Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you’re confident your site works on HTTPS. You can undo this change by editing your web server’s configuration. – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel): 2  

The SSL install for moodle.defnex.com is complete

[INPUT]

1 Congratulations! You have successfully enabled https://moodle.defnex.com    

The SSL certificate is only valid for 90 days, run the renew command to renew the SSL certificate

[INPUT]

1 cerbot-auto renew  

*6.Install Moodle*

Browse http://moodle.defnex.com

Choose a language, Next

Choose a language

Fill Data directory with /var/www/moodle/data

Confirm paths

Database driver, for Type choose MariaDB (native/mariadb)

Choose database driver

Enter the database name, database user, and database password

Database settings

Confirm the license, Continue

Confirm license

Check the server if the server is ready to install Moodle

Server checks

Installation is running

Installation

Create an administrator account

Administrator account

Enter Full site name, Short name for site and Front page summary

Front page settings

If successful, go directly to the administrator dashboard

Moodle dashboard

Good luck 🙂

Leave a Reply

Your email address will not be published.