How-To Install Python and Zope with INSTANCE_HOME on SuSE 8.0 Linux
Version 1.1, 2002/08/05, Status: Final (Included comments by Guido Wesdorp and other guys from Infrae, Rotterdam) Version 1.0, 2002/07/22, Status: Final (Original version) Valid for: SuSE 8.0, Python 2.1.3, Zope 2.5.1 Author: Reinhard Hess (aka Flynt) Email: flynt@gmx.ch
This How-To describes the installation of Python 2.1.3 and Zope 2.5.1 on a Linux (SuSE 8.0) OS. It is an installation done by root into a public directory. Care is taken to enable the installation of multiple Python versions and of multiple Zope versions by using the INSTANCE_HOME procedure. As an add-on we provide in Supplement A the instructions for how to install the Zope product SILVA (a Content Management Tool).
In this installation all software parts are compiled and no binary version is used. The setup is following the guidelines given in the related How-To written by Seb Bacon (see http://www.zope.org/Members/beacon/install_instructions ).
- Directory Setup
Assume that we install Python into the /opt folder (you might wish to elect another location such as e.g. /usr/local; in this case just substitute in the following text). Create a directory /opt/PYTHON/PYTHON2.1.3 as user root:
mkdir -p /opt/PYTHON/PYTHON2.1.3
Copy the Python tar file into that directory PYTHON2.1.3 and check the MD5 sum to be sure that your copy is not contaminated by a malicious virus.
We use a special directory PYTHON2.1.3 to keep the lib, bin and other directories separate for each version of Python that we want to install.
- Preparing the installation
After de-taring read the README ! Multithreading is automatically enabled since Python 2.0 version. Large-File-Support is only enabled since Python 2.2 in the source versions.
Installation works after the usual configure --> make --> make install --> make test dance. We will have to take care of the installation location by prefixing the base installation directory with the --prefix=directory option to configure.
We are in the /opt/PYTHON/PYTHON2.1.3 directory (check with pwd) and we are user root:
cd /opt/PYTHON/PYTHON2.1.3 tar -zxvf Python-2.1.3.tgz cd Python-2.1.3 view READMECheck that user and group are set correctly for the de-tared files.
- Preparing for Largefile support
We now check for Largefile-Support and for Tkinter support. For having Tkinter enabled on SuSE 8.0 you have to observe that you do not only have Tcl/Tk installed but also their devel-package. You may wish that you have also Expat installed. This parser is used by various applications. However, if you are going to use PyXML you will get the Expat parser with that package.
Now do the following steps:
export CC='gcc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' ./configure --prefix=/opt/PYTHON/PYTHON2.1.3 - Compile and install
Run make, make install and make test:
cd /opt/PYTHON/PYTHON2.1.3/Python-2.1.3 make make install make testYou can test wether Tkinter is working by trying to start Idle. It is located in Tools/idle. But take care that you use the newly installed Python and not some Python preinstalled on your machine earlier. The easiest way to do so is to set your PATH variable to:
export PATH=/opt/PYTHON/PYTHON2.1.3/bin:$PATH python /opt/PYTHON/PYTHON2.1.3/Python-2.1.3/Tools/idle/idle.pyThen a window should open with the Idle Python IDE. If not, Tkinter is not enabled for this installation.
To check wether Largefile-Support is enabled you can run the test which comes with the Python distribution:
python >> import test.test_largefileUpon import the tests will start to run.
- Using the correct Python version
To be sure, that you test with the new Python version 2.1.3, we just change the PATH variable by prepending our Python, so that we would not unvolontarily run some Python version from /usr/bin (you can also check with the command: which python on the commandline):
export PATH=/opt/PYTHON/PYTHON2.1.3/bin:$PATH
- Prepare Zope installation
Now we are going to install Zope. We make a directory to keep our actual version cleanly separated from others that we may wish to install later. As user root execute:
mkdir -p /opt/ZOPE/ZOPE2.5.1 cd /opt/ZOPE/ZOPE2.5.1Download Zope and de-tar it in that new directory:
cd /opt/ZOPE/ZOPE2.5.1 tar -zxvf Zope-2.5.1-src.tgz chown -R root:root Zope-2.5.1-src - Linking in Python libraries
Link in the Python libraries:
cd /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src ln -s /opt/PYTHON/PYTHON2.1.3/lib/python2.1/ lib/. - Linking in ZServer module into the Zope path
Finally add a link to the ZServer module inside the Zope path. This is needed to make the unit testrunner work:
cd /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src ln -s /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src/ZServer/ lib/python/. - Compiling Zope
Now we can build Zope (do not forget to note the admin password which appears at the end of the building on the screen):
cd /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src /opt/PYTHON/PYTHON2.1.3/bin/python ./wo_pcgi.pyYou may write down the admin password in a file admin_passwd and chmod 600 this file. This is a security breach, however and you should not do this on a production machine.
Furthermore you can always set a new password for the emergency user in case you forgot the old password. See the last paragraph of this How-To for how to do that.
- Permission settings
We use the username zope as this functional user is already set up by the SuSE default installation, no matter wether you install the SuSE Zope package or not. However, you will not wish to install the SuSE Zope package, because that one will always be outdated.
Now we ensure that only the Zope user can write to the var directory:
cd /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src chmod 770 var chmod 660 var/* chown -R zope:daemon var - Changing start- and stop-Scripts
We have to change the start and stop scripts. The start script should read like this:
#! /bin/sh reldir=`dirname $0` INSTANCE_HOME=`cd $reldir; pwd` export INSTANCE_HOME ZOPEHOME=/opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src export ZOPEHOME exec /opt/PYTHON/PYTHON2.1.3/bin/python \ $ZOPEHOME/z2.py \ -w 8080 \ -f - \ -m - \ -u zope \ "$@"This will start a Zope instance on your machine, which listens on port 8080 and which is run by the OS user zope. Note that if you wish to change the user running Zope, you will have to make sure, that the new user has access to the files in the var directory of the instance. For a help on the possible options run the start script with the help option, i.e. ./start --help. Especially there is a debug-option -D, which does not detach from the controlling terminal and so you can see possible error messages in the terminal during startup and runtime. However this option should not be used for a production instance.
The stop script should read like this:
#! /bin/sh reldir=`dirname $0` pidhome=`cd $reldir/var; pwd` kill `cat $pidhome/Z2.pid` - Folder and Template for Zope Instances
Now we create a directory for the Zope instances and create there a template instance, which we just have to copy to create a new one, whenever we need to. Execute as user root:
mkdir -p /opt/ZOPE/ZOPESITES/TEMPLATE-2.5.1-2.1.3 cd /opt/ZOPE/ZOPESITES/TEMPLATE-2.5.1-2.1.3 cp -a /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src/var . cp -a /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src/import . cp -a /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src/Extensions . cp -a /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src/inituser . cp -a /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src/start . cp -a /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src/stop . mkdir Products ( cp -a /opt/ZOPE/ZOPE2.5.1/Zope-2.5.1-src/admin_passwd . ) - Instance Creation
Now we create a first instance from the template and check, wether it is working. If so, we change the password of the admin user in Zope and set up a new user webadmin with role manager with which we will work within the instance. Execute as root:
cd /opt/ZOPE/ZOPESITES cp -a TEMPLATE-2.5.1-2.1.3 Zope-Instance-01_2.5.1-2.1.3 cd Zope-Instance-01_2.5.1-2.1.3 ./startWe used here Zope-Instance-01_2.5.1-2.1.3 as the name for the first instance. However, you can use some other name, like e.g. SILVA or whatever you wish.
Before starting the instance you may wish to change the port in the start script, on which the instance is running (with the copy you always get port 8080, remember !). You have to change, when you are already running another instance at port 8080.
Point your browser to http://localhost:8080/manage and do the aforementioned changes for admin and webadmin in the Zope Management Interface (acl_users folder in root directory of Zope).
- Some notes at the end
Never change the Template instance and never try to start Zope from the Template instance!
During the first startup of Zope (when there is no user in the acl_user folder) Zope checks for a file named inituser which has the same format as the access file. If found, it adds that user and tries to delete inituser. If, on the other hand, there is already at least one user, the code that checks for inituser is never executed.
The file named access defines the emergency user. If it doesn't exist, no one can log in as the emergency user.
Creating the emergency user or the initial user is easily done with the zpasswd.py script. To create an emergency user, execute:
python zpasswd.py access
Or to create the inital user, execute:
python zpasswd.py inituser
And now, have fun !
Supplement A: Example of installation of a SILVA instance
As an addon we look at how to install a SILVA instance in the environment set up above. First let's create a new Zope instance for hosting SILVA:
cd /opt/ZOPE/ZOPESITES
cp -a TEMPLATE-2.5.1-2.1.3 SILVA
cd SILVA
./start
Point your browser to http://localhost:8080/manage and do the aforementioned changes for admin and webadmin in the Zope Management Interface (acl_users folder in root directory of Zope).
Log in as webadmin and create in the the acl_users folder in the root of the Zope instance the users author1, editor1, chiefeditor1 and manager1 with roles owner. These users will represent the various SILVA specific roles. Their names are chosen to match the respective SILVA role names.
For SILVA (respectively for the product ParsedXML)we have to extend the Python installation with the PyXML package. Get the package from Sourceforge and download it into /opt/PYTHON/PYTHON2.1.3:
cd /opt/PYTHON/PYTHON2.1.3
tar -zxvf PyXML-0.7.1.tar.gz
cd PyXML-0.7.1
/opt/PYTHON/PYTHON2.1.3/bin/python setup.py build
/opt/PYTHON/PYTHON2.1.3/bin/python setup.py install
This installs a new package _xmlplus into the folder /opt/PYTHON/PYTHON2.1.3/lib/python2.1/site-packages. Note that the Expat parser is coming together with this package.
Now go back into the installation of the SILVA instance:
cd /opt/ZOPE/ZOPESITES/SILVA/Products
Download the following products into this folder:
Note:
Currently (2002/07/21) some browsers download the SILVA import file as "silva-0.8.zexp" instead of "silva-0.8.zexp.gz". This may cause some irritation. Just rename the downloaded file to "silva-0.8.zexp.gz". For future operations, check the
file character by issuing the command 'file silva-0.8.zexp' on the commandline.
Now for each of the downloaded files except the SILVA import file silva-0.8.zexp.gz de-tar it in the Products folder:
cd /opt/ZOPE/ZOPESITES/SILVA/Products
tar -zxvf Formulator-1.2.0.tgz
chown -R root:root Formulator
tar -zxvf ParsedXML-1.3.0.tgz
chown -R root:root ParsedXML
tar -zxvf XMLWidgets-0.8.tgz
chown -R root:root XMLWidgets
tar -zxvf Silva-0.8.tgz
chown -R root:root Silva
Move the Silva import file silva-0.8.zexp.gz to where it belongs, into the Zope import folder /opt/ZOPE/ZOPESITES/SILVA/import and unzip it:
cd /opt/ZOPE/ZOPESITES/SILVA/Products
mv silva-0.8.zexp.gz /opt/ZOPE/ZOPESITES/SILVA/import/.
cd /opt/ZOPE/ZOPESITES/SILVA/import
gunzip silva-0.8.zexp.gz
Restart the Zope instance or start it, if it was shut down before:
cd /opt/ZOPE/ZOPESITES/SILVA
./stop
./start
Point your browser to the management interface http://localhost:8080/manage and log in as user webadmin. Go into the Control_Panel, then Product Management and check, wether the new Zope products show intact icons. If they show broken icons, then there has been a serious problem and the new product classes could not be imported.
If everything is fine, go back to the root of the Zope instance and import the SILVA import file silva-0.8.zexp into the root folder. After the time the import takes, you will see a new folder with id silva and title in parenthesis Silva. This is now the new SILVA instance and you can go into it by pointing your browser to http://localhost:8080/silva/ (for editing just append edit to the URL).
We still have to set up the first active users. Go into the edit modus http://localhost:8080/silva/edit as user webadmin and there go to the Access tab. With the lookup button you can find and select the users author1, editor1, chiefeditor1 and manager1 who we have set up earlier in the root folder with roles owner (see above) and assign them their respective roles.
Additional Note:
The next time you want to log in with a user with *manager* privileges to do administrative work within and for the SILVA instance you will use the user *manager1* and not anymore the user *webadmin*; *manager1* has the role *manager* for the whole SILVA instance. The user *webadmin* on the other hand the SILVA instance is running. This distribution of roles and responsibilities may be needed in certain environments and Zope deals perfectly with those kind of responsibility delegation will be the administrative user for the Zope instance, in which requirements.
Now you can start to play and have fun with SILVA.