Tony's Site

Running Zope on Debian Squeeze


I currently run a number of small websites using Zope2 on Debian Lenny. Until now I have always used the standard packages within Debian and the Zope administration tools Debian provides. I have recently found out that in the next Debian release (squeeze) Zope2 will not be supported.

As a result I have been experimenting how to set up and install Zope2 without the standard packages. The following documents my progress to date. As well as Zope2 I use:

I find the decision quite disappointing. On a personal note it means I have to manage these packages without the support of Debian packaging tools and, more importantly, security support. This assumes I can get them working at all. More generally, I'm concerned how we can encourage people to adopt Free Software when the tools that they rely on may suddenly be abandoned. It is sad that the Debian and Zope developers can't work together. Whilst I like Zope and Silva I will be considering alternatives such as Django and it is unlikely that I would use Zope if starting from scratch today.

Basic Zope Installation

This is based upon these Zope installation instructions.

First create a user to run Zope and a folder to contain the files.

adduser --disabled-login zope
mkdir /var/local/zope
chown zope:zope /var/local/zope

Make sure some prerequisites are installed.

aptitude install gcc python2.6 python2.6-dev python-virtualenv

Now as the Zope user create an environment, download Zope and create an instance. Change version numbers as appropriate.

su - zope
cd /var/local/zope
virtualenv -p python2.6 --no-site-packages zope2.12
cd zope2.12
bin/easy_install-2.6 -i Zope2

Then create a new Zope instance. When prompted for a folder, don't specify the same as above. I use /var/local/zope/sites.

cd /var/local/zope/zope2.12

Check the configuration in eg /var/local/zope/sites/etc/zope.conf. At this stage I suggest you only change the port number if the default, 8080, is used already. The server can now be started in foreground mode by

/var/local/zope/sites/bin/zopectl fg

You should then see the server start, or alternately crash with errors. If OK you can connect to the appropriate port with your browser.


To use MySQL within Zope you need a couple of packages. MySQL-python, as you might expect, provides access to MySQL from Python. ZMySQLDA provides access from within Zope and depends on the first. I used this source of Python packages. In most cases installation can be done using easy_install quoting the package name. However this did not work for MySQL-python as the default package appears to depend on MySQL 5.0 whilst squeeze has 5.1. To get round this you have to make easy_install compile from the .tar.gz.

Firstly, as root, install some more prerequisites.

aptitude install mysql-client mysql-server libmysqlclient-dev

Then create a test database and populate.

Then install the packages, changing version numbers as necessary.

su - zope
cd /var/local/zope/zope2.12
bin/easy_install-2.6 Products.ZMySQLDA

You should then be able to start in foreground mode again as above. If you get no serious errors you should now be able to log into the Zope console and create "Z MySQL Database Connection" and "Z SQL Method" objects accessing your test database.


Similar to MySQL you need to install two packages, a generic python LDAP package and then a Zope one. First, as root, install the prerequisites.

aptitude install libldap2-dev libsasl2-dev libssl-dev

Then as the Zope user install the packages.

su - zope
cd /var/local/zope/zope2.12
bin/easy_install-2.6 python-ldap
bin/easy_install-2.6 Products.LDAPUserFolder

You should then be able to start Zope, create an "LDAPUserFolder" object and configure to access your LDAP server.


It appears that Silva does not support this combination of Zope/Python. I will have to wait for the next release before I can try this.


My current live service runs on Zope 2.10. Once I had got the basics working I copied across the live Data.fs file to my test service and also migrated my MySQL database. Once I had also copied one or two packages I had written everything worked fine bar the following two problems.

A couple of my scripts had £ signs in string literals. At Python 2.4 this raised a warning but things still worked. At Python 2.6 this failed. Having read various things on the Internet I don't fully understand this but replacing £ by \xa3 seems to have the desired effect.

One of my sites uses the Python Imaging Library (PIL). The default install using easy_install doesn't work correctly; this is a known problem referred to a number of times on the web. The following worked for me:


I also hit a Zope bug but its unlikely this will affect many others.

Running as a Service

First, create a link from /etc/init.d to your zopectl script then have this script run at boot. eg

cd /etc/init.d
ln -s /var/local/zope/sites/bin/zopectl zope212
update-rc.d zope212 defaults

However, when you run Zope this way you may receive errors such as:

The following error occurred while trying to extract file(s) to the Python egg cache:

[Errno 13] Permission denied: '/root/.python-eggs'

The Python egg cache directory is currently set to:


This is a known Zope problem. You need to edit the zopectl file and add the following before the exec line


Things should then work quite happily.