Note: These instructions are deprecated and are not the structure used with current versions of Ubuntu. They are not consistent with the current Ubuntu/Debian Moodle packages. Please refer to the Moodle site here for current installation instructions for Ubuntu.
This document describes how to install "Moodle", the Open Source Content Management System on Ubuntu Linux so that it uses MySQL. The default install uses PostgreSQL.
This has only been tested on Edgy Eft (Ubuntu 6.10) and Gutsy Gibbon (Ubuntu 7.10). It should work on Dapper Drake and the Freddie Fawn or whatever it was if you do this please amend this page appropriately. The installation was tested with Moodle v1.6.3 (Edgy) and Moodle v1.8.4 (Gutsy)
The Moodle Install may change at a later date, but works fine as far as 1.8.4
To start with, open a terminal (Applications/Accessories/Terminal). Commands will be typed in here unless otherwise specified.
Alternative to manual installation
Some users may prefer to skip manual installation by using the unofficial pre-integrated TurnKey Moodle Appliance based on Ubuntu LTS.
Installing the LAMP Stack
To start with, you need to install LAMP - Linux, Apache, MySQL and PHP Version 5.
This is covered in this Wiki Article Apache PHP MySQL
It may be worth doing the "php test" in that article as I had some minor problems getting PHP to work. The suggestions in the LAMP article fixed it, however.
Install the package PHP5-GD which is required by Moodle.
sudo apt-get install php5-gd
Newer versions of Moodle recommend the installation of this utility - it is not mandatory.
sudo apt-get install php5-curl
Restart the Apache Web Server so these changes become part of the system
sudo /etc/init.d/apache2 restart
Download and unpack Moodle
Start up a new Firefox Window (Ctrl+N) and navigate to http://download.moodle.org. Left click on the 'Latest Release' '.tgz format' entry. This should download the Moodle program onto your computer. This normally will be saved to the desktop - it says where it is saved to on the Download dialogue.
Now change to the web space folder on your computer and unpack moodle into it.
cd /var/www sudo tar xvf /home/paulr/Desktop/moodle-1.6.3.tgz
You will have to tailor this command appropriately ; this would work if the file is saved on the desktop of the user 'paulr' and it is moodle 1.6.3.
Next, we have to change the permissions of the moodle folder so it can be written to. This is required for a later step in the installation, where a configuration file is written to the moodle directory.
sudo chmod 777 /var/www/moodle
Set up Moodle's Data Directory
We now create a directory for Moodle data, and set it's permissions so it can be written to by moodle.
sudo mkdir /var/moodledata sudo chmod 777 /var/moodledata
Now Moodle is ready to go, but we need to run through the program's own installer. Start up a firefox window and type the URL http://localhost/moodle into the address bar. This should bring up the first page of the moodle installer.
Select the language you want. The default is English, and click on "next"
Checking PHP settings
A page of tests are conducted on PHP. All should say "OK" in Green. The only one that isn't by default is "GD Version" - if this has failed reinstall php5-gd and restart apache (see above). If they all say "ok" click on next.
The next page sets the locations of the moodle installation. These should be http://localhost/moodle /var/www/moodle and /var/moodledata (the last one is the directory you created above).
Click on next. If this fails, check you set up the /var/moodledata directory as above.
Database configuration (MySQL)
The first part involves setting up MySQL to work with Moodle.
If you have not already set a master password for MySQL type the following, replacing pwd with the password you want to use for MySQL.
mysqladmin -u root password pwd
Then start up the MySQL Client application by typing
mysql -u root -p
the program will respond password: and you can type in the master password. This should now display the MySQL prompt.
Create the database for use by Moodle
create database moodle;
Make it readable to the moodle user
grant all privileges on moodle.* to paulr@localhost identified by "paulrpwd";
This sets the moodle database to be useable by the MySQL user paulr with the password paulrpwd. You may change these to any values you like. The quotes around the end are required.
Database Configuration (Moodle)
Enter the appropriate values on the Moodle Database Configuration page. These are (in v1.6.3)
- Type : MySQL
- Host Server : localhost
- Database : moodle
- User : paulr
- Password : paulrpwd
- Tables Prefix : mdl_
You should only need to enter the user and the password - which should be the values you set in the previous section.
Then Click on the Next button. If this fails, go back and check the database setup steps.
The next page is some environment checks ; all four should read 'OK'. Click on 'Next'.
Download Language Pack
The program will offer you the chance to download a language pack. Click on 'next'.
The program now writes a config file to your system. If this step fails, try doing the sudo chmod 777 /var/www/moodle command again, as above. Click on 'Next'
Terms and Conditions
Now is your chance to read the T & C, which we all always do, of course. To continue, click on the 'Yes' button.
Setting up Database
Moodle now sets up its database. This should produces pages of SQL commands followed by 'Success' in your browser. Go to the bottom, and hit the continue button.
You can now read the release notes, or hit the Continue button to start.
Setting up Moodle : Variables
You have now successfully installed Moodle. The configuration pages that follow can be changed at any time to suit.
For the moment, go the bottom of the page and click on "Save Changes", then click on "Continue"
Setting up Moodle : More SQL
There now follows half a dozen pages of SQL. Scroll to the bottom and press continue on each, and eventually you will reach the Site Settings page
Type in a site name, a short name, and a description (you can easily change it later). Go to the bottom and click on 'Save Changes'
On the administrator account page, enter your new password for the administrator, then click on 'update profile' at the bottom. This will throw up some errors - correct them so you can carry on, or if you like fill this page in properly. As with everything else, you can change it any time you like.
Click on Continue
Welcome to Moodle
Congratulations ! You now have an up and running Moodle server.