:::: MENU ::::

Tracをwsgiでインストール

Pocket

wsgiでtracを入れてみたかったので入れてみた。
たぶん重複してインストールしてたり意味のないコマンドも含まれているけど、
インストールしたときのログ。

python

pythonインストール

# wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
# tar zxvf Python-2.7.1.tgz
# cd Python-2.7.1
# ./configure --prefix=/usr/local/python-2.7.1
# make
# make install

# vi /etc/ld.so.conf.d/python-2.7.1.conf
/usr/local/python-2.7.1/lib
# ldconfig
# ldconfig -p | grep 'python'

# vi .bash_profile
# Python
PYTHON_HOME=/usr/local/python-2.7.1

PATH=$PYTHON_HOME/bin:$PATH:$HOME/bin:

export PYTHON_HOME PATH
export MANPATH="$MANPATH":$PYTHON_HOME/man
# source .bash_profile

なんか必要っぽいものインストール

# yum install libxml2-devel
# yum install libxslt-devel
# yum install freetype-devel
# yum install libjpeg-devel
# yum install libpng-devel
# yum install zlib-devel
# yum install sqlite-devel
# yum install mysql-devel

easy install インストール

# wget http://peak.telecommunity.com/dist/ez_setup.py
# /usr/local/python-2.7.1/bin/python2.7 ez_setup.py

subversion

apacheインストール

# wget http://www.meisei-u.ac.jp/mirror/apache/dist//httpd/httpd-2.2.17.tar.gz
# tar xvzf httpd-2.2.17.tar.gz
# cd httpd-2.2.17/srclib/apr
# ./configure --prefix=/usr/local/apr --enable-threads
# make
# make install

# which iconv
# yum install expat-devel

# cd /usr/local/src/httpd-2.2.17/srclib/apr-util
# ./configure --prefix=/usr/local/apr  --with-apr=/usr/local/apr
# make
# make install

# cd /usr/local/src/httpd-2.2.17
# ./configure \
--prefix=/usr/local/apache2 \
--enable-mods-shared=most \
--enable-dav \
--enable-dav-fs \
--enable-dav-lock \
--enable-cgi \
--enable-cgid \
--enable-cache \
--enable-mem-cache \
--enable-proxy \
--enable-proxy-blancer \
--enable-rewrite \
--enable-so \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr
# make
# make install

neon, swigインストール

# yum install zlib-devel
# yum install libxml2-devel
# wget http://www.webdav.org/neon/neon-0.29.6.tar.gz
# tar xvfz neon-0.29.6.tar.gz
# cd neon-0.29.6
# ./configure --prefix=/usr/local/neon --with-libxml2 --with-expat
# make
# make install

# vi /etc/ld.so.conf.d/neon.conf
/usr/local/neon/lib
# ldconfig
# ldconfig -p | grep 'neon'

# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.02.tar.gz
# tar xvfz pcre-8.02.tar.gz
# cd pcre-8.02
# ./configure & make & make install

# wget http://prdownloads.sourceforge.net/swig/swig-2.0.3.tar.gz
# tar xvfz swig-2.0.3.tar.gz
# cd swig-2.0.3
# ./configure --prefix=/usr/local/swig --with-python=/usr/local/python-2.7.1/bin/python
# make
# make install

# vi /etc/ld.so.conf.d/swig.conf
# /usr/local/swig/lib
# ldconfig
# ldconfig -p | grep 'swig'

# yum install gettext
# yum install gettext-devel

sqliteインストール

# wget http://www.sqlite.org/sqlite-autoconf-3070602.tar.gz
# tar xvfz sqlite-autoconf-3070602.tar.gz
# cd sqlite-autoconf-3070602
# ./configure & make & make install

# rpm -ivh python-sqlite2-2.3.3-1.el5.rf.i386.rpm
# easy_install -UZ pysqlite

subversionインストール

# wget http://subversion.tigris.org/downloads/subversion-1.6.16.tar.gz
# tar xvfz subversion-1.6.16.tar.gz
# cd subversion-1.6.16
# ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --with-neon=/usr/local/neon --with-swig=/usr/local/swig --without-jdk
# make
# make install

# yum install mod_dav_svn
# mkdir /var/repos/
# mkdir /var/repos/svn
# svnadmin create sample

# cd /usr/local/src/subversion-1.6.16
# make swig-py
# make install-swig-py

# vi /usr/local/python-2.7.1/lib/python2.7/site-packages/svn-python.pth
/usr/local/svn/lib/svn-python

trac

tracインストール

# wget http://ftp.edgewall.com/pub/trac/Trac-latest.tar.gz
# tar xvfz Trac-latest.tar.gz
# cd Trac-0.12.2/
# /usr/local/python-2.7.1/bin/python2.7 ./setup.py install

# mkdir /var/repos/trac

# trac-admin sample initenv
Project Name [My Project]> sample
Database connection string [sqlite:db/trac.db]>

wsgiのインストールとapacheの設定

# wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
# tar xvfz mod_wsgi-3.3.tar.gz
# cd mod_wsgi-3.3
# ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/local/python-2.7.1/bin/python
# make & make install

# vi /usr/local/apache2/conf/httpd.conf
LoadModule wsgi_module	modules/mod_wsgi.so

# mkdir apache
# cd apache
# vi dispatch.wsgi
import os

// os.environ['TRAC_ENV'] = '/var/repos/trac/sample'
os.environ['TRAC_ENV_PARENT_DIR'] = '/var/repos/trac'
os.environ['PYTHON_EGG_CACHE'] = '/tmp/.python-eggs'
import trac.web.main

application = trac.web.main.dispatch_request

# vi /usr/local/apache2/conf/httpd.conf
Include conf/extra/httpd-vhosts.conf

# vi /usr/local/apache2/conf/extra/httpd-vhosts.conf

   ServerName trac.localhost.localdomain
   DocumentRoot /var/repos/trac/common/apache
   ErrorLog logs/trac-error_log
   CustomLog logs/trac-access_log combined

   WSGIScriptAlias /trac/sample /var/repos/trac/common/apache/dispatch.wsgi

       Order deny,allow
       Allow from all

追記(2011/08/01):

TRAC_ENV_PARENT_DIRを指定すれば、複数プロジェクトでも対応できるらしい。

Pocket


So, what do you think ?