Tutorial: How to Install Moodle on Ubuntu 14.04

Tweet about this on TwitterShare on Google+Share on FacebookShare on LinkedInShare on StumbleUponShare on RedditEmail this to someonePrint this page

Moodle is an open source online learning management system. It is flexible and offers many teaching and training tools through its large plugin directory and compatibility with other web applications such as Google Apps and SCORM. Learn how to setup Moodle 2.9 on an Ubuntu 14.04 desktop.

Prerequisites

The following tutorial assumes that a computer with Ubuntu 14.04 installed. Another optional component is assigning a web address.

Video Tutorial

Install Apache Web Server

  1. Open Terminal and install tasksel with the following command:
    sudo apt-get install tasksel

    08-installTasksel

  2. Once tasksel is installed, run tasksel
    sudo tasksel

    tasksel will display a menu. Use the arrow keys to navigate to “LAMP server”, hit the “spacebar” key to select the option and the “Enter” key to confirm the installation.
    09-selectLAMPDuring the install, the installer will prompt for a password for mySQL.
    10-mySQLpw

Install Moodle

Download the Moodle Files

  1. Open and web browser and navigate to Moodle (moodle.org) and click on the “Dowload” link in the menu. 01-download
  2. Then click on the “Moodle 2.9+” button.02-downloadButton
  3. Scroll down and click on the “Download zip” button.03-downloadZip
  4. In the popup, choose the “Open with” option to open the zip file in Archive Manager and then click the “OK” button. 04-openArchiveManager
  5. When the Archive Manager opens, click on the “moodle” folder (A) and click on the “Extract” button in the menu (B). Select “home” as the download location (C) and click the “Extract” button (D).
    05-extract06-extractToHome

Install Moodle files onto the Web Server

These instructions follow the instructions found on the Moodle website when “How to install Moodle” link is clicked after downloading the moodle zip file.07-howToInstallMoodle

  1. In Terminal, move the moodle folder to the web server.
    sudo mv moodle /var/www/html/
  2. Change owner permissions of the moodle folder to root. Note that we need to change the file path to the correct path in our webserver.
    sudo chown -R root /var/www/moodle
    sudo chmod -R 0755 /var/www/moodle
    sudo find /var/www/moodle -type f -exec chmod 0644 {} \;

    14-permissionCom

Create a mySQL Database

In the installation instructions, there is a link that opens another page with the mySQL instructions.
15-mySQLInst

  1. Copy the login command from the webpage (or below) (A) and paste it into Terminal (B). Use the password created in the LAMP web server setup to login.
    mysql -u root -p

    16-mySQLlogin

  2. Create the database by copying the command below or from the moodle website (C) and pasting it into Terminal (D). NOTE: the lower case “moodle” is the name of the database. If you are concerned about security, change this database to a new name.
    CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

    17-createDB

  3. Copy the next command below or on the moodle website (E) and paste it into Termainal (F). change the default user “moodeuser” and password “yourpassword” to new values for increased security. Also, if you changed the database name in the previous step, change it here.
    GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO [email protected] IDENTIFIED BY 'yourpassword';

    18-assignPermissions

  4. Quit the mySQL shell by typing in the command below.
    exit

Create the Moodle Data Directory

The Moodle data directory is where Moodle will store its files. For increased security, Moodle strongly recommends to have this folder outside the web server.

  1. Create the Moodle Data directory
    sudo mkdir /var/moodledata
  2. Change permissions of the directory to be accessible by the webserver.
    sudo chmod 0777 -R /var/moodledata

    20-moodleData

