Friday, August 28, 2009

Installing Plone on Ubuntu 9.04 Jaunty / 9.10 Karmic (using buildout)

(modified Mar. 19, 2010: add note about UnifiedInstaller, link to this script at plone.org)
(modified Jan. 11, 2010: added script header, put plone's buildout dir in a variable)
(modified Jan. 08, 2010: PIL as egg in buildout)
(modified Oct. 30, 2009: use http://dist.plone.org/thirdparty/)

Note: the recommended way for beginners to set up a Plone site is to use the installers, available from plone.org. Simply download and unpack the .tgz file, and read the README for what to to next. Most likely all you'll want to do at first is go into the unpacked directory (Plone-x.x.x-UnifiedInstaller) and run ./install.sh standalone. This will install a Plone folder in your homedir. Go over there, into the zinstance folder, run ./bin/instance fg and you're on your way.

Below is a more do-it-yourself approach, it's probably interesting to developers and maintainers only. The information below will be updated at plone.org.


#!/bin/bash
# install_plone_3_on_ubuntu.sh
#
# A quickstart guide to install Plone 3 on your Ubuntu system.

# 1) Plone <4 only works with Python 2.4.
sudo apt-get install python2.4

# 2a) Get setuptools / easy_install for python 2.4
#wget http://peak.telecommunity.com/dist/ez_setup.py
#sudo python2.4 ez_setup.py -U setuptools
#
# 2b) As an alternative to Setuptools, you may want to consider using
# Distribute (http://pypi.python.org/pypi/distribute/) instead.
# The Plone community nowadays tends to use Distribute.
wget http://python-distribute.org/distribute_setup.py
sudo python2.4 distribute_setup.py

# 3) Get ZopeSkel paster scripts
sudo easy_install-2.4 ZopeSkel

# 4.1) Create a buildout.
PLONEDIR='myplonebuildout'
paster create -t plone3_buildout $PLONEDIR plone_version=3.3.3 zope2_install='' plone_products_install='' zope_user=admin zope_password=admin http_port=8080 debug_mode=off verbose_security=off
# See http://dist.plone.org/release/ for available releases.
# You might also do
# paster create -t plone3_buildout
# to get a dialog prompting you for the variables.
cd $PLONEDIR
# Run bootstrap, this will create the bin/ directory
python2.4 bootstrap.py
#
# 4.2) Install header files
# You need to have python header files installed in order to build Zope.
sudo apt-get install python2.4-dev
#
# We may need these header files to build PIL (see below).
# Without the header files, you might see this after running buildout:
# --------------------------------------------------------------------
# *** TKINTER support not available
# *** JPEG support not available
# --- ZLIB (PNG/ZIP) support ok
# *** FREETYPE2 support not available
# --------------------------------------------------------------------
# This means you'll get errors like these for uploaded JPEG images:
# IOError: decoder jpeg not available
# and you won't be able to see previews of these images, or modify them.
sudo apt-get install libjpeg-dev libfreetype6-dev
# Now you'll see
# --------------------------------------------------------------------
# *** TKINTER support not available
# --- JPEG support ok
# --- ZLIB (PNG/ZIP) support ok
# --- FREETYPE2 support ok
# --------------------------------------------------------------------

# 4.3) Run buildout.
./bin/buildout
# (See http://www.netsight.co.uk/junk/xkcd-buildout.png.)

# 5a) For running the code, we need the Python imaging module (PIL), which is
# no longer packaged for Python 2.4 since Ubuntu 9.04 (Jaunty Jackalope).
wget http://dist.plone.org/thirdparty/PILwoTk-1.1.6.4.tar.gz
sudo easy_install-2.4 PILwoTk-1.1.6.4.tar.gz
#
# 5b) As an alternative, you may also do as Alex Clarke suggests on
# http://blog.aclark.net/?p=31, and add this to your buildout.cfg:
# [buildout]
# find-links +=
# find-links = http://dist.plone.org/thirdparty/PILwoTk-1.1.6.4.tar.gz
# [instance]
# eggs +=
# PILwoTk
# This means you don't have to install PILwoTk system-wide, which is nice.
# However, you still have to install the header files on your system!

# 6) Start Plone!
./bin/instance fg

No comments: