This documents how I installed Drupal on a brand new Macbook Air running Snow Leopard 10.6.5.
Web/Desktop/Shell: Install MySQL
- Go here (“Mysql Community Server”) and download the 64 bit version
- Double click on the DMG and Install
- Drag the .PREF file in the DMG to the System Preferences
Note – I’m still having trouble starting MySQL from the command line. Right now I’m doing:
cd /usr/local/mysql/bin
nohup ./mysqld_safe &
disown %1
If you have advice, I’d appreciate it.
Web/Shell: Install Drupal
- Download Drupal
- Untar Drupal in
~/Sites/
- In Apple > System Preferences > Sharing, select Web Sharing
- In your browser go to
http://localhost/~USERNAME/drupal-6.20/
In case it’s not clear what happened here:
- Snow Leopard has an Apache Server built in
- each user account gets it’s HTTP files in
~/Sites/
- you turn on Apache by turning on Web Sharing
- you browse by going to
~USERNAME/
You’ll notice at this stage we’re just seeing a directory listing, or if you’re a little more ambitious and click on “index.php”, PHP code. If you’re actually seeing a Drupal setup page, skip the next section.
Shell: Setup PHP
This is just following the excellent instructions from here.
sudo vim /etc/apache2/httpd.conf
- uncomment
LoadModule php5_module
bash (to start a subshell)
cd /etc
sudo cp php.ini.default php.ini
sudo chmod 666 php.ini
sudo vi /etc/php.ini
- search for
;date.timezone
- uncomment and change to:
date.timezone=America/Toronto
- restart apache:
sudo apachectl restart
- end the subshell:
exit
Note – if you see the error “/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument“, follow the instructions here:
- sudo vim /usr/sbin/apachectl
- comment out ULIMIT_MAX_FILES at line 64
Local Web/Shell: Set up Drupal
- go to the webpage
install.php (on the URL figured out way above)
- click on Install Drupal in English
- if you get an error message about
default.settings.php
cd ~/Sites/drupal-6.20/sites/default
cp default.settings.php settings.php
chmod a+w settings.php
- if you get an error message about
sites/defaults/files
cd ~/Sites/drupal-6.20/sites/default
mkdir files
chmod 777 files
At this point you should be brought to a “Database Configuration Page” and we have to leave the browser and go back to the command line.
Shell: MySQL Database Configuration
These instructions create a MySQL database called “drupal_db” with access by “drupal_user” using the password “drupal_password“.
/usr/local/mysql/bin/mysql -u root
create database drupal_db;
grant all privileges ON drupal_db.* TO "drupal_user"@"localhost" identified by "drupal_password";
grant all privileges ON drupal_db.* TO "drupal_user"@"127.0.0.1" identified by "drupal_password";
flush privileges;
exit;
Local Web: Enter MySQL information into Drupal
Back in the browser you should be on the Drupal Database Configuration page. Enter drupal_db, drupal_user and drupal_password (the values you created in the previous step)
Submit the form. If you get the following error message:
Failed to connect to your MySQL database server. MySQL reports the following message: No such file or directory.
Make sure you typed everything correctly. If necessary, click on Advanced Options and change the hostname from localhost to 127.0.0.1.
Local Web: Configure Site page for Drupal
- Site Information:
- Site Name:
localhost (why not)
- Site e-mail address:
your@email.com
- Administrator account:
- Username:
admin (why not)
- E-mail address:
your@email.com
- Password:/Confirm password:
your-favorite-password
Local Web: Drupal installation complete
After you hit submit, you should be finished installing Drupal, except for the next little cleanup step.
Shell: Clean up files
Drupal doesn’t like you leaving settings.php alterable by the web server around:
cd ~/Sites/drupal-6.20/sites/default
chmod go-w settings.php
The directory files must be left writable.