[CentOS-docs] Doc for the Wiki

Wed Apr 9 11:01:49 UTC 2008
Chris Mauritz <chris.mauritz at gmail.com>

Daniel de Kok wrote:
> On Wed, Apr 9, 2008 at 12:00 AM, Chris Mauritz <chris.mauritz at gmail.com> wrote:
>> I've modified/updated an existing HowTo (for RHEL) I found on the net
>> detailing how to install the following on a "virgin" CentOS 5.1 install:
> Can the original HOWTO can be redistributed, preferably under the
> Creative Commons Attribution-Share Alike 3.0 license?

I don't know.  I've included a link to the original (which itself seems 
to be a "refresher" of yet another person's version) in the doc.  I only 
made enough relatively minor changes to account for the fact that it's 
CentOS (instead of RHEL) and updated the versions of the bits to be the 
latest as of yesterday.

Here it is:

= Install Plone on CentOS 5.1 =

This process will help you build a usable Zope 2.10.5/Plone 3.0.6 
install on Centos 5.1 for development purposes. The Zope instance will 
be created in a production-like environment.

These instructions will provide you with the following software:

  * Python 2.4.5
  * Python Imaging Library 1.1.6
  * Zope 2.10.5
  * Plone 3.0.6

These instructions were adapted/edited/updated from the excellent 
instructions at 
  The installation was performed on a "virgin" 5.1 install with all the 
latest updates as of April 08, 2008.

== Step 1: Development Tools ==

We can use yum to install some of the prerequisites in advance.  It 
would be nice if someone packaged up more modern incarnations of Plone, 
Zope, and Python 2.4.5 (that lives in /usr/local so it doesn't break a 
lot of the tools that ship with CentOS) if anyone feels the urge.  A 
typical package install from cli is 'yum install <package-name> 
[optional version-number]'.

If you're starting with a stock CentOS install, make sure the 
development tools are installed. A quick way to test this is to open a 
terminal window and type:

     $ gcc

...will yield a response something like this if development tools are 

    gcc: no input files

...or, if development tools are not installed, the response will be...

    -bash gcc: command not found

You'll need to install the developer package RPMs from your installation 
CDs or via yum before continuing. Installing the following packages via 
RPM should get you going:

  * gcc
  * gcc-c++

These two packages will install several others on which they depend.

PIL (Python Imaging Library) has a few prerequisites.

  * zlib
  * zlib-devel
  * libjpeg
  * libjpeg-devel
  * freetype
  * freetype-devel

Make sure these packages are installed on your system (via 'yum list 
zlib zlib-devel libjpeg libjpeg-devel freetype freetype-devel'). If 
they're missing, you can install them via 'sudo yum install 
<package-name>'. If you selected the Development option when installing 
CentOS they should already be installed.

== Step 2: Python version ==

Upgrading Python will be our first task. CentOS5 ships with Python 
2.4.3.  WARNING: Redhat uses Python for many of their system management 
tools (including yum) so CentOS does too.  As a result, you want to make 
sure you don't overwrite the existing Python installation.

The best method as of this writing is to install Python 2.4.5 from 
source. While RPMs for Python are available from the 
[http://www.python.org/download/releases/2.4/rpms Python Web site], 
these RPMs are a bit dated, and may contain bugs and security 

Change your directory to your preferred download directory. We'll use 
/usr/local/src for this procedure.

     $ cd /usr/local/src

Download the archive file.

     $ sudo curl -v -O 

Unpack the source archive (.tgz).

     $ sudo tar -zxvf Python-2.4.5.tgz

Change directory into the Python-2.4.5 directory:

     $ cd Python-2.4.5

Run the typical configure/make/make install sequence.

     $ sudo ./configure

(By default, Python will configure installation in /usr/local. This 
should be sufficient to keep it from conflicting with your existing 
stock Python installation. If you want the Python 2.4 files to live 
somewhere else, use the --prefix directive to configure  - this is left 
as an exercise to the reader).

If the configuration step completes successfully, type:

    $ sudo make

This will compile the C source code to the Python interpreter and all of 
the Python libraries into the form needed to run it on this system.

When the 'make' command completes, install the files to your file 
system. NOTE: If you're installing Python to a central directory (like 
/usr/local as in the default case), you'll need to do this as the 
superuser, as non-privileged users can't generally write to that part of 
the filesystem. The install command is:

     $ sudo make altinstall

WARNING: If just do 'make install', the default install will place a 
copy of the Python 2.4.5 interpreter at /usr/local/bin/python. If 
/usr/local/bin is in your path ahead of /usr/bin, any Python programs 
you run (such as CentOS utilities) will be run using the new Python, and 
not the one packaged with CentOS. This may cause various CentOS scripts 
and utilities to misbehave. One way to fix this would be to remove the 
file '/usr/local/bin/python', or replace it with a symlink to the stock 
system Python ('/usr/bin/python' on RHEL). For our purposes, we will 
always run the new python via the command '/usr/local/bin/python2.4'

Check your installation:

     $ whereis python2

This should return three python symlinks in bin directories:

     python2: '''/usr/bin/python2.4 /usr/bin/python2''' 
/usr/lib/python2.4 '''/usr/local/bin/python2.4''' 
/usr/local/lib/python2.4 /usr/include/python2.4

Check your original Python installation:

     $ python2.4

     Python 2.4.3 (#1, Dec 11 2006, 11:39:03) [[BR]][GCC 4.1.1 20061130 
(Red Hat 4.1.1-43)] on linux2[[BR]]Type "help", "copyright", "credits" 
or "license" for more information.[[BR]]>>>

Now the new installation:

     $ /usr/local/bin/python2.4

     Python 2.4.5 (#1, Aug 15 2007, 11:20:46) [[BR]][GCC 4.1.1 20070105 
(Red Hat 4.1.1-52)] on linux2[[BR]]Type "help", "copyright", "credits" 
or "license" for more information.[[BR]]>>>

== Step 3: Python Imaging Library (PIL) ==

Change your directory to your preferred download directory (as above).

     $ cd /usr/local/src

Download the archive file.

     $ sudo curl -v -O 

Restore the files from the archive.

     $ sudo tar -zxvf Imaging-1.1.6.tar.gz

Change your current directory to the new directory created after the 
previous step.

     $ cd Imaging-1.1.6

Build PIL with your new Python 2.4 install.

     $ sudo /usr/local/bin/python2.4 setup.py build_ext -i

Run the selftest script.

     $ /usr/local/bin/python2.4 selftest.py

If all tests pass, go ahead and install this in your Python 2.4 
installation. '''Note:''' As with Python above, you may need to use 
''sudo'' to install to a central system location.

     $ sudo /usr/local/bin/python2.4 setup.py install

== Step 4: Install Zope ==

Change your directory to your preferred download directory (as above).

     $ cd /usr/local/src

Download the archive file.

     $ sudo curl -v -O 

Restore the files from the archive.

     $ sudo tar -zxvf Zope-2.10.5-final.tgz

Change your current directory to the new directory created after the 
previous step.

     $ cd Zope-2.10.5-final

Run the typical configure/make install command sequence.

     $ sudo ./configure --with-python=/usr/local/bin/python2.4 

     $ sudo make install

The directory specified by the --with-python option is the directory 
into which we installed Python in Step 2. The directory specified by the 
--prefix option is the location to which the Zope binaries will be 
installed. For a production system, this could be /opt/zope or 
/home/zope, personally I use the same - /usr/local/lib as this is a 
stable build of Zope.

Make an instance of Zope

     $ sudo /usr/local/lib/zope-2.10.5-final/bin/mkzopeinstance.py -d 

The directory specified by the -d is the location to which the Zope 
Instance will be installed. For a production system, this could be 
something like /home/zope/plone3 if you plan on running it from a user 
account, personally I used /usr/local/data/.

== Step 5: Install Plone 3.0.6 ==

Plone is an add-on product for Zope. It does not require compiling. Just 
restore the files from the archive file and drop the resulting directory 
into Zope's Products directory.

     $ cd /usr/local/src

     $ sudo curl -v -O 

     $ sudo tar -zxvf Plone-3.0.6.tar.gz

     $ cd Plone-3.0.6

     $ sudo cp -R lib /usr/local/data/zope-2.10.5-test/

     $ sudo cp -R Products /usr/local/data/zope-2.10.5-test/

Next configure your Instance's zope.conf.

     $ sudo vim /usr/local/data/zope-2.10.5-test/etc/zope.conf

Set your configuration flags. In a test environment I set the following:

     debug-mode on [[BR]]effective-user <some non-privileged user 
account> [[BR]]http-realm <something> 
[[BR]]security-policy-implementation python [[BR]]verbose-security on 
[[BR]]port-base <if changing from default - this ADDS to all port 
numbers specified> [[BR]]

Give the effective-user ownership of <zope-instance>/var and 

     $ sudo chown -R <effective-user>:<effective-user group> 

     $ sudo chown -R ,effective-user>:<effective-user group> 

== Step 6: Test Your Installation ==

In the terminal:

     $ sudo /usr/local/data/zope-2.10.5-test/bin/zopectl debug

Watch for errors when starting up. You will probably see plenty of 
Deprecation Warnings but abort errors are what concerns you at this 
point. If you come to a Python prompt without any show stoppers Ctl-D 
out of debug mode and start Zope normally.

     $ sudo /usr/local/data/zope-2.10.5-test/bin/zopectl start

In your browser, enter this into the address bar: 
http://localhost:<port>/. The Zope Quick Start page should appear.

'''Note:''' If the system-level firewall is activated, the port will not 
be accessible to outside systems. This might be a good thing (see 
SecureZope), or it might not, depending on your needs. To access the 
ZopeManagementInterface, you'll need to do it from the local machine 
(directly or using an SshTunnel) or modify your firewall rules to allow 
traffic to this port.