Development Seed

Blog

Aegir From Scratch - Installing Aegir 0.2 RC 1

A Screencast on How to Install the Aegir Hosting System

To celebrate the first release candidate of Aegir 0.2, I have put together the following exhaustively complete screencast guiding you through installing the Aegir hosting system.

This screencast was made by downloading an Ubuntu server vmware image from ThoughtPolice, and documenting the entire process of installing a fully working instance of Aegir hosting.

Because of the nature of the vmware image, this screencast literally starts from nothing and shows you everything that needed to be done to install aegir. Your mileage may vary, as your own VPS or server most likely already has things like openssh and sendmail installed. As this screencast is very text heavy, I have also included the complete transcript of all the commands used during the process.

All the configuration files that are included in this post are meant as examples only, and should not just be dropped onto your server. The video documents exactly how they were changed, and you need to follow the changes, not the final result.

Installing required packages

(
# basic server maintenance
sudo apt-get update;
sudo apt-get upgrade;

# Specific to this environment
sudo apt-get install openssh-server;
sudo apt-get install sendmail;

# Required components
sudo apt-get install wget cvs;
sudo apt-get install mysql-server mysql-client;
sudo apt-get install apache2;
sudo apt-get install php5 php5-cli php5-mysql;

# Only needed if you are not using a real domain
sudo apt-get install bind9;
)

Configuring bind

sudo vim /etc/bind/named.conf.local &&
sudo vim /etc/bind/db.vmdev &&
sudo /etc/init.d/bind9 restart

sudo vim /etc/resolv.conf &&
sudo vim /etc/dhcp3/dhclient.conf &&
sudo dhclient

ping random.vmdev

Resulting files :
named.conf.local
db.vmdev
dhclient.conf
resolv.conf

Creating Aegir user

sudo adduser aegir --home /var/aegir &&
su - aegir

Downloading Aegir

(
export CVSROOT=:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib
cvs login

# Download Drush
cvs -z6 co -d drush -rDRUPAL-6--2-0-RC1 contributions/modules/drush

# Download provision
mkdir ~/.drush
cvs -z6 co -d .drush/provision -rDRUPAL-6--0-2-RC1 contributions/modules/provision

# Download hostmaster install profile
cvs -z6 co -d hostmaster -rDRUPAL-5--0-2-RC1 contributions/profiles/hostmaster
mkdir hostmaster/modules
mkdir hostmaster/themes

# Download hosting front end
cvs -z6 co -d hostmaster/modules/hosting -rDRUPAL-5--0-2-RC1 contributions/modules/hosting

# Download optional components eldir and admin_menu
cvs -z6 co -d hostmaster/themes/eldir -rDRUPAL-5--0-2-RC1 contributions/themes/eldir
~/drush/drush.php dl admin_menu-5.x-2.8 --destination=hostmaster/modules
)

Configuring Apache - Creating virtual host

(
mkdir -p ~/config/vhost.d
cp hostmaster/apache2.conf.txt ~/config/vhost.d/aegir.vmdev
vim ~/config/vhost.d/aegir.vmdev
)

Resulting files :
aegir.vmdev

Downloading Drupal

(
drush/drush.php dl drupal-5.18
mv drupal-5.18 drupal-5.x
mv hostmaster drupal-5.x/profiles/
)

Configuring Apache - Required modules and Include directive

logout
(
sudo a2enmod php5
sudo a2enmod rewrite
sudo vim /etc/apache2/httpd.conf
sudo /etc/init.d/apache2 restart
)

resulting files :
httpd.conf

Configuring MySQL - Creating hostmaster database and account

(
mysqladmin -uroot -ppass create hostmaster
echo "GRANT ALL ON hostmaster.* TO 'hostmaster'@'localhost' IDENTIFIED BY 'password'" |
   mysql -uroot  -ppass hostmaster
)

Configuring PHP - Setting the memory limit

(
sudo vim /etc/php5/cli/php.ini
sudo vim /etc/php5/apache2/php.ini
sudo /etc/init.d/apache2 restart
)

Change permissions of settings.php file

sudo chmod 777 /var/aegir/drupal-5.x/sites/default/settings.php

Add user to www-data group

sudo adduser aegir www-data

Configuring sudo - Give Aegir user permission to restart apache

sudo visudo

Added line :

aegir ALL=NOPASSWD: /usr/sbin/apache2ctl

Configuring MySQL - Add super user account

mysql -uroot -ppass mysql;

Ran command :
GRANT ALL PRIVILEGES ON *.* TO 'aegir'@'localhost' IDENTIFIED BY 'password'  WITH GRANT OPTION;

Hosting setup

su - aegir
cd /var/aegir/drupal-5.x
/var/aegir/drush/drush.php hosting setup

Running hosting dispatch manually

~/drush/drush.php --root=/var/aegir/drupal-5.x hosting dispatch

Downloading extra platform

~/drush/drush.php dl drupal-6.12

Thanks to the wonderful Jonathan Coulton for the (cc licensed) intro music.

Drush and Aegir

Hi Adrian,

I been reading quite a bit on you, Drush Module and Aegir. I’m researching multi-site installations using Drupal and I’ve found quite a few articles. Drush and Aegir is more of what I’m looking for but I do have a few questions. After watching the entire screencast I noticed you apt-get upgrade.

Can you tell me what Dries meant in his interview when he state:

Upgrading a Drupal web site is more of a challenge than upgrading a simple application. Something like apt-get doesn’t usually work well to upgrade Drupal sites.

Although Drupal is in these distributions, it’s not necessarily the best way to do upgrades, although it is ideal for installing the software from scratch. Here’s the link: http://howsoftwareisbuilt.com/2008/11/21/interview-with-dries-buytaert-c...

I’m coming from the Joomla world. I have purchased all of Lullabots screencasts and about 10 books on Drupal. And some on Ubuntu. Ubuntu most recently because I noticed you have referenced it and use it for Aegir. I’ve been using Drupal close to 4 months now and still learning a lot. I just wanted to make sure I’m going in the right direction with Drush and Aegir as a solution for managing multi-site installations.

Lanesa

Errors during platform verify

Hello Adrian,

First I would like to commend you on your fantastic work; I have been studying Aegir for a little while now and I am excited at the prospect of using it to manage Drupal sites.

To that end, I decided today to install and test it (with Drupal 5 frontend of course), but I am getting errors during the platform verification stage of the install:

Log message Task starts processing Running: php /var/aegir/drush/drush.php —root='/var/aegir/drupal-5.x' 'provision' 'verify' —backend Drush bootstrap phase : _drush_bootstrap_drush() Drush bootstrap phase : _drush_bootstrap_drupal_root() Loading drushrc "/var/aegir/drupal-5.x/drushrc.php" into "drupal" scope. Initialized Drupal 5.18 root directory at /var/aegir/drupal-5.x Found command: provision verify Initializing drush commandfile: provision_apache Undefined index: base_url Initializing drush commandfile: provision_drupal Initializing drush commandfile: provision_mysql Undefined index: db_url Including /var/aegir/.drush/provision/web_server/verify.provision.inc Including /var/aegir/.drush/provision/platform/verify.provision.inc Including /var/aegir/.drush/provision/db_server/verify.provision.inc Virtual host configuration path exists. Virtual host configuration ownership of path has been changed to aegir. Virtual host configuration permissions of path have been changed to 700. Virtual host configuration path is writable. Generating apache host configuration file platform_5.conf. Apache has been restarted Provision configuration path exists. Provision configuration ownership of path has been changed to aegir. Provision configuration permissions of path have been changed to 700. Provision configuration path is writable. Backup path exists. Backup ownership of path has been changed to aegir. Backup permissions of path have been changed to 700. Backup path is writable. Drupal sites directory is writable by the provisioning script Undefined variable: sites This platform is running drupal 5.18 Including version specific file : /var/aegir/.drush/provision/platform/drupal/packages_5.inc Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Found 29 modules in base Undefined property: stdClass::$info Undefined property: stdClass::$info Undefined property: stdClass::$info Undefined property: stdClass::$info Undefined property: stdClass::$info Undefined property: stdClass::$info Found 6 themes in base Undefined property: stdClass::$info Found install profile default Undefined property: stdClass::$info Found install profile hostmaster Undefined index: project Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Use of undefined constant DRUPAL_MINIMUM_PHP – assumed 'DRUPAL_MINIMUM_PHP' Undefined index: project Found 15 modules in profiles/hostmaster Undefined property: stdClass::$info Found 1 themes in profiles/hostmaster Mysql can create new databases. Generating drushrc.php file Changed permissions of drushrc.php to 600 Drushrc file (/var/aegir/drupal-5.x/drushrc.php) was written successfully Changed permissions of drushrc.php to 400 Command dispatch complete Removing task from hosting queue Command dispatch complete