Complete Moodle Installation in Web Browser

  1. Open a web browser and navigate to your server. Append “/moodle” onto the end of your server address (i.e. technerdservices.ddns.net/moodle).
  2. Select the appropriate language and click the “Next” button. 21-webInstall
  3. Fill in the appropriate directory paths. Change the moodle data directory to “/var/moodledata”22-systemPaths
  4. The next page prompts for the database type. Use the default “MySQL” and click the “Next” button.
    23-chooseDB
  5. Enter the appropriate database information created in the Create Database section. The other fields can remain their defaults. 24-mySQLinfo
  6. The next page will display a write error because of the high security of this setup. Highlight all the text within the textbox (A) and copy the highlighted text (B).
    25-selectConfigPHP
  7. In Terminal, create the Moodle configuration file.
    sudo nano /var/www/html/moodle/config.php
  8. Paste the copied text into the file.
    27-pasteConfig
  9. Save the file using “CTRL + O” and exit the editor with “CTRL + X”
  10. In the web browser,click the “Next” button below the text box.
    29-next
  11. If you receive this error 30-reLoadApache
    go back to Terminal and restart the webserver with the following command.

    sudo service apache2 restart
  12. Click on the “Continue” button at the bottom of the page.
    31-hitContinue
  13. Moodle will perform a server check to ensure that all required dependencies are installed. All should have a green “OK” on the right column. There may be a yellow “CHECK” for slasharguments. This can be added to the webserver, but is not mandatory in this version (but will be in Version 3). Click the “Continue” button at the bottom of the page.
    32-confirmDependencies
  14. The next page will create all the entries in the database. It may take a while, but when complete, the page will automatically school to the bottom. Click the “Continue” button.
    34-continueInstall
  15. Setup the first user. This will be the administor of Moodle. Click the “Update profile” when complete.
    35-createFirstUser1
  16. Setup of Moodle site name and description. Click the “Save Changes” when complete.
    36-pageSettings

Congratulations! Moodle is now setup.

37-dashboard

Additional Setup

While Moodle is now fully installed, there are several components that will not function properly without some additional settings.

Setup Email settings

Email settings are needed to send reminders, messages and password reset instructions. The email settings are found in “Site Administration” (A), under “Plugins” (B), then “Message Outputs” (C) and then “Email” (D).
45-Email

Setup Cron

Cron is used to initiate background processes in Moodle. Without it properly setup, Moodle will not function properly.

  1. In Terminal, open the cron settings for the webserver user.
    sudo crontab -u www-data -e
  2. Terminal may prompt for a text editor, hit the “Enter” key on the keyboard to select the default, which is nano.
  3. Scroll to the bottom of the file and enter the command required for background processes to run every 15 minutes.
    */15 * * * *        /usr/bin/php /path/to/moodle/admin/cli/cron.php
  4. Use “CTRL + O” to save the file and “CTRL + X” to exit.

Add System Paths for additional Packages

  1. In Moodle, click on “Site Administration” (A), then click on “Server” (B) and click on “System Paths” (C).
  2. Copy and paste the default system paths for du (D), aspell (E), and dot (F). The click on the “Save Changes” button (G).39-addPaths

Setup ClamAV AntiVirus

Since very little virus programs function in Linux, ClamAV scans uploaded files for potential viruses that can affect Windows PCs.

  1. In Terminal, create a folder for quarantined files.
    sudo mkdir /var/quarantine
  2. Grant ownship of the folder to the webserver.
    sudo chown -R www-data /var/quarantine
  3. In Moodle, Click on “Site Administration” (A), then “Security” (B), and then “Anti-Virus” (C).
  4. Check “Use clam AV on uploaded files (D).
  5. Type in the system path for clam AV in “clam AV path” (E).
  6. Type in the directory created for quarantined files (F).44-addSettings

Final Words

Moodle can provide profession training and teaching tools to streamline training new employees or students and keeping them up to date. Addition plugins can add functionality and site and course backups keeps all the information safe. It is easily accessible on any mobile device or desktop computer. All these benefits makes Moodle an effective learning management system.

Tweet about this on TwitterShare on Google+Share on FacebookShare on LinkedInShare on StumbleUponShare on RedditEmail this to someonePrint this page

Support Us!

Thank you for reading this article. If you found it useful, please consider buying us a coffee, subscribing to the YouTube Channel, and/or changing your Amazon bookmark to our affiliate link (CAN, USA, UK). We do this out of general interests and to help others. Thanks!




  • Gat

    Hi, I have just finished installing Moodle on Ubuntu 14.04 server but clients cannot access the server on the network. Is there any settings to that?

    • Mike Zhang

      Make sure that they are using the same web address that you used while setting up Moodle. I.E, if you use an IP address during setup, then others will need to use the IP address, etc. You can change the site address in Moodles Sites Administration. Good Luck