Subscribe to RSS  |  Advertise on this Blog

  • HOME
  • ABOUT
    • RESUME
Alberto Matus
  • SERVICES
  • CONTACT
  • HOME
  • ABOUT
    • RESUME
  • SERVICES
  • CONTACT
June 4, 2019  |  By ajMatus In Linux Tips, Open Source, Technology, Ubuntu

Installing Moodle on Ubuntu 18.04 LTS

This post assumes you already have apache, mysql, php, and phpmyadmin installed. If not then you can read this post here to do the installation which is a pre-requisiste if you want moodle installed properly.

Nevertheless, this post will touch on a few areas on the above where certain configurations are needed. However, overall it looks at the moodle open source content management system which is written and based on php. It allows educational institutions to create a very powerpul system for courses, students, and teachers. It’s used all across the world by many universities, and most importantly it’s free and released to the general public.

Step 1 – Minor Apache Configuration

In the previous post we left our html directory open to the general public. Hence, if someone new our IP address or landed on it and tried browsing what’s in our html directory they. So, we want to disable the directly listing for security purposes using the following command:



sudo sed -i “s/Options Indexes FollowSymLinks/Options FollowSymLinks/” /etc/apache2/apache2.conf

Next, run the commands below to stop, start and enable Apache2 service to always start up with the server boots.



sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

Step 2 – Install PhP Related Module & Configure

In the previous post we installed PhP, however moodle needs certain modules that are required in order for it to function properly. We install them using the following command:



sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl

After install PHP, run the commands below to open PHP-FPM default file.



sudo nano /etc/php/7.1/apache2/php.ini

Then change the following lines below in the file and save (it’s a very long file, so you might want to search for the keywords and look for those in particular). You may increase the value to suite your environment.



file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
cgi.fix_pathinfo = 0
date.timezone = America/Belize

Step 3 – Create Moodle database

Now that you’ve installed all the packages that are required, you are ready to start dealing with moodle. First run the commands below to create a blank Moodle database.

Run the commands below to logon to MySql database server:



sudo mysql -u root -p

Next, create a database, in this instance we’ll call it moodle but you can use anyname you prefer.



CREATE DATABASE moodle;

We will now create a database user. Here we are calling our user moodle user, with a new password. The new_password_here is where you put a password you like.



CREATE USER ‘moodleuser’@’localhost’ IDENTIFIED BY ‘new_password_here’;

Your user needs full access to the database created and so we’ll grant full access.



GRANT ALL ON moodle.* TO ‘moodleuser’@’localhost’ IDENTIFIED BY ‘user_password_here’ WITH GRANT OPTION;

Now save your changes, and exit.



FLUSH PRIVILEGES;
EXIT;

Step 4: Download Moodle & Create Directories

At the time of this post moodle 3.7 was the latest version, I would suggest going to the moodle.org website and check what’s the latest and change the link from the command below. Here we’re downloading moodle in the temp folder, extracting it and moving to the html directory. We’re also ensuring the permissions are properly set. Moreover, please note for security purposes the moodledata folder should never be placed in your html folder.



cd /tmp/ && wget https://download.moodle.org/download.php/stable37/moodle-3.7.tgz

tar -zxvf moodle-latest-33.tgz
sudo mv moodle /var/www/html/moodle
sudo mkdir /var/moodledata

sudo chown -R www-data:www-data /var/www/html/moodle/
sudo chmod -R 755 /var/www/html/moodle/
sudo chown www-data /var/moodledata/
sudo chmod -R 755 /var/moodledata/

Step 5: Configure Apache2

Finally, configure Apahce2 site configuration file for Moodle. This file will control how users access Moodle content. Run the commands below to create a new configuration file called moodle.conf



sudo nano /etc/apache2/sites-available/moodle.conf

Now copy and paste the content below into the file and save it. Replace the domain example.com with the domain you are gonig to be using.



VirtualHost *:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/moodle/
     ServerName example.com
     ServerAlias www.example.com
 
     <Directory /var/www/html/moodle/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