Any ideas? Some guidance would be very much appreciated… my thanks in advance.

-Paul

settings.php permissions

Hi,

on the screencast you are changing the permissions of settings.php (chmod) to 666, but in the transcript it is 777. I used 777 but was wondering if both work, and which is better.

And thanks immensely for the amazing product and the crystal-clear video!

Albert.

Verify Image Library

It might be a good idea to verify whether the Image Library is available for the installed sites. And could even be verified as and extra requirement during verification of the libraries

installing the hostmaster.

the step where you add an extra nameserver to your guest machine to be able to reach aegir.vmdev could that not be replaced by adding an extra line 172.16.171.xxx aegir.vmdev to your /etc/hosts file ?

for all .vmdev domains

the option of using /etc/hosts to reach the aegir.vmdev is valid, but off course, as soon as you’re trying to reach the random.vmdev domain, or any other domain know by the aegir server, you won’t be able to reach that from your own local machine.

About those ip-adresses used.

Hi Adrian,

could you explain me what those ip-adresses used in the config files relate to, and how i could detect those in my virtualbox machine ?

in db.vmdev : 172.16.172.136 in resolv.conf : 172.16.172.2

Roel

ip of machine an it's dns server

i figured them out first ip = ip from the vm machine second ip = ip from the automatically detected dns server for that machine

on my virtualbox they where 10.0.x.y numbers

using 'tasksel install' ?

How different is using

sudo apt-get install mysql-server mysql-client; sudo apt-get install apache2; sudo apt-get install php5

compared to using

sudo tasksel install lamp-server

??

Thank you for this great tutorial!

This was one of the best guides I have seen! Video, text and code. Wow!

I have almost successfully configured Ægir 0.2rc on a Ubuntu 8.04 server. The web GUI says everything is OK until it needs to reboot Apache. This cosed one of my installations to become corrupt while migrating (test install).

When I log on as aegir and run “/usr/sbin/apache2ctl restart” I get theis output; and Apache has to be tarted as root:

