Installing Aegir on OS X 10.6 with MAMP
Aegir install on OSX Snow Leopard
Aegir install instructions are fantastic if you run Debian/Ubuntu Linux. Some of the steps for OS X are a quite different. These instructions assume you are installing on Snow Leopard Client; if you are running on Snow Leopard Server many of these steps will not apply to you.
Setting up the Server components.
Your Mac will need to run Apache, Php, Mysql, and Bind (for DNS). Snow Leopard comes with Apache, Php and Bind installed, however it comes with version 5.3 of Php which is not compatible wit Aegir and other parts of Drupal (as far as I can tell).
The easy solution is to downnload and install MAMP 1.82 from Sourceforge. Here is the direct link: http://sourceforge.net/projects/mamp/files/mamp/1.8.2/MAMP_1.8.2.dmg.zip.... Note: this is not the latest version of MAMP. The latest version runs PHP 5.3 also. MAMP 1.82 runs PHP 5.2.10. This is what we need. This gives us Apache, Php and Mysql. However, OSX still has the original versions of Apache and PHP. So we can trick the system using the MAMP versions as follows:
First back up the original version of Php.
codefilter_code $ sudo mv /usr/bin/php /usr/bin/php-apple [/codefilter_code]
Symlink the MAMP version to /usr/bin/php
codefilter_code $ sudo ln -s /Applications/MAMP/bin/php5/bin/php /usr/bin/php [/codefilter_code]
Symlink mysql the same way if needed. (If you have never installed Mysql before than this will not be needed).
Back up the original version of apachectl.
codefilter_code $ sudo mv /usr/sbin/apachectl /usr/sbin/apachectl-apple [/codefilter_code]
Symlink the apachectl version to /usr/sbin/apachectl
codefilter_code $ sudo ln -s /Applications/MAMP/bin/apache2/bin/apachectl /usr/sbin/apachectl [/codefilter_code]
Do the same for httpd.conf:
codefilter_code
$ sudo mv /etc/apache2/httpd.conf /etc/apache2/httpd.conf.apple
$ sudo ln -s /Applications/MAMP/conf/apache/httpd.conf /etc/apache2/httpd.conf
[/codefilter_code]
Next, set up DNS services. See http://geoffhankerson.com/node/108 for a complete guide
You should now have Apache, Php, Mysql, and Bind running.
Other requirements - the xcode developer toolkit (so you have cvs), and wget. To install xcode, simply download it from http://developer.apple.com/tools/ and install from the .dmg. Wget compiles cleanly on Snow Leopard, so simply download it from http://ftp.gnu.org/gnu/wget/, uncompress, and open a terminal window.
codefilter_code$ cd /path/to/expanded/wget
sudo ./configure
sudo make && make install
[/codefilter_code]
- Create the aegir user
codefilter_code$ sudo dscl . -create /Users/aegir NFSHomeDirectory /var/aegir [/codefilter_code]
note: on snow leopard I had to assign a uid to the user in order to be able to chown, etc...
first, check for an unused uid:
codefilter_code
dsexport users.out /Local/Default dsRecTypeStandard:Users
[/codefilter_code]
then open the file users.out in a text editor, look for the highest 5xx user, then add one, for me it was 505, so I chose 506 as the uid for aegir.
then delete this users.out file to be safe:
codefilter_code
rm users.out
[/codefilter_code]
now assign this uid to aegir
codefilter_code
dscl . -create /Users/aegir UniqueID 506
[/codefilter_code]
note that the 506 may be different on your system.
- Set password for Aegir user
codefilter_code$ sudo passwd aegir New Password: Retype Password: [/codefilter_code] -
Create aegir home directory
codefilter_code$sudo mkdir /var/aegir[/codefilter_code] -
Make aegir user the owner of his home directory
codefilter_code$sudo chown aegir /var/aegir/[/codefilter_code] -
Change group to _www
codefilter_code$sudo chgrp _www /var/aegir/[/codefilter_code] -
Become the aegir user
codefilter_code su - aegir password: [/codefilter_code]
Preparations
Setup CVS repository...
codefilter_code
export CVSROOT=:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib
cvs login
[/codefilter_code]
You might see a warning at this point, which you can ignore ("cvs login: warning: failed to open /var/aegir/.cvspass for reading: No such file or directory"). Just proceed to the next step.
Download Drush and Provision
codefilter_code cvs -z6 co -d drush -r DRUPAL-6--2-0 contributions/modules/drush mkdir .drush cd .drush /var/aegir/drush/drush.php dl provision cd .. [/codefilter_code]
Note: you may have to download and install the PEAR Console_Table package manually from http://pear.php.net/package/Console_Table/download before this step will work correctly.
At this point we need to gain superuser privileges to execute the next few commands, so we logout of the aegir session...
codefilter_code
exit
sudo -s
chmod u+x /var/aegir/drush/drush
ln -s /var/aegir/drush/drush /usr/bin/drush
su - aegir
[/codefilter_code]
We're now back as the aegir user.
Test that the drush setup is working:
codefilter_code
drush
[/codefilter_code]
This should list all available drush commands. Check that it includes the 'provision' commands. If this doesn't work as expected troubleshooting is needed... check the permissions of the directories and drush file. Try codefilter_code/var/aegir/drush/drush.php[/codefilter_code]. If that works, then there's a problem with the symlink.
If all is working with drush, let's move on to the next step.
Setup Drupal codebase
We start by checking out the latest drupal 6 release...
codefilter_code
drush dl drupal
[/codefilter_code]
See how easy drush makes things?!
Get Hostmaster install profile
Hostmaster contains information for setting up Aegir in the new Drupal directory. Change directory (chdir) to your newly-downloaded Drupal installation's "profiles" subdirectory. In my case, drush downloaded it to drupal-6.15:
codefilter_code
cd drupal-6.15/profiles
[/codefilter_code]
Then, set it up as follows:
codefilter_code
export CVSROOT=:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib
cvs login
cvs -z6 co -d hostmaster -r DRUPAL-6--0-3 contributions/profiles/hostmaster
mkdir hostmaster/modules
mkdir hostmaster/themes
/var/aegir/drush/drush.php dl --destination=/var/aegir/drupal-6./profiles/hostmaster/modules hosting install_profile_api admin_menu
/var/aegir/drush/drush.php dl --destination=/var/aegir/drupal-6./profiles/hostmaster/themes eldir
[/codefilter_code]
Note that the hostmaster profile still needs to be checked out via CVS, as drush has problems downloading profiles (see http://drupal.org/node/500324).
Configure Apache
Now we'll copy across a file template (with the filename changed from aegir.example.com to the domain name of our aegir install)...
codefilter_code
mkdir -p /var/aegir/config/vhost.d
chmod 0711 /var/aegir/config
cp hostmaster/apache2.conf.txt ~/config/vhost.d/aegir.example.com
[/codefilter_code]
Edit this file as you wish, but you must ensure the servername, documentroot and directory are all correct for the codebase. So:
codefilter_codevim ~/config/vhost.d/aegir.example.com[/codefilter_code]
You must also enable php in the apache config file:
codefilter_codevim /etc/apache2/httpd.conf[/codefilter_code]
Find the line where php5 is loaded - Press the "/" key to search, type "php5_module", and hit enter. It will take you to a line that looks like this:
codefilter_code#LoadModule php5_module libexec/apache2/libphp5.so[/codefilter_code]
Use the left and right arrow keys to position your cursor at the start of the line (over the #), and press "x" to delete that one character. Then type
Next, we'll create some other useful directories...
codefilter_code
mkdir /var/aegir/backups
chmod 0700 /var/aegir/backups
mkdir /var/aegir/platforms
mkdir /var/aegir/drupal-6./sites/all/modules
chmod 0777 /var/aegir/drupal-6./sites/all/modules
mkdir /var/aegir/drupal-6./sites/all/themes
chmod 0777 /var/aegir/drupal-6./sites/all/themes
mkdir /var/aegir/drupal-6./sites/aegir.example.com
cp /var/aegir/drupal-6./sites/default/default.settings.php /var/aegir/drupal-6./sites/aegir.example.com/settings.php
chmod a+w /var/aegir/drupal-6./sites/aegir.example.com/settings.php
mkdir /var/aegir/drupal-6./sites/aegir.example.com/files
chmod 2770 /var/aegir/drupal-6./sites/aegir.example.com/files
[/codefilter_code]
And then...
codefilter_code
logout
sudo -s
[/codefilter_code]
So we're now back as root. Next we add the aegir user to the _www group.
codefilter_code
dscl . -append /Groups/_www GroupMembership aegir
[/codefilter_code]
If you are using the MAMP apache, you need to add your own user account to the _www group, too.
codefilter_code
dscl . append /Groups/_www GroupMembership username
[/codefilter_code]
Now we want to tell apache to include aegir's vhost files. Apache will automatically run files in /etc/apache2/other, so add/edit the new file with:
codefilter_codesudo vim /etc/apache2/other/aegir.conf [/codefilter_code]
putting the following inside it:
codefilter_codeInclude /var/aegir/config/vhost.d/* [/codefilter_code]
Next we configure sudo to allow aegir user permission to restart apache:
codefilter_codesudo visudo [/codefilter_code]
Press '0' then enter to go to the last line. Press 'o' to add a line. Type:
codefilter_codeaegir ALL=NOPASSWD: /usr/sbin/apachectl [/codefilter_code]
Hit Esc. Type ':'. type 'wq' and hit ENTER.
Configure MySQL
We'll now setup the necessary users and database in MySQL.
The main aegir site uses database 'aegir' and a database user 'aegir'.
codefilter_code
mysql -uonlyme -p
mysql> CREATE DATABASE aegir
mysql> GRANT ALL ON aegir.* TO 'aegir'@'localhost' IDENTIFIED BY 'password';
[/codefilter_code]
We also configure a MySQL 'superuser' who is capable of creating more databases. It is advised to not use the same user as the previous db user, but instead a separate superuser for security. As a naming standard, we recommend calling this superuser 'aegir_root'
codefilter_code mysql> GRANT ALL PRIVILEGES ON *.* TO 'aegir_root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; mysql> exit [/codefilter_code]
If your database server is running not on the local server but as a remote database server, substitute the 'localhost' commands for the wildcard '%'.
Run the installer
First, restart apache:
codefilter_codesudo /etc/init.d/apache2 restart [/codefilter_code]
Then in a browser, go to http://aegir.example.com (you will need to have setup the DNS entries for your domain to point at the IP of your server).
Hosting setup
Setup the database with the 'hostmaster' details we created earlier.
The setup will ask you to enter the path to drush.php. This is:
codefilter_code/var/aegir/drush/drush.php [/codefilter_code]
The configuration path is:
codefilter_code/var/aegir/config [/codefilter_code]
And the backup path is:
codefilter_code/var/aegir/backups [/codefilter_code]
We've already done the step of adding the line to httpd.conf.
On the Database page, enter the details for the 'aegir' database user.
On the Web Server page, enter the following values:
System account: aegir
Web server group: _www
Restart command: sudo /usr/sbin/apachectl graceful
On the
At some point during the install you'll be prompted to enter a drush command to run the hosting setup...
codefilter_code
su - aegir
cd /var/aegir/drupal-6.*
/var/aegir/drush/drush.php --uri=http://yoursite.com hosting setup
[/codefilter_code]
Configure Aegir
Aegir is now installed, and you can configure it with your preferred settings. Have a browse around. Read the wiki and other posts on here: http://groups.drupal.org/aegir-hosting-system to find out what you can do with it. Prepare to be excited (if you're a geek)!
For next steps see: Aegir Is Installed - What Next?
