{"id":425,"date":"2010-11-01T16:52:59","date_gmt":"2010-11-01T11:52:59","guid":{"rendered":"http:\/\/linuxndme.com\/?p=99"},"modified":"2010-11-01T16:52:59","modified_gmt":"2010-11-01T11:52:59","slug":"trac-installation-with-mod_python","status":"publish","type":"post","link":"https:\/\/blog.nixwind.com\/?p=425","title":{"rendered":"Trac installation with mod_python"},"content":{"rendered":"<p><strong> Overview <\/strong><\/p>\n<p>Installing trac on a server with Apache and mod_python<\/p>\n<p><strong>Requirements<\/strong><\/p>\n<p>Tested with the below ,<\/p>\n<p>Apache 2.2<br \/>\nMysql 5.0<\/p>\n<p><strong>Objective<\/strong><\/p>\n<p>Installing trac and apache module mod_python for a project system on a domain subdirectory<\/p>\n<p><strong>Configuration<\/strong><\/p>\n<p><strong>Step 1<\/strong><\/p>\n<p><strong>Make sure that you have the required version of python , flew, setuptools and mysql-python installed.<\/strong><br \/>\nThis installation was done on a DirectAdmin server and it had python version as Python 2.4.3, so had to install a secondary python of version 2.5 on a different location<\/p>\n<p>To install python 2.5<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd \/usr\/local\/src <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> mkdir -p \/usr\/local\/TRAC\/PYTHON\/ <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget http:\/\/www.python.org\/ftp\/python\/2.5\/Python-2.5.tgz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> tar -zxvf Python-2.5.tgz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd Python-2.5 <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> .\/configure &#8211;enable-shared &#8211;prefix=\/usr\/local\/TRAC\/PYTHON\/ <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> make <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> make install <\/strong><\/p>\n<p>To install flex 2.5<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd \/usr\/local\/src <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget http:\/\/sourceforge.net\/projects\/flex\/files\/flex\/flex-2.5.35\/flex-2.5.35.tar.gz\/download?use_mirror=biznetnetworks <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> tar -zxvf flex-2.5.35.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd flex-2.5.35 <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> .\/configure <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> make <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> make install <\/strong><\/p>\n<p>To install setup tools<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd \/usr\/local\/src <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget http:\/\/peak.telecommunity.com\/dist\/ez_setup.py <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> \/usr\/local\/TRAC\/PYTHON\/bin\/python ez_setup.py <\/strong><\/p>\n<p>To install mysql-python<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd \/usr\/local\/src <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget http:\/\/sourceforge.net\/projects\/mysql-python\/files\/mysql-python\/1.2.3\/MySQL-python-1.2.3.tar.gz\/download?use_mirror=biznetnetworks <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> tar -zxvf MySQL-python-1.2.3.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd MySQL-python-1.2.3 <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> \/usr\/local\/TRAC\/PYTHON\/bin\/python .\/setup.py install <\/strong><\/p>\n<p><strong>Step 2 <\/strong><\/p>\n<p><strong> Linking the libraries <\/strong><br \/>\nAs you have installed the python to a custom location you have to link the libraries so as properly compile the mod_python<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> echo &#8220;\/usr\/local\/TRAC\/PYTHON\/lib\/&#8221; &gt; \/etc\/ld.so.conf.d\/python2.5.conf <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> ldconfig -v <\/strong><\/p>\n<p><strong>Step 3<\/strong><\/p>\n<p>Installing trac<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd \/usr\/local\/src <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget http:\/\/ftp.edgewall.com\/pub\/trac\/Trac-0.12.1.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> tar -zxvf Trac-0.12.1.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd Trac-0.12.1\/ <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> \/usr\/local\/TRAC\/PYTHON\/bin\/python setup.py  install <\/strong><\/p>\n<p><strong>Step 4 <\/strong><\/p>\n<p><strong>Installing mod_python and loading the module<\/strong><br \/>\nPlease note to give the apxs and python binary path correctly according to the installed location.<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget http:\/\/www.ecoficial.com\/apachemirror\/\/httpd\/modpython\/mod_python-3.3.1.tgz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> tar -zxvf mod_python-3.3.1.tgz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd mod_python-3.3.1\/ <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> .\/configure &#8211;with-apxs=\/usr\/sbin\/apxs  &#8211;with-python=\/usr\/local\/TRAC\/PYTHON\/bin\/python <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> make <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> make install <\/strong><\/p>\n<p>Please make sure that the module is loaded on the proper file which is included in apache conf or you can load the module directly in the main conf file ( httpd.conf )<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> echo &#8220;LoadModule python_module \/usr\/lib\/apache\/mod_python.so&#8221; &gt; \/etc\/httpd\/conf\/extra\/httpd-python.conf <\/strong><\/p>\n<p><strong>Step 5<\/strong><\/p>\n<p><strong>Creating a project<\/strong><br \/>\nCreate a mysql db\/db_user and grant all privileges to the database with a password<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> \/usr\/local\/TRAC\/PYTHON\/bin\/trac-admin  \/var\/project initenv <\/strong><em> desired_projectname<\/em> <strong>mysql:\/\/<\/strong><em>db_user:db_pass<\/em><strong>@localhost:3306\/<\/strong><em>db_name<\/em><\/p>\n<p><strong>Step 6<\/strong><\/p>\n<p><strong>Setting up a Login<\/strong><br \/>\nLimit the access with a login<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> htpasswd -c \/var\/project\/ .htpasswd admin <\/strong><\/p>\n<p><strong>Step 7<\/strong><\/p>\n<p><strong>Setup the VirtualHost<\/strong><br \/>\nOpen your Apache VirtualHost file and add the below lines into it<\/p>\n<p><em>&lt;Location \/project&gt;<\/em><\/p>\n<p><em>RewriteEngine Off\u00a0 ### to override any redirect rules on .htaccess of parent directory<br \/>\nSetHandler mod_python<br \/>\nPythonInterpreter main_interpreter<br \/>\nPythonHandler trac.web.modpython_frontend<br \/>\nPythonOption TracEnv \/var\/project<br \/>\nPythonOption TracUriRoot \/project<br \/>\nAuthType Basic<br \/>\nAuthName &#8220;Trac&#8221;<br \/>\nAuthUserFile \/var\/project\/.htpasswd<br \/>\nRequire valid-user<\/em><\/p>\n<p><em>&lt;\/Location&gt;<\/em><\/p>\n<p>You will be able to access the project trac now using<\/p>\n<p><strong>http:\/\/your_domain.com\/project<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview Installing trac on a server with Apache and mod_python Requirements Tested with the below , Apache 2.2 Mysql 5.0 Objective Installing trac and apache module mod_python for a project system on a domain subdirectory Configuration Step 1 Make sure that you have the required version of python , flew, setuptools and mysql-python installed. This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[49,56],"tags":[54,55,100],"_links":{"self":[{"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/posts\/425"}],"collection":[{"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=425"}],"version-history":[{"count":0,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/posts\/425\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}