While installing Aegir for FreeBSD there were a couple additional steps that were not included in install.txt (mig5 encouraged me to share my experience)

Alright, first issue I came across was in regards to the php dependancies, do not forget that only certain php modules are "drush" friendly but be sure to install what you need, here is a list of known friendly extensions:

Also, do not forget to install unzip '/usr/ports/archivers/unzip' or install will fail when grabbing jquery

bcmath
bz2
ctype
curl
pcre
simplexml
spl
dom
filter
ftp
gd
gettext
hash
iconv
json
mysql
openssl
pdf
posix
readline
session
sockets
tokenizer
xml
xmlreader
xmlwriter
zlib
mcrypt
mbstring
mysqli
pdo_mysqli

Once you have your dependencies settled there are a couple edits that make the install.sh friendlier for the environment:

install.sh:

########################################################################
# Aegir quick install script
@@ -20,18 +20,22 @@

########################################################################
# basic variables, change before release
-AEGIR_DOMAIN=aegir.example.com
-AEGIR_VERSION=HEAD
+HOME=/www/aegir
+PHP_LIBRARY=/usr/local/bin/php
+AEGIR_DOMAIN=aegir.example.com
+AEGIR_VERSION=6.x-0.4-alpha3
AEGIR_HOME=$HOME
WEB_GROUP=www-data
-DRUSH="$AEGIR_HOME/drush/drush.php"
-DRUSH_VERSION=All-Versions-2.1
+DRUSH="$AEGIR_HOME/drush/drush.php --debug --php=$PHP_LIBRARY"
+DRUSH_VERSION=All-Versions-HEAD
# when adding a variable here, add it to the display below

# no configurable settings below this line
-HOSTMASTER_DIR=$AEGIR_HOME/hostmaster-$AEGIR_VERSION
-
-########################################################################
+HOSTMASTER_DIR=$AEGIR_HOME/platforms/hostmaster-$AEGIR_VERSION
+
+########################################################################
+
+
# functions

# noticeable messages
@@ -104,6 +108,8 @@
* you have read INSTALL.txt and prepared the platform accordingly
* you are running as your "aegir" user
* the following settings are correct:
+HOME=$HOME
+PHP_LIBRARY=$PHP_LIBRARY
AEGIR_DOMAIN=$AEGIR_DOMAIN
AEGIR_VERSION=$AEGIR_VERSION
AEGIR_HOME=$AEGIR_HOME
@@ -132,14 +138,14 @@
DRUSH=drush
elif [ -x $DRUSH ] ; then
msg "Drush found in $DRUSH, good"
- DRUSH="php $AEGIR_HOME/drush/drush.php"
+ DRUSH="$AEGIR_HOME/drush/drush.php --debug --php=$PHP_LIBRARY"
else
msg "Installing drush in $AEGIR_HOME"
cd $AEGIR_HOME
wget http://ftp.drupal.org/files/projects/drush-$DRUSH_VERSION.tar.gz
- tar -xzf drush-$DRUSH_VERSION.tar.gz
+ tar -xzvf drush-$DRUSH_VERSION.tar.gz
rm drush-$DRUSH_VERSION.tar.gz
- DRUSH="php $AEGIR_HOME/drush/drush.php"
+ DRUSH="$AEGIR_HOME/drush/drush.php --debug --php=$PHP_LIBRARY"
fi