After configuring the VirtualHost above, enable it by running the commands below, and then restarting apache as follows:



sudo a2enmod rewrite
sudo a2ensite moodle.conf
sudo systemctl restart apache2.service

Step 6: Finishing the Installation

Finally, we’re ready to start the moodle installation process. Go to your domain that you set in your virtual host in the step above, for instance in ours it was example.com. You should be prompted with the first screenshot below. The screenshots below consist of certain steps that are to be taken. Screenshot 2 should have had the example.com on the web address, and the moodle directory should have been var/www/html/moodle , it just shows different since another different route was taken here. If you feel the installation is taking long, please wait! Depending on your connection it may take a while.


alberto matus moodle 1

alberto matus moodle 2

alberto matus moodle 3

alberto matus moodle 4

alberto matus moodle 5

alberto matus moodle 6

alberto matus moodle 7

alberto matus moodle 8

alberto matus moodle 9

That’s it! Hope you have fun using moodle – sharing is caring!

apache2 moodle phpmyadmin ubuntu

Article by ajMatus

Related Articles

  • Ubuntu-20-04-LTS-new-features-Stackscale-blog
    Changing Login Display In Ubuntu 20.04
  • 22-108-682-V01
    Recovering Data from Synology Crashed Deivce

Leave your comment Cancel Reply

(will not be shared)

WELCOME

Hello, and welcome! I'm Alberto - a Cyber Security & Digital Forensics professional specializing in Digital forensics, Incident Response & Vulnerability Assessment. I hold a Master's degree in Cybersecurity with a concentration in Digital Forensics from the University of South Florida and a Bachelor degree in Information Technology from the University of Belize. Through this blog I hope to share tips, information about cybersecurity, cybercrime, digital forensics, open source technologies, business, and a bit of my amazing country. For those interested in any of my services please feel free to contact me using any of the associated contact details on this blog.

SEARCH

ARCHIVE

  • October 2022 (1)
  • July 2021 (2)
  • November 2020 (2)
  • October 2020 (1)
  • September 2020 (2)
  • August 2020 (2)
  • July 2020 (6)
  • June 2020 (6)
  • April 2020 (5)
  • February 2020 (1)
  • November 2019 (2)
  • October 2019 (1)
  • September 2019 (1)
  • June 2019 (1)
  • May 2019 (1)
  • November 2018 (6)
  • September 2018 (3)
  • August 2018 (4)
  • February 2018 (1)
  • January 2018 (3)
  • December 2017 (1)
  • October 2017 (5)
  • September 2017 (1)
  • December 2016 (2)
  • November 2016 (4)
  • October 2016 (1)
  • September 2016 (2)
  • August 2016 (5)
  • July 2016 (2)
  • June 2016 (2)

CALENDAR

March 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Oct    

RECENT POSTS

  • Capture
    WordPress Empty template: Index Friday, 7, Oct
  • Belize – Benque Viejo to San Ignacio Town Drive Tuesday, 6, Jul
  • alberto-matus-digital-piracy
    An Overview of Digital Piracy Thursday, 1, Jul

REMOTE WORK

Remote work is my preferred way or working as I have a home office set up where all the magic happens. This method allows me to work with businesses, organizations, and all brands across the globe. I can manage projects via my own management applications or your own internal project management app. Any calls and meetings can be done through whatever tools fits your business, and I’m flexible to work on your time zone.

ON-SITE

Not every job assignment can be done via remote working methods, and so if it requires me to be on-site for the duration of the work then this can be done based on agreements or contractual work. I prefer doing these types of consultancies or hands-on types of work on the weekends but I am flexible enough depending on the terms. I am also open to traveling outside of Belize. All further afield work requires accommodation and travel expenses.

RETAINER

Sometimes clients are looking for long term partners that share a closer connection to their visions and goals. As such I am open to retainers. A retainer hires me for a certain amount of hours per month at a discounted rate. These discounted rates are usually between 10%-20% off depending on the contractual agreements.

Alberto - open source | technology | belize -Matus

Copyright ©2020. All Rights Reserved

en_USEnglish
en_USEnglish