“ aegir@admin:~$ /usr/sbin/apache2ctl restart [Wed Jun 03 09:20:32 2009] [error] VirtualHost *:80 — mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Wed Jun 03 09:20:32 2009] [error] VirtualHost *:80 — mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Wed Jun 03 09:20:32 2009] [error] VirtualHost *:80 — mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Wed Jun 03 09:20:32 2009] [warn] NameVirtualHost *:80 has no VirtualHosts httpd not running, trying to start (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs aegir@admin:~$ “

My “nano /var/aegir/config/vhost.d/myfirstsite.com” looks like this:

“ NameVirtualHost *:80

Options FollowSymLinks AllowOverride None

  1. XXX: see http://drupal.org/node/384972

Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all

RewriteEngine On ServerAdmin webmaster@localhost ServerName admin.myfirstsite.com DocumentRoot /var/aegir/drupal-5.x

The http://drupal.org/node/384972 describes some sort of patch. But I have newer installed a patch to other things then windowz games. I tried to understand but I can’t come to grips with this.

http://wiki.apache.org/httpd/VirtualHostsMixingPorts says the problem is:

  1. You have no VirtualHosts that match the NameVirtualHost directive.
  2. You are mixing the use of *:80 with ones that do not use a port number.

Please help!

Hi Nordviks, You should post

Hi Nordviks, You should post over on the Drush project space if you are having issues: http://drupal.org/project/drush. Also, there is good helper documentation there that you might find useful.

Hope that helps!

Bonnie

Hi, nice tuto, but I have

Hi, nice tuto, but I have errors while verifying the plateform settings :s

This is the log:

Log message Task starts processing Running: php /var/aegir/drush/drush.php —root=’/var/aegir/drupal-5.x’ ‘provision’ ‘verify’ —backend Drush bootstrap phase : _drush_bootstrap_drush() Drush bootstrap phase : _drush_bootstrap_drupal_root() Initialized Drupal 5.18 root directory at /var/aegir/drupal-5.x Found command: provision verify Initializing drush commandfile: provision_drupal Initializing drush commandfile: provision_apache Initializing drush commandfile: provision_mysql Including /var/aegir/.drush/provision/platform/verify.provision.inc Including /var/aegir/.drush/provision/web_server/verify.provision.inc Including /var/aegir/.drush/provision/dns_server/verify.provision.inc Including /var/aegir/.drush/provision/db_server/verify.provision.inc Provision configuration path exists. ###Provision configuration ownership of path could not be changed to aegir. (chown to aegir failed on /var/aegir/config) ###Provision configuration permissions of path could not be changed to 700. (chmod to 700 failed on /var/aegir/config) ###Provision configuration path is not writable. Web server configuration path exists. ###Web server configuration ownership of path could not be changed to aegir. (chown to aegir failed on /var/aegir/backups) ###Web server configuration permissions of path could not be changed to 700. (chmod to 700 failed on /var/aegir/backups) ###Web server configuration path is not writable. ###Drupal sites directory is not writable by the provisioning script This platform is running drupal 5.18 Including version specific file : /var/aegir/.drush/provision/platform/drupal/packages_5.inc Found 29 modules in base Found 6 themes in base Found install profile hostmaster Found install profile default Found 15 modules in profiles/hostmaster Found 1 themes in profiles/hostmaster ###An error occurred at function : drush_provision_drupal_provision_verify Command dispatch complete Removing task from hosting queue An error occurred at function : drush_hosting_hosting_task Changes for drush_hosting_hosting_task module have been rolled back. Command dispatch complete

I followed the full tutorial, aegir have the good rights though :/

provision version

you might have bumped into the same problem as i did.

i’ve typed all the commands above myself iso copy-pasting them.

i took me some time to figure out that the cvs version for ‘provision’ is DRUPAL-6—0-2-RC1 and not rDRUPAL-6—2-0-RC1

like the module a few lines higher up.

it works and it looks great!

if you have more secure server settings ;) copy your php.ini to php-cli.ini and get system and exec out of the disabled functions, disable allow_url_open. php-cli.ini will only affect php-cli settings not your apache module settings.

If you want to keep even your php-cli settings secure you can use:

php -c pathTo/temp-php.ini -f drush.php OPTIONS (the installation will succeed but i’m not sure if aegir will work 100% correctly)

We would like to pay for support on a freelance basis! Our company is quit new to drupal and sometimes drupal can be hard to understand so please contact me on:

volkan.f at the nice emailservice google is providing!

regards Volkan

Error while installing drush

Hey,

I get stuck installing drush… :(

~/drush/drush.php dl -v admin_menu-5.x-2.8 —destination=hostmaster/modules

Including non-version specific file : [notice] /var/spool/www/user/aegir/drush/commands/pm/package_handler/wget.inc Including non-version specific file : [notice] /var/spool/www/user/aegir/drush/commands/pm/version_control/svn.inc Could not download project status information from [error] http://updates.drupal.org/release-history/admin_menu/5.x An error occurred at function : drush_pm_dl [error] Command dispatch complete [notice]

My server configuration:

Centos 4.6 php 5.2.9 (php-cli is the same)

Is someone offering professional support?

regards Volkan

Post on D.O.

Volkan, You should post over on the Drush project space if you are having issues: http://drupal.org/project/drush there is good helper documentation there.

Hope that helps! eric

Sweet!

I’m constantly amazed by how thorough you guys are on stuff like this… Very very helpful, thank you!

Why drupal 5?

So, why drupal 5? What’s the roadmap for drupal 6 on this?

Stability and our own sanity.

I get asked this pretty often, so I wrote my reply in a post to g.d.o http://groups.drupal.org/node/22424