if $DRUSH help > /dev/null ; then
@@ -152,7 +158,7 @@
if ! $DRUSH help | grep -q "^ make" ; then
msg "Installing drush make in $AEGIR_HOME/.drush"
mkdir -p $AEGIR_HOME/.drush
- $DRUSH dl drush_make --destination=$AEGIR_HOME/.drush
+ $DRUSH dl drush_make-6.x-2.0-beta2 --destination=$AEGIR_HOME/.drush
else
msg "Drush make already seems to be installed"
fi
@@ -161,7 +167,7 @@
msg "Installing provision backend in $AEGIR_HOME/.drush"
mkdir -p $AEGIR_HOME/.drush
if [ "$AEGIR_VERSION" = "HEAD" ]; then
- git clone git://git.aegirproject.org/provision $AEGIR_HOME/.drush/provision
+ ( cd $AEGIR_HOME && cvs -d ":pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal" co -d .drush/provision contributions/modules/provision )
else
$DRUSH dl provision-$AEGIR_VERSION --destination=$AEGIR_HOME/.drush
fi
@@ -180,6 +186,7 @@
chmod 2770 sites/$AEGIR_DOMAIN/files
chgrp $WEB_GROUP sites/$AEGIR_DOMAIN/settings.php
chgrp $WEB_GROUP sites/$AEGIR_DOMAIN/files
+ ln -s $HOSTMASTER_DIR $AEGIR_HOME/public_html
fi

if ! [ -e $AEGIR_HOME/config/vhost.d/$AEGIR_DOMAIN ]; then
@@ -187,6 +194,9 @@
msg "Installed apache configuration file for $AEGIR_DOMAIN, you will need to restart apache"
fi

msg "Install process complete: follow the wizard"

cat < @@ -195,3 +205,4 @@
Some of the instructions given, you will already have completed, but carefully
read each step in turn to ensure you don't miss anything.
EOF
+

keep in mind my script will install aegir in /www/aegir and will put the hostmaster platform in /www/aegir/platforms/hostmaster-* and creates a symbolic link to the hostmaster at /www/aegir/public_html

be sure to modify to your configuration.

Before running the install script we need to modify hosting_task.module with mig5's commit found here:
http://git.aegirproject.org/?p=hostmaster.git;a=commitdiff;h=e51a542fc85...

Though mig5 did commit at the time of this post these changes were not in effect and must be modified manually in order to install.

Run
# ./install.sh

This will install aegir and all dependancies on FreeBSD

Comments

tiato’s picture

Couldn't edit post, sorry, be sure to apply this patch from mig5 AFTER running ./install.sh

http://git.aegirproject.org/?p=hostmaster.git;a=commitdiff;h=e51a542fc85ae8b9302cec6d4871457c8d0b9944
tiato’s picture

alright, well, finally got aegir installed and seemingly working, I might break it again though, the following was my "modified" install.sh

#! /bin/sh

# $Id$

########################################################################
# Aegir quick install script
#
# This script takes care of deploying all the required PHP scripts for
# the frontend to run properly. It should be ran as the Aegir user.
#
# It should keep to strict POSIX shell syntax to ensure maximum
# portability. The aim here is to ease the burden on porters but also
# allow people using various platforms to zip through the install quicker.
#
# Eventually, all this should be performed by the Provision backend.
#
# This script also *DOES NOT CHECK* if the requirements have been met.
# It's up to the admin to follow the proper install instructions or use
# the packages provided by their platform.

########################################################################
# basic variables, change before release
PHP_LIBRARY=/usr/local/bin/php
AEGIR_DOMAIN=aegir.example.net
AEGIR_VERSION=HEAD
AEGIR_HOME=$HOME
WEB_GROUP=www-data
DRUSH="$AEGIR_HOME/drush/drush.php --debug --php=$PHP_LIBRARY"
DRUSH_VERSION=All-Versions-HEAD
# when adding a variable here, add it to the display below

# no configurable settings below this line
HOSTMASTER_DIR=$AEGIR_HOME/platforms/hostmaster-$AEGIR_VERSION

########################################################################
# functions

# noticeable messages
msg() {
  echo "==> $*"
}

# simple prompt
prompt_yes_no() {
  while true ; do
    printf "$* [Y/n] "
    read answer
    if [ -z "$answer" ] ; then
	return 0
    fi
    case $answer in
      [Yy]|[Yy][Ee][Ss])
        return 0
        ;;
      [Nn]|[Nn][Oo])
        return 1
        ;;
      *)
	echo "Please answer yes or no"
	;;
    esac
 done 

}

usage() {
  cat <<EOF
Usage: $0 [ -V version ] [ -h ] [ -w group ] [ -d home ] hostname
EOF
}

########################################################################
# Main script

