Monday, July 28, 2008

Installing Plone 2.5 on Ubuntu 8.04 Hardy

I created this script hoping someday it might save me a lot of time installing a development environment for Plone on Ubuntu. (The unified installer has its shortcomings for a development environment.)
I haven't tested if it runs all the way, I'll test that when i have to install a new box. In the meantime, i hope it will be of use as a kind of cookbook.
Update 2008/08/17: It's much easier if you use the Ubuntu python2.4 package, but you'll have to install python2.4-dev as well (in order to compile Zope)!
# install_plone.sh
# An installer for Zope and Plone on Ubuntu 8.04 Hardy

# Author: Kees Hink
# Date: 17 August 2008

# A cookbook list on how to install a Zope+Plone development
# environment on a vanilla Ubuntu 8.04 (Hardy Heron) system.

# The development environment consists of a Zope software
# environment in the user's homedir, with an Zope instance
# created in it. A separate folder for Zope/Plone products is
# also created in the user's homedir.
# It's easy to add new instances, make them run on different
# ports, symlink to various products (or versions of products)
# in the products directory, use different Data.fs files.
# You can also install additional Python modules in a single
# instance by using workingenv: see
# http://plone.org/documentation/how-to/zope-python-packages-using-easy_install
# I find this a suitable setup for development.

# Echo executed commands and shell input lines
set -x
set -v

# Some directories for downloading and installing.
# (You may want to remove these when you're done.)
DOWNLOAD_DIR=~/downloads
BUILDS_DIR=~/builddirs
# Basic Plone products (CMFPlone, etc.) go here. (This is also a
# good place to put other Zope/Plone products later on.)
MY_PRODUCTS_DIR=~/products
# Zope software (2.9.9 is currently the latest Zope, but 2.9.8
# is most used in Plone sites)
ZOPE_TARBALLDIR=http://www.zope.org/Products/Zope/2.9.9
ZOPE_TARBALL=Zope-2.9.9-final.tgz
ZOPE_WGET_ADDRESS=$ZOPE_TARBALLDIR/$ZOPE_TARBALL
ZOPE_BUILDDIR=$BUILDS_DIR/Zope-2.9.9-final
# Where do you want your Zope software to live?
SOFTWARE_HOME=~/zope-2.9.9
# Plone software
PLONE_TARBALL_DIR=https://launchpadlibrarian.net/10741323
PLONE_TARBALL=Plone-2.5.5.tar.gz
PLONE_VERSION=Plone-2.5.5
PLONE_WGET_ADDRESS=$PLONE_TARBALL_DIR/$PLONE_TARBALL
# What do you want your Zope instance to be called?
INSTANCE_HOME=$SOFTWARE_HOME/Plone
# Zope instance admin user username/password
ROOT_LOGIN='admin'
ROOT_PASSWORD='admin'

# Preliminaries
sudo apt-get install g++
mkdir $BUILDS_DIR $DOWNLOAD_DIR $MY_PRODUCTS_DIR

# Install Python 2.4
sudo apt-get install python2.4
sudo apt-get install python2.4-dev
sudo apt-get install python2.4-elementtree
# PIL and libxml2 come standard with python2.4.
# python-2.4-dev is needed for compiling Zope.

# You may want to verify that you can now start python2.4,
# and import the modules PIL, elementtree and libxml2.

# Get and install Zope 2.9
wget $ZOPE_WGET_ADDRESS -P $DOWNLOAD_DIR
tar -xzf $DOWNLOAD_DIR/$ZOPE_TARBALL -C $BUILDS_DIR
cd $ZOPE_BUILDDIR
./configure --prefix=$SOFTWARE_HOME
make
make install
# Create a Zope instance
$SOFTWARE_HOME/bin/mkzopeinstance.py -d $INSTANCE_HOME -u $ROOT_LOGIN:$ROOT_PASSWORD

# You may now start your Zope instance by doing:
# $INSTANCE_HOME/bin/runzope
# You should now be able to connect to localhost:8080 and access
# the ZMI.

# Get and install Plone 2.5
wget $PLONE_WGET_ADDRESS -P $DOWNLOAD_DIR
# Extract Plone products to your own products folder
tar -xzf $DOWNLOAD_DIR/$PLONE_TARBALL -C $MY_PRODUCTS_DIR
# Turn your Zope instance into a Plone site by creating symlinks
# to Plone products
for i in $MY_PRODUCTS_DIR/$PLONE_VERSION/*;
do echo $i;
ln -s $i $INSTANCE_HOME/Products/;
done

# If you (re)start Zope, you should now be able to add a Plone
# site from the ZMI.