Şuraya atla: kullan, ara

If you're setting up a production-quality site using Zope, it's not a good idea to use *any* Python provided by the distribution. Building your own will allow you to retain the control you need to guarantee your site's well-being.

This how-to has been tested with Zope 2.9 on a SuSe 9.3 Professional.

Python 2.4.2 installation

Zope 2.9 requires Python 2.4.2 (Python 2.4.1 is still acceptable). Older Python versions are no longer supported.

You should: - download Python-2.4.2 - import the release manager public keys by downloading the public key from the python web site and then running % gpg --import pubkeys.txt

On the version-specific download pages, you should see a link to both the downloadable file and a detached signature file. To verify the authenticity of the download, grab both files and then run this command: % gpg --verify Python-2.4.tar.bz2.asc

Note that you must use the name of the signature file, and you should use the one that's appropriate to the download you're verifying.

- Then: tar -zxvf Python-2.4.2.tgz

- don't forget to install first zlib and zlib-devel

- ./configure --prefix=/usr/local/python-242 (put wherever you want)

- make

- ‘make install’ would install all platform-independent files in subdirectories of the directory given with the --prefix option to configure or to the `prefix' Make variable (default /usr/local, If DESTDIR is set, it will be taken as the root directory of the installation, and files will be installed into $(DESTDIR)$(prefix), $(DESTDIR)$(exec_prefix), etc…). All binary and other platform-specific files will be installed in subdirectories if the directory given by --exec-prefix or the `exec_prefix' Make variable (defaults to the --prefix directory) is given. All subdirectories created will have Python's version number in their name, e.g. the library modules are installed in "/usr/local/lib/python<version>/" by default, where <version> is the <major>.<minor> release number (e.g. "2.1"). The Python binary is installed as "python<version>" and a hard link named "python" is created. The only file not installed with a version number in its name is the manual page, installed as "/usr/local/man/man1/python.1" by default. As we have a previous installation of Python that we don't want to replace, we use make altinstall This installs the same set of files as "make install" except it doesn't create the hard link to "python<version>" named "python" and it doesn't install the manual page at all.

Zope 2.9.1 installation

- To build zope with the python interpreter we just installed: ./configure --with-python /usr/local/python-242/bin/python2.4

The default installation directory for Zope is ``/usr/local/Zope-<version>``, where ``<version>`` is replaced with the version of Zope you're installing; it will match the version number from the compressed tarball you unpacked. To change the installation directory, use the ``--prefix`` option to specify an alternate location.

- make

- to install Zope: make install

- to create a Zope Instance Home

Once you've performed the install step, to begin actually using Zope, you will need to create an "instance home", which is a directory that contains configuration and data for a Zope server process. The instance home is created using the 'mkzopeinstance.py' script::

your_host:/usr/local/Zope-2.9.1/bin # ./mkzopeinstance.py -d /usr/local/path_to_your_instance -u myuser:mypasswd

- to start Zope

Create the zope user, used to run zope Create the zope group, chown zope.zope on the zope instance’s folder and chmod g+w on the Extensions and import folders.

Once an instance home has been created, the Zope server can be started using this command:

/location/of/zope/instance/bin/zopectl start

- Zope’s automatic start and stop:

Create the necessary zope-myinstance file (see below) in /etc/init.d and ‘insserv –d zope-myinstance’.

/etc/init.d/zope-myinstance file content:

# This shell script takes care of starting and stopping zope
# description: zope is a web application server, which can be used
# standalone or in conjunction with Apache

# Provides:             Solicomm's zope-test instance
# Required-Start:       $local_fs $network apache2
# Required-Stop:        $local_fs $network apache2
# Default-Start:        3 5
# Default-Stop:         0 1 2 6
# Short-Description:    Solicomm's Zope's instance
# Description:          Solicomm's Zope's instance


# See how we were called.
case "$1" in
start) # Start daemons.
   echo -n "Starting zope-myinstance: "
   su - zope -c '/usr/local/zope-myinstance/bin/zopectl start'
stop) # Stop daemons.
   echo -n "Shutting down zope-myinstance: "
   su - zope -c '/usr/local/zope-myinstance/bin/zopectl stop'
   $0 stop
   $0 start
   echo "Usage: zope-solicomm {start|stop|restart}"
   exit 1

exit $RETVAL 

As you can see from the init.d file, I put apache as a required service to zope start: that's because, normally I've several instances of zope running on the same server and I defined virtual hosts on apache to serve those zope instances. Let me you, should be interested in that kind of set-up, i.e to configure the required rewrite rules in apache's virtual hosts.

Comments are welcomed

edit by: Lawrence Ferreira 14:26, 23 May 2006 (UTC)
better init script visualization