# stop on error
set -e

# parse commandline
args=`getopt V:w:d:h $*`
set -- $args

for i
do
        case "$i" in
              -w) shift; WEB_GROUP=$1; shift;;
              -h) shift; usage; exit;;
              -V) shift; AEGIR_VERSION=$1; shift;;
              -d) shift; AEGIR_HOME=$1; shift;;
              --) shift; break;;
        esac
done

AEGIR_DOMAIN=${1:-$AEGIR_DOMAIN}


msg "Aegir automated install script"

if [ `whoami` = "root" ] ; then
  msg "This script should be ran as a non-root user"
  exit 1
fi

msg "This script makes the following assumptions: "
cat <<EOF
 * you have read INSTALL.txt and prepared the platform accordingly
 * you are running as your "aegir" user
 * the following settings are correct:
PHP_LIBRARY=$PHP_LIBRARY
AEGIR_DOMAIN=$AEGIR_DOMAIN
AEGIR_VERSION=$AEGIR_VERSION
AEGIR_HOME=$AEGIR_HOME
WEB_GROUP=$WEB_GROUP
HOSTMASTER_DIR=$HOSTMASTER_DIR
DRUSH=$DRUSH
DRUSH_VERSION=$DRUSH_VERSION

Some of those settings can be changed on the commandline, see:

 $0 -h

for more information.
EOF

prompt_yes_no "Do you want to proceed with the install?"

msg "Creating basic directory structure"
mkdir -p $AEGIR_HOME/config/vhost.d
mkdir -p $AEGIR_HOME/backups
chmod 0711 $AEGIR_HOME/config
chmod 0700 $AEGIR_HOME/backups

if which drush 2> /dev/null ; then
	msg "Drush is in the path, good"
	DRUSH=drush
elif [ -x $DRUSH ] ; then
	msg "Drush found in $DRUSH, good"
	DRUSH="php $AEGIR_HOME/drush/drush.php --debug --php=$PHP_LIBRARY"
else
	msg "Installing drush in $AEGIR_HOME"
	cd $AEGIR_HOME
	wget http://ftp.drupal.org/files/projects/drush-$DRUSH_VERSION.tar.gz
	tar -xzf drush-$DRUSH_VERSION.tar.gz
	rm drush-$DRUSH_VERSION.tar.gz
	DRUSH="php $AEGIR_HOME/drush/drush.php --debug --php=$PHP_LIBRARY"
fi

if $DRUSH help > /dev/null ; then
	msg "Drush seems to be functionning properly"
else
	msg "Drush is broken ($DRUSH help failed)"
	exit 1
fi

if ! $DRUSH help | grep -q "^ make" ; then
	msg "Installing drush make in $AEGIR_HOME/.drush"
	mkdir -p $AEGIR_HOME/.drush
	$DRUSH dl drush_make-6.x-2.0-beta2 --destination=$AEGIR_HOME/.drush
else
	msg "Drush make already seems to be installed"
fi

if ! $DRUSH help | grep -q "^ provision install" ; then
	msg "Installing provision backend in $AEGIR_HOME/.drush"
	mkdir -p $AEGIR_HOME/.drush
	if [ "$AEGIR_VERSION" = "HEAD" ]; then
		git clone git://git.aegirproject.org/provision $AEGIR_HOME/.drush/provision
	else
		$DRUSH dl provision-$AEGIR_VERSION --destination=$AEGIR_HOME/.drush
	fi
else
	msg "Provision already seems to be installed"
fi

if ! [ -e $HOSTMASTER_DIR ] ; then
	msg "Deploying hostmaster application"
	$DRUSH hostmaster make $HOSTMASTER_DIR
	cd $HOSTMASTER_DIR
	mkdir sites/$AEGIR_DOMAIN
	cp sites/default/default.settings.php sites/$AEGIR_DOMAIN/settings.php
	chmod g+w sites/$AEGIR_DOMAIN/settings.php
	mkdir sites/$AEGIR_DOMAIN/files
	chmod 2770 sites/$AEGIR_DOMAIN/files
	chgrp $WEB_GROUP sites/$AEGIR_DOMAIN/settings.php
	chgrp $WEB_GROUP sites/$AEGIR_DOMAIN/files
        ln -s $HOSTMASTER_DIR $AEGIR_HOME/public_html
