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
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.
$ sudo mv /usr/bin/php /usr/bin/php-appleSymlink the MAMP version to /usr/bin/php
$ sudo ln -s /Applications/MAMP/bin/php5/bin/php /usr/bin/phpSymlink 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.
$ sudo mv /usr/sbin/apachectl /usr/sbin/apachectl-appleSymlink the apachectl version to /usr/sbin/apachectl
$ sudo ln -s /Applications/MAMP/bin/apache2/bin/apachectl /usr/sbin/apachectl 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.
-
Create the aegir user
$ sudo dscl . -create /Users/aegir NFSHomeDirectory /var/aegir -
Set password for Aegir user
$ sudo passwd aegir
New Password:
Retype Password: -
Create aegir home directory
$sudo mkdir /var/aegir -
Make aegir user the owner of his home directory
$sudo chown aegir /var/aegir/ -
Change group to _www
$sudo chgrp _www /var/aegir/ -
Become the aegir user
su - aegir
password:
Preparations
Setup CVS repository...
export CVSROOT=:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib
cvs login Download Drush and Provision
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 ..At this point we need to gain superuser privileges to execute the next few commands, so we logout of the aegir session...
exit
sudo -s
chmod u+x /var/aegir/drush/drush
ln -s /var/aegir/drush/drush /usr/bin/drush
su - aegirWe're now back as the aegir user.
Test that the drush setup is working:
drushThis 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
/var/aegir/drush/drush.php. 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...
drush dl drupalSee how easy drush makes things?!
Get Hostmaster install profile
cd aegir/drupal-6./profiles
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 eldirNote 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)...
mkdir -p /var/aegir/config/vhost.d
chmod 0711 /var/aegir/config
cp hostmaster/apache2.conf.txt ~/config/vhost.d/aegir.example.com Edit this file as you wish, but you must ensure the servername, documentroot and directory are all correct for the codebase. So:
vim ~config/vhost.d/aegir.example.com
Next, we'll create some other useful directories...
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/filesAnd then...
logout
sudo -sSo we're now back as root. Next we add the aegir user to the _www group.
dscl . -append /Groups/_www GroupMembership aegirNow we want to tell apache to include aegir's vhost files. Apache will automatically run files in /etc/apache2/conf.d, so add/edit the new file with:
sudo vim /etc/apache2/conf.d/aegir
putting the following inside it:
Include /var/aegir/config/vhost.d/*
Next we configure sudo to allow aegir user permission to restart apache:
sudo visudo
Use the arrow keys to go to the last line. Press 'a' to add a line. Type:
aegir ALL=NOPASSWD: /usr/sbin/apache2ctl
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'.
mysql -uonlyme -p
mysql> CREATE DATABASE aegir
mysql> GRANT ALL ON aegir.* TO 'aegir'@'localhost' IDENTIFIED BY 'password'; 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'
mysql> GRANT ALL PRIVILEGES ON *.* TO 'aegir_root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> exit 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:
sudo /etc/init.d/apache2 restart
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:
/var/aegir/drush/drush.php
The configuration path is:
/var/aegir/config
And the backup path is:
/var/aegir/backups
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.
At some point during the install you'll be prompted to enter a drush command to run the hosting setup...
su - aegir
cd /var/aegir/drupal-6.*
/var/aegir/drush/drush.php --uri=http://yoursite.com hosting setup 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?
Preparations
Setup CVS repository...
export CVSROOT=:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib
cvs login Download Drush and Provision
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 ..At this point we need to gain superuser privileges to execute the next few commands, so we logout of the aegir session...
logout
chmod u+x /var/aegir/drush/drush
ln -s /var/aegir/drush/drush /usr/bin/drush
su - aegirWe're now back as the aegir user.
Test that the drush setup is working:
drushThis 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
/var/aegir/drush/drush.php. 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...
drush dl drupalSee how easy drush makes things?!
Get Hostmaster install profile
cd aegir/drupal-6./profiles
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 eldirNote 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)...
mkdir -p /var/aegir/config/vhost.d
chmod 0711 /var/aegir/config
cp hostmaster/apache2.conf.txt ~/config/vhost.d/aegir.example.com Edit this file as you wish, but you must ensure the servername, documentroot and directory are all correct for the codebase. So:
vim ~config/vhost.d/aegir.example.com
Next, we'll create some other useful directories...
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/filesAnd then...
logout So we're now back as root. Next we add the aegir user and yourself to the _www group.
dscl / -append /Groups/_www GroupMembership aegir
dscl / -append /Groups/_www GroupMembership yourusernameNow we want to tell apache to include aegir's vhost files. Apache will automatically run files in /etc/apache2/conf.d, so add/edit the new file with:
sudo nano /Applications/MAMP/conf/apache/httpd.conf
putting the following inside it:
Include /var/aegir/config/vhost.d/*
Next we configure sudo to allow aegir user permission to restart apache:
sudo visudo
Use the arrow keys to go to the last line. Press 'a' to add a line. Type:
aegir ALL=NOPASSWD: /usr/sbin/apache2ctl
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'.
mysql -uonlyme -p
mysql> CREATE DATABASE aegir
mysql> GRANT ALL ON aegir.* TO 'aegir'@'localhost' IDENTIFIED BY 'password'; 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'
mysql> GRANT ALL PRIVILEGES ON *.* TO 'aegir_root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> exit 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:
sudo /etc/init.d/apache2 restart
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:
/var/aegir/drush/drush.php
The configuration path is:
/var/aegir/config
And the backup path is:
/var/aegir/backups
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.
At some point during the install you'll be prompted to enter a drush command to run the hosting setup...
su - aegir
cd /var/aegir/drupal-6.*
/var/aegir/drush/drush.php --uri=http://yoursite.com hosting setup 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?
