installing plone with ldap

Wed, Mar 15, 2006

./configure –prefix=/usr/local/python make make install

The first you should do is make sure any previously installed Python interpreters are deleted. If you don’t, it’ll cause a lot of headache later on. There’s usually one at: /usr/bin/python so, do this to save your sanity: cd /usr/bin rm python ln -s /usr/local/python/bin/python python

don’t forget to add /usr/local/python/bin to your PATH in /etc/profile, so that when you do:

which python

you’ll get:

/usr/local/python/bin/python

This is important to make sure Zope uses the python you just built and also that the LDAP lib you’re about to build uses it too.

Here’s how I normally configure openLDAP for an easy install:

export LIBS=-lresolv ./configure –prefix=/usr/local/openldap
    –enable-ldbm=no
    –enable-slapd=no
    –with-tls

then do:

make make install

and that’s you got openLDAP installed.

library_dirs = /usr/local/openldap/lib include_dirs = /usr/local/openldap/include libs = ldap

then just do:

python setup.py build python setup.py install

If you get errors such as these:

file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found

don’t worry about them as apparently they’re normal! Read it here

To test that the LDAP build worked, go into a shell and do:

python -c “import ldap,ldap.schema;print ldap.version

You should get the version number displayed. If you get:

ImportError: No module named ldap

then you’ve most probably not got rid of the previously installed Python interpreter which lurks in /usr/bin

Nice easy configure:

./configure –prefix=/usr/local/zope
    –with-python=/usr/local/python/bin/python

–with-python is important as it makes sure Zope uses the Python you’ve just build and not one of the lurkers on the system. If you get an error such as:

make: execvp: /usr/local/python: Permission denied

then you’ve done –with-python=/usr/local/python instead.

OK, off we go again:

make make install

and we have Zope in /usr/local/zope. The next step is to go to /usr/local/zope and type:

bin/mkzopeinstance.py

to create a new instance. I just called mine “test” and gave it an admin username and password. This gave me an instance in:

/usr/local/zope/test

The next step is important. Edit:

/usr/local/zope/test/etc/zope.conf

and change effective-user to be the uid of a system user to run the instance as, instead of root. Then make /usr/local/zope/test and all it’s subdirs writeable to that user:

effective-user wwwrun chown -R wwwrun test

You’re now ready to start your new Zope instance:

/usr/local/zope/test/bin/zopectl start

if you want to see any errors, which don’t get logged BTW, do:

/usr/local/zope/bin/zopectl fg

You should be able to go to:

http://yourzope.com:8080/manage

for the root instance and

http://yoursite.com:8080/test/manage

for your test instance, logging in as the user you specified when running mkzopeinstance.py

If all is well, shut Zope down, for now we install Plone:

/usr/local/zope/test/bin/zopectl stop

mkdir /usr/local/zope/test/Products

if it doesn’t already exist. Then just decompress the Plone tarball and copy all those file into the Products directory:

cd Plone-2.1.2 cp -r * /usr/local/zope/test/Products

That’s it for now. Let’s add LDAP support to Plone now.

cp -r LDAPUserFolder /usr/local/zope/test/Products

and now interactively restart your Zope instance:

/usr/local/zope/test/bin/zopectl fg

to test for LDAP loading errors such as:

File “<string>”, line 1, in ? ImportError: No module named ldap

if you see this then Zope is not using the Python you LDAP enabled. Go back to the Python section and make sure you’ve got rid of all lurkers and you’ve built and installed python-ldap. If you don’t see any errors, then shut it down again:

/usr/local/zope/test/bin/zopectl stop

and start it in daemon mode:

/usr/local/zope/test/bin/zopectl start

Install your new Plone by logging in to your Zope root instance:

http://yourzope.com:8080/manage

and adding a “Plone Site” from the “Add” droplist when in the root menu. You can then login to your Plone:

http://yourzope.com:8080/test/manage

You now have an LDAP enabled Zope and Plone. To configure Plone to use LDAP, follow the instuctions here. This page might help too.

comments powered by Disqus