|
From: John E. M. <jma...@ya...> - 2002-02-21 05:18:19
|
Michael, Thanks for your help. I have been documenting the process of installation on a Red Hat 7.2 system. This is the second machine I have installed on. This really consolidates the documentation and lack thereof of the process of installing everything web2ldap relies on. It is not yet complete, obviously. I have a couple of questions / problems / issues: 1) When I run it in Apache with mod_fastcgi, the first screen comes up, and from the first screen, I can log in, but, if I click on a link, like, say, "Bind", I get the following error sent to the browser: Session ID not found. Redirecting... 2) This is silly. When I run it in standalone mode, it works wonderfully locally, but when I try to access it from another machine on my local network, I get a "The page cannot be displayed" message. Any ideas? Thanks, and I hope my efforts in documentation are helpful to the cause. John P.S. The file is actually in html now. My notes on installing web2ldap on RedHat 7.2. Certain assumptions are made when not specifically stated otherwise, such as: you are root, the base subdirectory for working is the directory to which the downloads are saved, and Netscape Directory Server is installed. This document was meant for a wider audience than just the uber-technical, so please forgive any obvious instructions. 1) Install RedHat Linux 7.2. If web2ldap will be using the mod_fastcgi module in Apache, exclude the web server from the install (Apache), as it will need to be recompiled to include mod_fastcgi. 2) Obtain the following and save to a directory: ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.0.23.tgz http://prdownloads.sourceforge.net/python-ldap/python-ldap-2.0.0pre04.tar.gz http://www.stroeder.com/pylib/PyWebLib/download/pyweblib-1.1.0.tar.gz http://web2ldap.de/download/web2ldap-0.10.3.tar.gz 2a) There are two modes of operation of web2ldap: standalone, and with mod_fastcgi in Apache. If web2ldap is to be used with mod_fastcgi in Apache, the following should be saved to a directory: http://www.apache.org/dist/httpd/apache_1.3.23.tar.gz http://www.fastcgi.com/dist/mod_fastcgi-2.2.12.tar.gz http://alldunn.com/python/fcgi.py 2b) Depending on the options selected, either only Python 1.52 or Python 1.52 and Python 2.1 will be installed. If /usr/bin does not contain python2 and python2.1, download the following: ftp://ftp.python.org/pyb/python/2.2/Python-2.2.tgz 3) If necessary (see 2b above), install Python 2.2 by doing the following: tar zxvf Python-2.2.tgz cd Python-2.2 ./configure make make test /* optional, but suggested */ make install 4) Install PyWebLib by doing the following: tar zxvf pyweblib-1.1.0.tar.gz cd pyweblib-1.1.0.tar.gz /usr/local/bin/python setup.py install -O2 /* That is a capital "o" for optimization level. The path to Python 2.x needs to be specified */ 5) Since the web2ldap documentation suggests for RedHat "OpenLDAP (is) included with their Linux distribution" (which, for RedHat 7.2 is OpenLDAP 2.0.11), and, at the same time, "You have to grab a recent pre-release 2.0.0pre03 and build it against OpenLDAP 2.0.13+ libs" (contradictory), I suggest installing OpenLDAP 2.0.23 by doing the following: tar zxvf openldap-2.0.23.tgz cd openldap-2.0.23 ./configure make depend make make test /* optional, but suggested. Be prepared to wait or take Lunch. */ make install 6) Install python-ldap by doing the following: tar zxvf python-ldap-2.0.0pre04 cd python-ldap-2.0.0pre04 vi setup.cfg Modify the paths to the paths shown below. It may be possible to compile python-ldap against the compiled, but pre-installed OpenLDAP lib and include directories, but I haven't gone there yet. -------------------------------------------------------------- # Section for compiling the C extension module # for wrapping OpenLDAP 2 libs [_ldap] class = OpenLDAP2 library_dirs = /usr/local/lib include_dirs = /usr/local/include libs = lber ldap resolv # Installation options [install] compile = 1 optimize = 1 -------------------------------------------------------------- then ... /usr/local/bin/python setup.py build /usr/local/bin/python setup.py install Afterwords, to test the functionality of python-ldap, the following script may be used (you can call it test.py) Modify lines two and four to comply with your machine configuration. Make sure that either Netscape Directory Server or OpenLDAP is running and that the 2.1+ version of Python with python-ldap is used. This script is modified from the one in the documentation only in that it provides output, rather that only generating an error message if it fails. -------------------------------------------------------------- import ldap l = ldap.open("localhost") l.simple_bind_s("","") res = l.search_s("dc=example,dc=com", ldap.SCOPE_SUBTREE, "objectclass=*") print res l.unbind() -------------------------------------------------------------- OpenLDAP won't run with the default slpad.conf file. To test the script out with OpenLDAP, do the following: vi /usr/local/etc/openldap/slapd.conf Change the following lines: From: suffix "dc=my-domain,dc=com" To: suffix "dc=example,dc=com" ..and from: rootdn "cn=Manager,dc=my-domain,dc=com" To: rootdn "cn=Manager,dc=example,dc=com" Then execute the following: /usr/local/libexec/slapd ...and finally run the script: /usr/local/bin/python test.py /* using the correct Python */ If it works, kill the main OpenLDAP slapd process by getting the pid from: cat /usr/local/var/slapd.pid Then kill it's process id, i.e.: kill 12286 7) There are two modes of operation of web2ldap: standalone, and with mod_fastcgi in Apache. For mod_fastcgi operation, skip to step nine. For standalone operation do the following: tar zxvf web2ldap-0.10.2.tar.gz mv web2ldap-0.10.2 /usr/local/web2ldap vi /usr/local/web2ldap/etc/web2ldap/web2ldapcnf/standalone.py search for "run_username" change to "nobody" /* or create a new account */ search for "access_allowed" uncomment the first "access_allowed" line comment the second "access_allowed" line /* to allow access to all */ save the document and quit vi Then edit the following file: vi /usr/local/web2ldap/sbin/standalone.py Change the path to the updated Python in the first line: #!/usr/local/bin/python Search for: 127.0.0.1 and change it to the IP address bound to the NIC you will be communicating with. Save the document and exit vi. 8) Compile the web2ldap and run it by doing the following: cd /usr/local/web2ldap /usr/local/bin/python sbin/compile.py /usr/local/web2ldap/sbin/web2ldap.py -u nobody -t off -d on web2ldap will respond with the following: Read MIME-type mapping from file /etc/mime.types. Accepted IP address ranges: 0.0.0.0/0.0.0.0 Running mode: multi-threaded SSL: disabled Changed to UID 99. Point your favourite browser to http://ldap.testserver.com:1760/web2ldap to access the web application. 9) Install fcgi.py into the Python library path. Determine the python path by typing the following: /usr/local/bin/python Which will produce the following. The text to input is in red. Python 2.2 (#1, Feb 21 2002, 06:55:12) [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-098)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.path ['', '/usr/local/lib/python2.2', '/usr/local/lib/python2.2/plat-linux2', '/usr/local/lib/python2.2/lib-tk', '/usr/local/lib/python2.2/lib-dynload', '/usr/local/lib/python2.2/site-packages'] >>> <Ctrl>D The <Ctrl>D is the end of file marker, which exits python. Install fcgi.py by copying it to a directory in the Python path: cp fcgi.py /usr/local/lib/python2.2 /* from the directory fcgi.py was downloaded to */ 10) Install mod_fastcgi into Apache with APACI by doing the following: tar zxvf apache_1.3.23.tar.gz tar zxvf mod_fastcgi-2.2.12.tar.gz mv mod_fastcgi-2.2.12.tar.gz apache_1.3.23/src/modules/fastcgi cd apache_1.3.23.tar.gz ./configure activate-module=src/modules/fastcgi/libfastcgi.a make make install vi /usr/local/apache/conf/httpd.conf /* Make the following changes */ Find the following line: ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/ Add the following line, just below it: ScriptAlias /web2ldap-fcgi/ /usr/local/web2ldap/fcgi/ Find the following line: # End of browser customization directives Add the following lines below it: FastCgiServer /usr/local/web2ldap/fcgi/web2ldap.py <Location /usr/local/web2ldap.fcgi> AddHandler fastcgi-script .py </Location> Save the file and exit vi. 11) Copy the css directory to where the scripts will expect it: cp -rp /usr/local/web2ldap/htdocs/css /usr/local/apache/htdocs 12) Start the Apache server: /usr/local/apache/bin/apachectl start 13) Open a browser to the following URL: http://hostname/web2ldap-fastcgi/web2ldap.py Ströder <mi...@st...> wrote: "John E. Mayorga" wrote: > > RedHat 7.2 seems to have both Python 1.5.2 and 2.1.1 in the distribution. You might want to see http://python-ldap.sf.net/download.shtml for a link to Joe's Red Hat RPMs. > There is a /usr/bin/python, but I don't > even know how to determine the version of that, or of DistUtils for that matter. If you invoke the interpreter (e.g. /usr/bin/python) the version is printed in the interactive interpreter shell. Press ^D to exit the interpreter. > Each version of Python in /usr/lib has it's own distutils. Which Python version do you want to use? I'd suggest to go for Python 2.1.1. > At this point, I have to admit that, although I've worked with Linux > for years, this is my first experience with Python. Maybe it helps if you tell us what you want to do. Ciao, Michael. --------------------------------- Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games |