Moodle Install

Last updated 2015
Basic Requirements - Raspberry Pi (with Ubuntu notes)
-You will need a working web server (e.g. Apache), a database (e.g. MySQL) and have PHP configured.
-Sudo apt-get apache2
-Sudo apt-get php5 php5-mysql php5-curl php5-gd
-Sudo apt-get mysql (this will prompt you for password - write it down)
-Moodle requires a number of PHP extensions (above).
-If you want Moodle to send email (you probably do) you need a working Sendmail (Unix/Linux) on your server or access to an SMTP mail server.

Getting Moodle

cd /var/www

git clone -b MOODLE_28_STABLE git://git.moodle.org/moodle.git (need to install git for Ubuntu server)

...this fetches a complete copy of the Moodle repository and then switches to the 2.8 Stable branch.
Note: You will run the install from here then move all the files to /var/www (cmd = sudo cp -R moodle/* /var/wwww)

Create a database

Bash command: mysql --user="root" --password="" --execute=""
-Using your chosen database server, create a new empty database. The default encoding must be UTF8. For example, using MySQL:

CREATE DATABASE moodle DEFAULT CHARACTER SET UTF8 COLLATE utf8_unicode_ci;
-Create a user/password combination with appropriate permissions for the database. For example (MySQL again):

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'yourpassword'; (sql password)


Create data directory
-Does during install

Configure Moodle
-Does doing install (note - file is config.php, can use this to verify setup config)

Install Moodle
-Go to the URL for your moodle site in a browser (installation will complete automatically) or run the command line version at (requires cli version of PHP):

Sudo /usr/bin/php /var/www/moodle/admin/cli/install.php

Notes - http://moodle.hermiston.k12.or.us for web address


Use most defaults

The CLI creates the config.php for you and will not run if you created one in the previous step.
-After completing the install make sure your file permissions are ok for the Moodle program files (not writeable by web server) and the Moodle data files (writeable by web server).

Permissions
- chown -R root /var/www/
- chmod -R 0755 /var/www/
- chmod -R 0777 /var/www/moodledata

- DON'T forget to start Apache -> service apache2 start

- MAJOR change for Ubuntu, the default index location is /var/www/html. Need to go into /etc/apache2/sites-enabled and modify the config file there to DocumentRoot /var/www

Set up cron
-You will need a cron job to run periodically (for Moodle 2.8 and later we recommend every minute).

Finding the right place to put the command

use the crontab command to open a crontab editor window for the www-data user. This is the user that Apache (the web server) runs as on Debian based systems

$ crontab -u www-data -e

This will open an editor window. To run the cli cron script every 2 minute, add the line: (Ububtu can handle 1)

*/2 * * * * /usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null (note the spaces between the *'s if typing)

Congratulations!

You are now ready to use your Moodle site.


****Extra info for set up****

https://docs.moodle.org/28/en/LDAP_authentication requries php5-ldap