fi

if ! [ -e $AEGIR_HOME/config/vhost.d/$AEGIR_DOMAIN ]; then
	sed -e "s#DocumentRoot .*#DocumentRoot $HOSTMASTER_DIR#" -e "s#Directory .*#Directory $HOSTMASTER_DIR>#" -e "s/ServerName .*/ServerName $AEGIR_DOMAIN/" $HOSTMASTER_DIR/profiles/hostmaster/apache2.conf.txt > $AEGIR_HOME/config/vhost.d/$AEGIR_DOMAIN
	msg "Installed apache configuration file for $AEGIR_DOMAIN, you will need to restart apache"
fi

msg "Install process complete: follow the wizard"

cat <<EOF
Now point your browser to http://$AEGIR_DOMAIN/install.php and proceed
with the remainder of the installation using the Hostmaster Install profile.
Some of the instructions given, you will already have completed, but carefully
read each step in turn to ensure you don't miss anything.
EOF

It should be worth noting that I was having some issues with cron, seems when hosting dispatch ran in cron it would literally break my Aegir site after install. So I disabled cron until I finished install, Verified and Imported, restarted apache and then started cron from the aegir user with sudo.

As of this post everything seems good, Thanks to mig5 for a ton of help - notice what worked for me was using an older version of drush_make i am not sure if this will be the same for all freebsd configs but it worked for me

tiato’s picture

Assigned: Unassigned » tiato
tiato’s picture

Status: Active » Needs review
StatusFileSize
new2.39 KB

Okay, last post was rather long. I agree, was in a hurry and pulling my hair out but here's a patch instead for FreeBSD install.sh (HEAD)

This works for FreeBSD 7.2 Production Release - be sure to install dependancies!

Apache (# cd /usr/ports/www/apache22)
MySQL (# cd /usr/ports/databases/MYSQL)
PHP5 (# cd /usr/ports/lang/php5)
PHP5 Extensions (# cd /usr/ports/lang/php5-extensions)
unzip (# cd /usr/ports/archivers/unzip)
git (# cd /usr/ports/devel/git)
php5-json (# cd /usr/ports/devel/php5-json)
php5-pdo_mysql (# /usr/ports/databases/php5-pdo_mysql)

anarcat’s picture

Category: bug » feature
Status: Needs review » Needs work

So here we go, a quick review:

+++ C:\Users\web\Documents\www\exarnet.net\install.sh (unsaved) 
@@ -20,12 +20,14 @@
+HOME=/www/aegir

this shouldn't be necessary: it should be part of a HINTS_FreeBSD.txt that says to create the user with this home.

However, from my experience in FreeBSD, nothing justifies creating the user with this home. It would make more sense to put it in /usr/local/aegir.

+++ C:\Users\web\Documents\www\exarnet.net\install.sh (unsaved) 
@@ -20,12 +20,14 @@
+PHP_LIBRARY=/usr/local/bin/php

Same here: /usr/local/bin should be in the path, so "php" should just work.

+++ C:\Users\web\Documents\www\exarnet.net\install.sh (unsaved) 
@@ -20,12 +20,14 @@
+AEGIR_DOMAIN=aegir.hostname.tld

this is not required. example.com was chosen because it's the standard (ie. RFC) "example" domain name. hostname.tld is not.

+++ C:\Users\web\Documents\www\exarnet.net\install.sh (unsaved) 
@@ -20,12 +20,14 @@
+DRUSH="$AEGIR_HOME/drush/drush.php --debug --php=$PHP_LIBRARY"

see the notes about PHP_LIBRARY above. also, --debug is not necessary for functional installs, so I wouldn't put it by default.

+++ C:\Users\web\Documents\www\exarnet.net\install.sh (unsaved) 
@@ -20,12 +20,14 @@
+DRUSH_VERSION=All-Versions-HEAD

this may be required after all... Drush 2.1 is full of problems and we are still waiting for 2.2. While we do that, maybe we should recommend HEAD>

+++ C:\Users\web\Documents\www\exarnet.net\install.sh (unsaved) 
@@ -152,7 +155,7 @@
+	$DRUSH dl drush_make-6.x-2.0-beta2 --destination=$AEGIR_HOME/.drush

this could also be applied to everyone, but I'm not a drush_make expert so I don't know what the best version is.

+++ C:\Users\web\Documents\www\exarnet.net\install.sh (unsaved) 
@@ -180,6 +183,7 @@
+        ln -s $HOSTMASTER_DIR $AEGIR_HOME/public_html

I don't see why this is necessary if the virtual host is properly configured.

+++ C:\Users\web\Documents\www\exarnet.net\install.sh (unsaved) 
@@ -195,3 +199,4 @@
 EOF
+

Whitespace, not necessary.

Bottomline:

* all the changes suggested to the install.sh are not specific to FreeBSD
* maybe we need to suggest drush HEAD and drush make beta2 everywhere, but i'm not sure
* php needs to be in the path, and the aegir user needs to be properly created

I would suggest you look at the way the HINTS_CentOS.txt file was created and suggest a similar piece of documentation so that new FreeBSD users know a bit more what to do here. The suggestions on how to install dependencies from ports is excellent, for example.

tiato’s picture

Thanks anarcat, you are correct quite a few of those values were specific to my environment however having /usr/local/bin within PATH does not eliminate the need for passing --php inside BSD. I will play with this however and see if I cannot find a way to get the environemnt to pass the proper PHP values through '/usr/bin/env'

It is worth mentioning it might even work better if using envvars instead: /usr/local/sbin/envvars

I will continue to refine this script but make note that setting /usr/local/bin/php in PATH does not guarantee that drush will be able to see php without --php being set while using BSD

tiato’s picture

StatusFileSize
new3.94 KB

I have modified install notes for FreeBSD, this is part 1 to prep system, should finish full install instructions later today. Still working out some kinks to make the install on bsd smoother with less hassle, this will get dependencies installed

Annakan’s picture

Hello
I am also working on freeBSD
I did not know of the HINTS_XXX.txt files that are a great idea I am willing to contribute to it, I probably need to master git before being useful.

We could gather there the cron specifics and maybe build a more BSD like architecture using /usr/local and such.
I am still crafting my "perfect" directory structure each time I have to come back to aegir. I postponed finalizing it till I have the time to get to aegir-HEAD and switch to the new git-based process.
My use of Aegir might be a bit specific since I use it more to manage staging that "mass deployment". I have a few site but I want to use Aegir to have a better work-flow from dev to production and have a single point of control.

@tiato
I don't need to specify the --php in my cron, or batch jobs even if FULL path are imperative in cron command lines. So maybe is there something specific about your or my installation and we should work it out before posting a "reference"

PS: I would gladly trade time after death with time before death. ;)

tiato’s picture

StatusFileSize
new6.66 KB

I am in full support of this idea. I was actually considering putting together a port so the entire aegir system could be installed via portsnap. I am with you, I have been trying to find the "perfect" install for BSD and aegir, I think I have found the cleanest method, which makes sense to me.

In regards to contribute, I am not building this on repos as I do not have access, just tossing together a HINTS file, by all means update and attach, the end result should be something the project team can use

In regards to directory structure, I opted away from /var/aegir to use a more logical approach:

/www/aegir
/www/aegir/config
/www/aegir/backups
/www/aegir/platforms
/www/aegir/hostmaster-HEAD **to keep default aegir platform seperate from publication platforms

I am very interested how you are managing to avoid the use of --php, it's been my one peeve through the process, I am using Production Release 7.2 myself and the php interpreter works but if I do not specify the path it fails with "Cannot find PHP interpreter" errors. I am more than willing to work with you on figuring out whether this is specific to my installation, it is worth mentioning my bsd is configured to house encrypted jail environments, I was wondering if maybe this could have something to do with it.

I am posting an updated copy, still need to piece together common issues as I have not completely seperated what is common for BSD and what was special to my install, maybe you can help me with this?

tiato’s picture

Attempting to install:
aegir version=HEAD
drush version=2.1
freebsd version=production release 7.2

when curl is enabled php receives segmentation faults:

PHP 5.2.11 with Suhosin-Patch 0.9.7 (cli) (built: Dec 17 2009 12:17:18)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
Segmentation fault (core dumped)

if trying to compile aegir via install script it will result in a segfault error:

Saving to: `drush-All-Versions-2.1.tar.gz'

100%[====================================================================================================================>] 80,209       180K/s   in 0.4s

2010-01-02 23:24:14 (180 KB/s) - `drush-All-Versions-2.1.tar.gz' saved [80209/80209]

./install.sh: line 150:  2929 Segmentation fault: 11  (core dumped) $DRUSH help > /dev/null
==> Drush is broken (php /www/aegir/drush/drush.php --debug --php=/usr/local/bin/php help failed)

if curl is disabled it will proceed only a little further but drush is broken because curl is a dependence:

Undefined index:  root [0.028 sec]                                      [notice]
Running: /usr/local/bin/php /www/aegir/drush/drush.php   'make'        [command]
'/rest/aegir/.drush/provision/aegir.make'
'/www/aegir/hostmaster-HEAD' --backend [0.029 sec]
Undefined variable: context [0.029 sec]                                 [notice]
Undefined variable: string [0.086 sec]                                  [notice]
ob_flush(): failed to flush buffer. No buffer to flush. [0.086 sec]     [notice]
ob_flush(): failed to flush buffer. No buffer to flush. [0.087 sec]     [notice]
ob_flush(): failed to flush buffer. No buffer to flush. [0.087 sec]     [notice]
The external command could not be executed due to an application     [error]
error. [0.087 sec]
Drush bootstrap phase : _drush_bootstrap_drush() [0.087 sec]         [bootstrap]
Found command: make [0.087 sec]                                      [bootstrap]
Initializing drush commandfile: drush_make [0.087 sec]               [bootstrap]
Initializing drush commandfile: drush_make_d_o [0.087 sec]           [bootstrap]
Initializing drush commandfile: provision_apache [0.087 sec]         [bootstrap]
Initializing drush commandfile: provision_drupal [0.087 sec]         [bootstrap]
Initializing drush commandfile: provision_mysql [0.087 sec]          [bootstrap]
Created directory temporary directory                                   [notice]
/var/tmp//drush_make_tmp_1262496027 [0.087 sec]
Drush command could not be completed. [0.087 sec]                    [error]
Output from failed command :                                         [error]

Fatal error: Call to undefined function curl_init() in
/rest/aegir/.drush/drush_make/drush_make.utilities.inc on line 354
 [0.087 sec]
An error occurred at function : drush_provision_hostmaster_make      [error]
[0.087 sec]
Command dispatch complete [0.087 sec]                                   [notice]

it seems the issue is actually in the latest port of libxml2 found:
$ cd /usr/ports/textproc/libxml2

this can be fixed by editing the 'patch-configure' file found:
$ vi /usr/ports/textproc/libxml2/files/patch-configure

and removing the lines:

@@ -20665,6 +20666,8 @@
               fi
           fi
        ;;
+       *freebsd*) THREAD_LIBS=""
+       ;;
     esac
     if test "$WITH_THREADS" = "1" ; then
        THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"

rebuild and reinstall libxml2:
$ make deinstall
$ make clean
$ make install

drush 2.1 installed successfully with this

anarcat’s picture

Can you make the install notes more concise? Things like instructions on how to install Suhosin and so on are not required for Aegir. You should specify the absolute minimum requirements: admins decide on the policy they want by themselves.

Putting too much information in here will make the document harder to maintain.

Anonymous’s picture

Status: Needs work » Closed (won't fix)

This can just go into the community.aegirproject.org site without via the issue queue if it ever gets another look.