Archive for January, 2012

If we attempt to install this plugin, when we try to upgrade the database, we get this error:

[~]# trac-admin /net/web/lappd-trac/LAPPD upgrade
TypeError: __init__() got an unexpected keyword argument 'unique'

To fix, it depends on where the plugin was installed. For the system, delete it from /usr/local/lib/python2.6/site-packages. For the project, it will be in PROJECT_HOME/plugins. After deleting, restart the webserver.

I got some errors about latex style files missing. The ones in question were: type1ec.sty and preview.sty. I fixed this by downloading them from CTAN.org, unzipping the files, and running:

tex <filename.ins>

Then I moved the entire directory, in my case one for preview and one for type1ec to /usr/share/texmf/tex/latex. Then run texhash and things were good.

At some point, I also ran fmtutil-sys –missing, which may or may not have helped. I’m not sure.

How to authenticate against and openldap server, in Apache.

Since we’re sending credentials, we want everything to be over https, so everything here is in the /etc/httpd/conf.d/ssl.conf file. I’m calling the openldap system, liberty.example.com and the system running the webserver, wishbone.example.com. The url for the site is then https://wishbone.example.com.

Right after SSL Global Context, add this line:

LDAPTrustedGlobalCert CA_BASE64 /opt/certs/ldap-server.pem

(This file is the certificate for your openldap system. It’s self-signed and a CA as well.)

Make a self-signed certificate for wishbone that you’ll use for https. If you use the Makefile, both your certificate and key will be in the same file.

SSLCertificateFile /etc/pki/tls/certs/wishbone.pem
SSLCertificateKeyFile /etc/pki/tls/certs/wishbone.pem

At the end of the file, just before the </VirtualHost>, add the following:

LDAPTrustedClientCert CERT_BASE64 /opt/certs/ldap-server.pem
LDAPTrustedMode SSL

<Directory /var/www/html>
Order allow,deny
Allow from all
</Directory>

<Location /login>
AuthType Basic
Authname 'Account Info'
AuthBasicProvider 'ldap'
AuthLDAPURL 'ldaps://liberty.example.com:636/ou=people,dc=liberty,dc=example,dc=com?uid?one'
AuthzLDAPAuthoritative off
Require valid-user
</Location>

I needed to install Trac on an RHEL5 system. This was a bit of a problem since it needed a version of python with threads and the version from RedHat does not have threads. We also have ldap set up for authentication and I wanted Trac to be able to use it.

  1. Compile and install sqlite3.
    ./configure
    make
    make install
    (puts in under /usr/local)
  2. Compile and install subversion (it requires sqlite3, which is why I did that first)
    ./configure
    make
    make install
  3. Compile and install python2.6. RHEL uses the python installed in the system, so installing 2.6 in /usr/local solves our problem.
    ./configure –with-threads –enable-shared
    make
    Here I get these errors:

    Failed to find the necessary bits to build these modules:
    bsddb185           dl                 imageop         
    sunaudiodev     
    

    If you get errors for other packages here, you should be able to install the development package from RedHat to fix those. For the packages listed above, edit setup.py and comment out the sections having to do with these.
    make install

    • Create the file /etc/ld.so.conf.d/libpython2.6.conf and put the following line in it:
      /usr/local/lib
      

      Then run ldconfig

    • Install setuptools
      wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
      [~]# sh setuptools-0.6c11-py2.6.egg
      Processing setuptools-0.6c11-py2.6.egg
      Copying setuptools-0.6c11-py2.6.egg to /usr/local/lib/python2.6/site-packages
      Adding setuptools 0.6c11 to easy-install.pth file
      Installing easy_install script to /usr/local/bin
      Installing easy_install-2.6 script to /usr/local/bin
      
      Installed /usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
      Processing dependencies for setuptools==0.6c11
      Finished processing dependencies for setuptools==0.6c11
      
  4. mod_wsgi module
    ./configure –with-python=/usr/local/bin/python2.6
    make
    make install
    (The httpd module is installed in /usr/lib64/httpd/modules)
  5. If not installed, use yum to install httpd. And get it running.
  6. Install Trac
    • easy_install Babel==0.95
    • easy_install Trac
  7. Setup Trac
    • trac-admin /net/web/lappd-trac/LAPPD initenv
      Project name> LAPPD
      Database connection string> sqlite:db/trac.dbj
    • # trac-admin /net/web/lappd-trac/LAPPD deploy /tmp/deploy
      Copying resources from:
        trac.web.chrome.Chrome
          /root/.python-eggs/Trac-0.12.2-py2.6.egg-tmp/trac/htdocs
          /net/web/lappd-trac/LAPPD/htdocs
      Creating scripts.
      
      # pwd
      /net/web/lappd-trac/LAPPD
      # /bin/rm -r htdocs/
      # mv /tmp/deploy/* .
      

      Now we need to make sure that everything worked.

      # python
      Python 2.6.7 (r267:88850, Jan  5 2012, 08:25:37) 
      [GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import trac.web.main
      >>> (no errors, it's ok)
      
  8. Create a software repo to use
    svnadmin create /net/repos/trac/LAPPD
  9. Need to make sure the python bindings for subversion are installed. Go back to where you originally compiled subversion. Edit the Makefile so that SWIG_PY_INCLUDES includes -I/usr/local/include/Python2.6. Otherwise, the next command will give an error about finding Python.h
    make swig-py
    make install-swig-py
    touch /usr/local/lib/python2.6/site-packages/svn-python.pth
    echo /usr/local/lib/svn-python > /usr/local/lib/python2.6/site-packages/svn-python.pth
  10. Make some admin users
    trac-admin /net/web/lappd-trac/LAPPD permission add user1 TRAC_ADMIN
    trac-admin /net/web/lappd-trac/LAPPD permission add user2 TRAC_ADMIN
  11. Go into the Trac website, login (as one of the admins above) and go to admin and repository. Add the repository created. LAPPD: /net/repos/trac/LAPPD
  12. Resync the repository to Trac
    trac-admin /net/web/lappd-trac/LAPPD repository resync ‘LAPPD’
  13. Macros can be added by downloading the zipped file, unzipping it and running python setup.py install. The macros will only be recognized after restarting httpd.