Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Serving Moodle Presentation


Published on

  • Be the first to comment

  • Be the first to like this

Serving Moodle Presentation

  1. 1. Presented by Diana Clarke and Brian Dichter Behind the Scenes– Serving Moodle
  2. 2. Introduction <ul><li>Moodle is Open Source and relies on several key Open Source applications to do its magic. </li></ul><ul><li>MySQL database. </li></ul><ul><li>PHP is server-side scripting language that works especially well with MySQL. </li></ul><ul><li>Apache is the webserver software on Mac OS X. </li></ul>
  3. 3. Assumptions <ul><li>You know that Moodle is a “software package for producing internet-based courses and web sites, supporting a social constructionist framework of education”. </li></ul><ul><li>Brand new “vanilla” Mac OS X Server </li></ul><ul><li>Or, server without PHP/MySQL configured </li></ul><ul><li>Administrator access to Mac OS X Server </li></ul><ul><li>Use both GUI and Terminal </li></ul>
  4. 4. Downloads <ul><li>Moodle-latest build (1.5.3+) </li></ul><ul><ul><li> </li></ul></ul><ul><li>PHP (4.3.11 for Apache 1.3) </li></ul><ul><ul><li> </li></ul></ul><ul><li>MySQL (Standard 4.0.26) </li></ul><ul><ul><li> </li></ul></ul><ul><li>Apache (1.33) </li></ul><ul><ul><li>Already installed on Mac OS X Server </li></ul></ul>
  5. 5. Downloads–Optional <ul><li>phpMyAdmin </li></ul><ul><ul><li> </li></ul></ul><ul><li>MyS QL Administrator </li></ul><ul><ul><li> </li></ul></ul><ul><li>MySQL Query Browser </li></ul><ul><ul><li> </li></ul></ul>
  6. 6. Configure Webserver <ul><ul><li>Use Server Admin </li></ul></ul><ul><ul><li>Select the “Web” service to configure Settings </li></ul></ul><ul><ul><li>Double-click the default site </li></ul></ul><ul><ul><li>Edit the Domain Name (use FQDN if possible) </li></ul></ul><ul><ul><li>Take note of the Web folder location </li></ul></ul><ul><ul><li>Make sure to edit the Default index files </li></ul></ul><ul><ul><li>Edit the Administrator email address </li></ul></ul><ul><ul><li>Select Options and uncheck everything (unless you have other sites running that need any of these) </li></ul></ul><ul><ul><li>Start the Web service! </li></ul></ul>
  7. 10. Configure Webserver <ul><ul><li>Visit your site in a browser to test that it’s working (you should see the Apache manual) </li></ul></ul><ul><ul><li>Clean up your Web folder (I usually delete all of the Apache files…actually, I usually delete everything except the error page) </li></ul></ul>
  8. 11. Install and Test PHP <ul><ul><li>Install the PHP package </li></ul></ul><ul><ul><li>Create a text file in your Web folder named “info.php” containing the following code: </li></ul></ul><ul><ul><ul><li><?php> </li></ul></ul></ul><ul><ul><ul><li>phpinfo(); </li></ul></ul></ul><ul><ul><ul><li>?> </li></ul></ul></ul><ul><ul><ul><li>Open this page in your browser to test PHP </li></ul></ul></ul><ul><ul><ul><li> </li></ul></ul></ul><ul><ul><li>- After successfully testing, delete the “info.php” file. </li></ul></ul>
  9. 14. Install and Test MySQL <ul><ul><li>Install the MySQL package and the startup item package. </li></ul></ul><ul><ul><li>User Terminal to start the MySQL server. </li></ul></ul><ul><ul><li>$ sudo /Library/StartupItems/MySQL/MySQL start </li></ul></ul><ul><ul><li>Use Terminal and the MySQL Monitor program to check that it’s running (most common error is forgetting to start the server). </li></ul></ul><ul><ul><li>$ mysql -u root </li></ul></ul><ul><ul><li>Set and secure the root password. </li></ul></ul><ul><ul><li>mysql> set password for </li></ul></ul><ul><ul><li> > root@localhost=password(‘------’); </li></ul></ul>
  10. 16. Install and Test MySQL <ul><ul><li>Delete anonymous accounts. </li></ul></ul><ul><ul><li>mysql> use mysql; </li></ul></ul><ul><ul><li>mysql> delete from user where User=‘’; </li></ul></ul><ul><ul><li>mysql> delete from db where User=‘’; </li></ul></ul><ul><ul><li>mysql> flush privileges; </li></ul></ul>
  11. 18. Install and Test MySQL <ul><ul><li>Create Moodle database and account. </li></ul></ul><ul><ul><li>mysql> CREATE DATABASE moodle; </li></ul></ul><ul><ul><li>mysql> GRANT SELECT,INSERT,DELETE,CREATE,DROP,INDEX, </li></ul></ul><ul><ul><li>> ALTER ON moodle.* TO moodleuser@localhost </li></ul></ul><ul><ul><li>> IDENTIFIED BY ‘somesecretpassword’; </li></ul></ul><ul><ul><li>> quit </li></ul></ul><ul><ul><li>$ mysqladmin -u root -p reload </li></ul></ul>
  12. 19. Install and Test MySQL <ul><ul><li>Test your new account. </li></ul></ul><ul><ul><li>$ mysql -u moodleuser -p </li></ul></ul>
  13. 20. Prepare to Install Moodle <ul><ul><li>Create a data directory. </li></ul></ul><ul><ul><li>$ sudo mkdir /Library/WebServer/moodle-data </li></ul></ul><ul><ul><li>Change the owner and permissions on the data directory. </li></ul></ul><ul><ul><li>$ sudo chown www:www /Library/WebServer/moodle-data </li></ul></ul><ul><ul><li>$ sudo chmod 700 /Library/WebServer/moodle-data </li></ul></ul>
  14. 21. Prepare to Install Moodle <ul><ul><li>Move your Moodle download into your Web folder. </li></ul></ul><ul><ul><li>Use the Terminal to extract the files (there are a lot of files!). </li></ul></ul><ul><ul><li>$ tar xvf moodle-latest-15.tar </li></ul></ul><ul><ul><li>Change the owner of the Moodle directory (or you may get an error). </li></ul></ul><ul><ul><li>$ sudo chown www:www /Library/WebServer/Documents/moodle </li></ul></ul>
  15. 22. Install Moodle <ul><ul><li>Open the install.php file in your web browser. </li></ul></ul><ul><ul><li>Follow the instructions on each page until you’re done! </li></ul></ul>
  16. 43. Moodle Database Backup <ul><ul><li>Create a simple backup script to backup your database. </li></ul></ul><ul><ul><li>Create a folder where you will store your database backups (for example: /Library/WebServer/db) </li></ul></ul><ul><ul><li>Create a text file (plain text, not rtf!) named “dbBot” containing the following code: </li></ul></ul><ul><ul><li>#!/bin/bash </li></ul></ul><ul><ul><li>cd /Library/WebServer/db </li></ul></ul><ul><ul><li>mysqldump -u root -psecretpassword </li></ul></ul><ul><ul><li>moodle > moodle-backup.sql.`date +%m%d%Y` </li></ul></ul>
  17. 44. Moodle Database Backup <ul><li>Change the permissions of this file so root owns, noone can read. </li></ul><ul><li>$ sudo chown root dbBot </li></ul><ul><li>$ sudo chmod 700 dbBot </li></ul><ul><li>Test the script. </li></ul><ul><li>$ sudo sh dbBot </li></ul><ul><li>A test should produce something like this in /Library/WebServer/db: </li></ul><ul><li>moodle-backup.sql.02282006 </li></ul><ul><li>moodle-backup.sql.03012006 </li></ul>
  18. 45. Moodle Database Backup <ul><li>Restoring a database is fairly easy. </li></ul><ul><ul><li>mysqldump -u root -psecretpassword </li></ul></ul><ul><ul><li>moodle < moodle-backup.sql.03012006 </li></ul></ul>
  19. 46. Automate Backup and Tasks <ul><li>We use Cron to automate backups and Moodle tasks. Use Terminal! </li></ul><ul><li>$ sudo pico /etc/crontab </li></ul><ul><li>You will see this: </li></ul><ul><li># /etc/crontab </li></ul><ul><li>SHELL=/bin/sh </li></ul><ul><li>PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin </li></ul><ul><li>HOME=/var/log </li></ul><ul><li># </li></ul><ul><li>#minute hour mday month wday who command </li></ul><ul><li># </li></ul><ul><li>#*/5 * * * * root /usr/libexec/atrun </li></ul><ul><li># </li></ul><ul><li># Run daily/weekly/monthly jobs. </li></ul><ul><li>15 3 * * * root periodic daily </li></ul><ul><li>30 4 * * 6 root periodic weekly </li></ul><ul><li>30 5 1 * * root periodic monthly </li></ul>
  20. 47. Automate Backup and Tasks <ul><li>Add the following sections with comments at the end and exit pico (control-x) and save the file (y to save, hit enter): </li></ul><ul><li># run Moodle cron script </li></ul><ul><li>*/5 * * * * wget -q -O /dev/null </li></ul><ul><li># run dbBot to backup Moodle database in MySQL every day at 6:15am </li></ul><ul><li>15 6 * * * root /System/bin/dbBot </li></ul>
  21. 48. Summary <ul><li>Download the Open Source applications. </li></ul><ul><li>Configure the webserver. </li></ul><ul><li>Install and test PHP. </li></ul><ul><li>Install and test MySQL. </li></ul><ul><li>Create a Moodle database and user. </li></ul><ul><li>Create a data folder. </li></ul><ul><li>Install and test Moodle. </li></ul><ul><li>Create a custom MySQL database backup script. </li></ul><ul><li>Automate backup and Moodle tasks with Cron. </li></ul>
  22. 49. Configure Themes/Courses <ul><li>Configure Themes </li></ul><ul><li>Add Courses </li></ul>
  23. 50. Resources <ul><li>Moodle Documentation </li></ul><ul><li> </li></ul><ul><li>Moodle Support (Free Community Support) </li></ul><ul><li> </li></ul><ul><li>Moodle Philosophy </li></ul><ul><li> </li></ul><ul><li>Presentation files and other docs </li></ul><ul><li> </li></ul><ul><li>Diana Clarke [email_address] </li></ul><ul><li>Brian Dichter [email_address] </li></ul>
  24. 51. Q & A