[ZODB-Dev] zeo, data.fs permissions
Mark McEahern
mark@mceahern.com
Mon, 2 Sep 2002 13:56:01 -0500
[Guido van Rossum]
> You're not saying as which user you're doing. I assume you're doing
> it all as root?
Sorry, I erred on the side of not providing enough information. At the
bottom of this message, there's a more detailed account of the steps I took
to install Zope and ZEO.
> But then why the sudo?
All of the commands were issued as a normal user--I use sudo when I need to
run something as root. I didn't make it entirely clear in my original
message how I built and installed the RPMs, whether that was as normal or as
root. The instructions at the bottom make that more clear.
> Without giving owner info as well that doesn't help much.
Sorry, root was owner.
> Sounds good to me; or you could've done the Zope part of the install
> as user 'zope'.
I assume you mean installing the Zope RPM? Can a non-root user install
RPMs? I'm a relative novice to Linux and Red Hat, so I'm learning stuff all
the time.
> No, it's [custom_zodb.py] only read by the client. start.py runs the
server.
OK, thank you for the clarification.
> Turning on logging (STUPID_LOG_FILE etc.) should give you more clues.
I'm still learning Zope too. I did this:
export STUPID_LOG_FILE='/var/tmp/zope.log'
sudo /sbin/service zope start
and there was no /var/tmp/zope.log created--so I'm sure I need to learn more
about Zope logging.
> Also, you could try to stop the ZEO server and see if that affects the
> Zope instance. If it doesn't, there's a good chance that you are
> indeed not using ZEO. :-)
As noted below, I stopped ZEO and Zope kept chugging along happily--so it
must not be using ZEO.
> Check the atime of the custom_zodb.py file to see if it is being
> read. Make sure it is readable for user 'zope'.
custom_zodb.py is not being read. :(
Here are the detailed instructions I used:
Installing Zope via RPM
I'm trying to install Zope from RPMs based on these instructions:
http://www.zope.org/Members/dingo/Zope_RPMS
All of these commands are performed as a normal user--those commands
prefixed by sudo run as root and require configuring /etc/sudoers.
I started with a relatively clean vanilla Red Hat 7.3 install. The
only package I selected during installation of 7.3 were KDE and
Windows File Server. In addition, I've installed the Courier mail
server on this server.
1. I tried to download the Python RPMs for Python 2.1.3:
http://www.python.org/ftp/python/2.1.3/rpms/rh7.2/python2.1-2.1.3-1.i386.rpm
http://www.python.org/ftp/python/2.1.3/rpms/rh7.2/python2.1-devel-2.1.3-1.i3
86.rpm
I was worried that the RPMs for Python 2.1.3 would conflict with
Red Hat 7.3's Python 2, but they fail dependency checking:
$ rpm -Uvh --test python2.1-2.1.3-1.i386.rpm
error: failed dependencies:
libdb-3.2.so is needed by python2.1-2.1.3-1
so I decided to build my own RPMs for Python 2.1.3 on Red Hat 7.3
from the source RPM for Python 2.1.3.
2. Build the Python 2.1.3 RPMs from the SRPM.
Download the Python 2.1.3 SRPM to /var/tmp:
http://www.python.org/ftp/python/2.1.3/rpms/python2.1-2.1.3-1.src.rpm
Run this as a normal user (assumes SRPM is in /var/tmp):
$ buildrpm /var/tmp/python2.1-2.1.3-1.src.rpm
buildrpm is a bash shell script:
#!/bin/bash
# buildrpm
if [ -z "$1" ] ; then
echo "Usage: `basename $0` srpm"
exit 1
fi
srpm=$1
if [ ! -d $HOME/rpm ] ; then
mkdir $HOME/rpm
mkdir $HOME/rpm/SOURCES
mkdir $HOME/rpm/SPECS
mkdir $HOME/rpm/BUILD
mkdir $HOME/rpm/SRPMS
mkdir $HOME/rpm/RPMS
mkdir $HOME/rpm/RPMS/i386
fi
if [ ! -f $HOME/.rpmmacros ] ; then
echo "%_topdir $HOME/rpm" > $HOME/.rpmmacros
fi
rpmbuild --rebuild $srpm
3. Install the needed Python RPMs:
$ cd ~/rpm/RPMS/i386
$ sudo rpm -Uvh python2.1-2.1.3-1.i386.rpm
python2.1-devel-2.1.3-1.i386.rpm
4. Build the Zope RPM.
Download the Zope SRPM to /var/tmp:
http://www.zope.org/Members/dingo/Zope_RPMS/Zope-2.5.1-1.src.rpm
Run this as a normal user (assumes SRPM is in /var/tmp):
$ buildrpm /var/tmp/Zope-2.5.1-1.src.rpm
(Same buildrpm script from step 2.)
5. Install the Zope RPM:
$ cd ~/rpm/RPMS/i386
$ sudo rpm -Uvh Zope-2.5.1-1.i386.rpm
Zope-zserver-2.5.1-1.i386.rpm
6. Verify the new RPMs are installed:
$ rpm -qa | grep "python2.1"
python2.1-devel-2.1.3-1
python2.1-2.1.3-1
$ rpm -qa | grep "Zope"
Zope-2.5.1-1
Zope-zserver-2.5.1-1
7. Start Zope:
$ sudo /sbin/service zope start
8. Login:
http://localhost:8080/manage
Initial credentials (see README.Zope.RPM):
user: admin
pass: 123
9. Click Control_Panel | Database Management. The Database Location
is listed as:
/var/zope/var/Data.fs
Install ZEO
All of these commands are issued as a normal user--those prefixed by
sudo run as root and require configuring /etc/sudoers.
1. Install Zope (see above).
2. Make sure it's not running:
$ sudo /sbin/service zope stop
3. Download ZEO to /var/tmp:
http://www.zope.org/Products/ZEO/ZEO-2.0b1.tar.gz
4. Unpack the tarball:
$ cd /var/tmp
$ tar -zxvf ZEO-2.0b1.tar.gz
5. Run the unit tests.
The ZEO/docs/ZopeREADME.txt says:
"You can test ZEO before installing it with the test script."
I think what this means is that you can test it after you build it
but before you install it (python setup.py build)--however, that's
not clear.
So, first, build ZEO (from the installation directory created in
step 4):
$ python2.1 setup.py build
NOTE: Use of python 2.1 since that's the Python used by Zope.
Now we can try to run the tests (again, from the installation
directory created in step 4):
$ python2.1 test.py -v
This gives us an ImportError:
<output>
No module named zLOG
['lib.linux-i686-2.1', 'lib', '', '/usr/lib/python2.1',
'/usr/lib/python2.1/plat-linux2', '/usr/lib/python2.1/lib-tk',
'/usr/lib/python2.1/lib-dynload',
'/usr/lib/python2.1/site-packages']
Traceback (most recent call last):
File "test.py", line 255, in ?
File "test.py", line 209, in main
File "test.py", line 187, in runner
File "test.py", line 154, in get_suite
File "test.py", line 130, in package_import
File "lib/ZEO/tests/testStart.py", line 24, in ?
from ZEO.ClientStorage import ClientStorage
File "lib/ZEO/ClientStorage.py", line 25, in ?
from ZEO import ClientCache, ServerStub
File "lib/ZEO/ClientCache.py", line 84, in ?
import zLOG
ImportError: No module named zLOG
</output>
So, this time, we add the Zope libraries to the python search
path before running the tests:
$ export PYTHONPATH='/usr/share/zope/lib/python'
$ python2.1 test.py -v
This is always good to see:
..................................................................
.........................
----------------------------------------------------------------------
Ran 91 tests in 56.690s
OK
6. Run setup:
$ sudo python2.1 setup.py install --home=/usr/share/zope
If this generates:
warning: install: modules installed to
'/usr/share/zope/lib/python/', which is not in Python's module
search path (sys.path) -- you'll have to change the search path
yourself
remember to add the Zope libraries to Python's search path first:
$ export PYTHONPATH='/usr/share/zope/lib/python'
7. Select a port for ZEO:
To check which ports are in use:
sudo netstat -pantu
We'll use 9000
8. Start ZEO:
$ cd /usr/share/zope/
$ sudo python2.1 lib/python/ZEO/start.py -p 9000 -u zope
That fails:
$ Traceback (most recent call last):
File "lib/python/ZEO/start.py", line 248, in main
storages['1'] = FileStorage(fs or env.fs)
File "/home/mark/rpm/BUILD/Zope-2.5.1-src/lib/python/ZODB/
FileStorage.py", line 240, in __init__
IOError: [Errno 13] Permission denied:
'/usr/share/zope/var/Data.fs'
Here are the permission settings in /usr/share/zope/var/:
$ sudo ls -l /usr/share/zope/var/
total 164
-rw------- 1 root root 75448 Sep 2 12:54 Data.fs
-rw-r--r-- 1 root root 75448 Jan 20 2001 Data.fs.in
-rw-r--r-- 1 zope zope 5 Sep 2 13:15 Data.fs.lock
-rw-r--r-- 1 zope zope 0 Sep 2 13:15 Data.fs.tmp
Make the zope user the owner of the var directory and everything
in it:
$ sudo chown -R zope:zope /usr/share/zope/var
Try starting it again:
$ sudo python2.1 lib/python/ZEO/start.py -p 9000 -u zope
This time, it works. If we look in the /usr/share/zope/var
folder, there's a ZEO_SERVER.pid file:
$ cat /usr/share/zope/var/ZEO_SERVER.pid
12248 12249
We can see those processes are running:
$ ps -ax | grep 12248
12248 ? S 0:00 python2.1 lib/python/ZEO/start.py -p 9000 -u
zope
$ ps -ax | grep 12249
12249 ? S 0:00 /usr/bin/python2.1 lib/python/ZEO/start.py -p
9000 -u
9. Run Zope as a ZEO client:
sudo cp custom_zodb.py /usr/share/zope
custom_zodb.py looks like this:
# custom_zodb.py in Zope install directory (/usr/share/zope)
from ZEO.ClientStorage import ClientStorage
port = 9000
Storage = ClientStorage(('localhost', port))
10. Start Zope.
$ sudo /sbin/service zope start
Try to access Zope: http://localhost:8080/manage
Works.
11. Stop ZEO.
$ sudo kill `cat /usr/share/zope/var/ZEO_SERVER.pid`
12. Try to access Zope: http://localhost:8080/manage
Still works. Therefore, we must not be running ZEO. :(
13. Make sure Zope is reading custom_zodb.py:
$ sudo /sbin/service zope stop
$ ls -l --time=atime /usr/share/zope/custom_zodb.py
$ sudo /sbin/service zope start
$ ls -l --time=atime /usr/share/zope/custom_zodb.py
The time didn't change. So Zope must not be reading custom_zodb.py.
-