onsdag den 30. januar 2008

Installing Python, Zope and Plone on Ubuntu 7.10 - Gutsy Gibbon

Last time I installed plone on a Ubuntu system, I wrote a log of what I did. It might be that I am getting old, but I cannot seem to remember how I do it from time to time. So this is as much a note to future me as a help to others.

It is a newer version of this article on my main site.

http://www.mxm.dk/papers/installing-plone

With a little luck you should be able to run it as a script on your own server, or at least copy/paste the lines into your terminal, and the see where it fails.

####################################
# System installs, libraries etc.

# Installing python and plone on ubuntu server 7.10 Gutsy Gibbon
# much of it can probably be used on any debian system.

sudo bash
# as root: install system packages and libraries for compiling python
aptitude install gcc g++ make

# readline is needed for an interactive python prompt
aptitude install libreadline5 libreadline5-dev

# zlib is needed for zope & PIL
aptitude install zlib1g zlib1g-dev

# libjpeg is neded for PIL
aptitude install libjpeg62 libjpeg62-dev

# libssl is needed by buildout for downloading with the https protocol
aptitude install libssl0.9.8 libssl-dev

# create a user called zope.
adduser zope



####################################
# zope, plone specific install

# Do the rest as this user
su zope
# from the users home dir /home/zope
cd ~
# create the directory structure
mkdir downloads
mkdir pythons
mkdir instances

# download and install python in the zope users home dirs pythons directory
cd ~/downloads
wget http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tgz
tar xzf Python-2.4.4.tgz
cd Python-2.4.4
./configure --prefix=/home/zope/pythons/python-2.4.4
make
make altinstall

# make a symbolic link for this python. This is optional. But you avoid having
# to type "python2.4" instead of "python"
ln -s /home/zope/pythons/python-2.4.4/bin/python2.4 /home/zope/pythons/python-2.4.4/bin/python
# make this the default python to use by pushing it to the front of the path with this command
PATH=/home/zope/pythons/python-2.4.4/bin:$PATH
# you can add the command to the zope users ~/.bashrc
# to automatically use that python at login. I normally do this.

# download and install PIL
cd ~/downloads
wget http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
tar xfz Imaging-1.1.6.tar.gz
cd Imaging-1.1.6
python setup.py build
python setup.py install

# download and install easy install
cd ~/downloads
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py

# create a default buildout config file. This way your eggs and downloads will
# automatically end up in the same dir.
mkdir ~/.buildout
vi ~/.buildout/default.cfg

# insert this text (without the "## ") and save
## [buildout]
## executable = /home/zope/pythons/python-2.4.4/bin/python2.4
## eggs-directory = /home/zope/.buildout/eggs
## download-directory = /home/zope/.buildout/downloads

# then install ZopeSkel with easy install
easy_install -U ZopeSkel

# you can see what buildouts can be created with this command
paster create --list-templates

# as I write this, the list looks like this.
#Available templates:
# archetype: A Plone project that uses Archetypes
# basic_namespace: A project with a namespace package
# basic_package: A basic setuptools-enabled package
# basic_zope: A Zope project
# nested_namespace: A project with two nested namespaces.
# paste_deploy: A web application deployed through paste.deploy
# plone: A Plone project
# plone2.5_buildout: A buildout for Plone 2.5 projects
# plone2.5_theme: A Theme for Plone 2.5
# plone2_theme: A Theme Product for Plone 2.1 & Plone 2.5
# plone3_buildout: A buildout for Plone 3 projects
# plone3_portlet: A Plone 3 portlet
# plone3_theme: A Theme for Plone 3.0
# plone_app: A Plone App project
# plone_hosting: Plone hosting: buildout with ZEO and any Plone version
# recipe: A recipe project for zc.buildout

# so to create a plone 3 server you write

cd ~/instances
paster create -t plone3_buildout p3test

# It asks a few questions. If you are in doubt just press enter for default values.
# now run the bootstrap script

cd p3test
python bootstrap.py

# at this point you should check out builout documentation for your options,
# if you want to run anything but a plane plone site.
# you can edit you buildout.cfg file in p3test. There is a good intro at:
# http://plone.org/documentation/tutorial/buildout/understanding-buildout.cfg

# now let buildout install and compile Plone. Zope will be compiled automatically.

./bin/buildout -v

# then start up and test the site with
./bin/instance fg

Good luck!

8 kommentarer:

KhayyamAltair sagde ...
Denne kommentar er fjernet af forfatteren.
Max M sagde ...

Seems like: "easy_install pyopenssl" is handy to know too, if anything in a buildout is behind https.

Max M sagde ...

I just tried this in ubuntu 9.10 and it seems you need to do

"apt-get install tk8.4-dev tcl8.4-dev"

As root naturally.

The latest python version was also 2.4.6.

Otherwise it ran fine.

Max M sagde ...

It can also be necessary to add PILwoTK ot PIL to the eggs in your buildout.cfg

Artemio Estrella sagde ...

Hi,

I has tried install Zope 2.11 on Ubuntu 910. The steps are:

sudo aptitude install zope2.11
sudo /usr/lib/zope2.11/bin/mkzopeinstance.py

the instance directory that I selected is:

/var/lib/zope2.11/instance/westy

but, in the moment that I tried restart the zope service, the instance westy not work, and show this:

zope 2.11 instance westy fail

It had problem with zope and Ubuntu 910?

Max M sagde ...

Hi Artemio,

I know you can use package managers for this. But I do not use the system Python ever for installing Zope/Plone. You simply have too little control over it.

Max M sagde ...

I tried compiling Python 2.3.7 on Ubuntu 9.10 using gcc 4.4.1 and got this error:

Aborted
make: *** [sharedmods] Error 134

To remove cruft I ran

make distclean

and added BASECFLAGS=-U_FORTIFY_SOURCE to configure:

so:


make distclean
./configure --prefix=/home/maxm/pythons/python-2.3.6 BASECFLAGS=-U_FORTIFY_SOURCE
make
make install


That worked.

Max M sagde ...

These can also be handy in some cases:

apt-get install libxslt-dev

apt-get install python-lxml