Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Step-by-step Guide for Installing Moodle on Mac OS X 10.4 Client.

Step-by-step Guide for Installing Moodle on Mac OS X 10.4 Client

From MoodleDocs
Revision as of 05:18, 14 March 2006 by Don Hinkelman (talk | contribs)

These instructions are for installing PHP 5.1.2, MySQL 5.0.18 and Moodle with Mac OS 10.4.5 on a standard client Mac (not server version) to be used as a production server. Note that this procedure is more secure than the one-step Moodle4OSX package which is intended for a quick personal install--not for public production use. This procedure uses the standard Apache 1.3 which comes on every Mac with OS X. (Note: these instructions are not finished. I am taking notes in process as I am doing the install while writing this--Don Hinkelman, 2006.3.11). To complete all of these steps, it will take the following amount of time.
- 2 hours >> an experienced setup person
- 4 hours >> a normal novice
- over 6 hours >> a typical "guy" who never asks for help--should have gone earlier to the moodle.org Installation forums.



Step 1: Prepare your Server

a. Choose an old or new Mac with OS X 10.4 Tiger. This procedure was done on a 933mhz single processor PowerMac.
b. Get a global IP address and a domain name assigned to your server. If you don't want to make a public production server, use the one-step Moodle4OSX download and forget these instructions.  :-)
c. Turn on Apache (go to System Preferences >> Sharing, and then click on "Personal Web Sharing")
d. Download Tinkertool to turn on hidden files. Mac OS X normally hides many files in the system from ordinary users. This includes Apache and other files we install in later steps. In order to verify where a file or folder is, you may want to use Tinkertool to "show hidden files".
e. Upgrade your Mac OSX to the most recent version and include the most current Security Releases. After you you start running your Moodle server, you may not want to do any more OSX version updates, as the updates often patch Apache and break the whole installation, requiring a reinstall procedure.<br.


Step 2: Install PHP

a. Go to Marc Liyanage's site and download the PHP 5.1.2 for Apache 1.3 there. http://www.entropy.ch/software/macosx/php/

b. Click the installer and follow instructions. Do the test.php to see if your PHP and Apache are running. Unfortunately, this Entropy.ch package does not include a PHP accelerator that Moodle4OSX has.


Step 3: Install MySQL

a. Go to the main MySQL Download site and download MySQL standard version 5.0.18 for the Mac OS X (either PowerPC or x86) version that fits your machine. http://dev.mysql.com/downloads/mysql/5.0.html
b. Click the install package and follow instructions. Click the MySQLStartupItem package and follow instructions.
c. Make a new folder in /Library called "PreferencePanes" (unless already there). Drag the MySQL.prefPane file into that folder. Restart your computer. Click on the System Preferences of OS X. You now see a preference pane active at the bottom of the System Preferences. When you open it, you should see that MySQL is "running". You should make sure the checkbox for automatic MySQL startup is checked.


Step 4: Make a Secure Database for Moodle

a. Go to Terminal and make a password for the MySQL root user. This is an important security point.

 /usr/local/mysql/bin/mysqladmin -u root password new_password_here

b. Go to Terminal and make a database for moodle, you might call, "moodle", and a mysql user you might call, "moodleuser". First, type the following in Terminal to enter the MySQL monitor.

 /usr/local/mysql/bin/mysql -u root -p

c. Inside MySQL, you first make a database with the next line, then make a new user and password for using that database, then "flush" and "quit". These are important for making a secure setup.

 mysql> CREATE DATABASE moodle;
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'anotherpassword';
mysql> flush privileges;
mysql> quit


Step 5: Install Moodle

a. Go to the Moodle Downloads page, download the version you want, and unzip it.
b. Move the moodle folder to this location: /Library/WebServer/Documents/moodle This is for the moodle program and will be accessible to the public. Then create another inaccessible folder called "moodledata" in this location /Library/WebServer/moodledata or another non-public area.
c. Set permissions. Here are some easy terminal commands that you can type in to setup permissions for your site. A nice side benefit is that this will allow you to use moodle's setup script to create config.php for you. All of them use "sudo" to attain root access for the task. When you use sudo you will be prompted for a password - use the password of the user you have logged in to the Finder as. This first command sets the owner of your moodledata directory to "www" and the group to "admin". The admin group is any user on your local system that has administrator privs. The www user is the user that the apache web server accesses the file system as.

 sudo chown www:admin /Library/WebServer/moodledata/  	

You want to ensure that the apache user and local admins have access to read and write inside the moodledata folder. This next command opens access up completely to the www user and the admin group and make the folder unreadable by other non-admin users of your system.

 chmod 770 /Library/WebServer/moodledata 	 	

This next command recursively sets the entire contents of your moodle install directory to have owner "www" and group "admin". -R means "recurse" - which will drill down through the contents of moodledata if there is anything there.

 sudo chown -R www:admin /Library/WebServer/Documents/moodle/  	

Since you have now given ownership of the moodle install directory away to another user you will want to ensure that you, as a local admin, can modify the contents of the moodle installation folder. This command allows anyone in the admin group to add files to the moodle folder structure and edit the contents of files. (g+w means group add write - see man chmod)

 sudo chmod -R g+w /Library/WebServer/Documents/moodle    


Step 6: Make a Cron Job

Several Moodle functions require periodic actions called "cron jobs" (such as sending out email messages from forums). To make a cron job, I downloaded Cronnix, a GUI interface for editing the crontab in Mac OS X. In Cronnix, I set the schedule to: */5 * * * * * And then inserted the following command as per Martin’s suggestion…

 /usr/bin/curl -s -o /dev/null http://myservername/moodle/admin/cron.php

Step 7: Turn on the Postfix Mail Server

The mail server in OS X is called Postfix and it may not be turned on. To turn it on, download the freeware called Postfix Enabler and turn on the mail server. In Postfix Enabler, you just click the "enable" button and then go into your Mail application to set the SMTP mail server as "localhost".


Step 8: Adjust Apache and PHP and Moodle

Get a text editor such as the free TextWrangler, and open the following files to make typical adjustments.


Step 9: Clean Up

Wash coffee cups, toss chewed up pencils, and wipe your desk off. Congratulate yourself on some excellent webmastering. And bask in the glory of having a real Mac server that you know how to easily control and configure.  :-)