Google

Thursday, January 1, 2009

Install trac - project management tool

I spent few days to install trac software in my machine. I learnt lot of things while installing this software. Here is the procedure I followed,

1) Start Web server

First it need to confirm web server is running. We can start is as a service by,
System -> Administration -> Services
enabling the httpd and starting it.

Then can test it is running by browsing it using, http://localhost

To allow acces to the outsiders, need to enable webserver as a trusted service in firewall,
System -> Firewall

And need to enable port forwarding in the router which is depend on the router type.

Then you can get the public assigned to the router by browsing the www.whatismyip.com

You should be able to access http://public_ip

2) Running a subversion server
install subversion using yum as root
yum install subversion
Create svn repository
svnadmin create /srv/svn/
make httpd can access all files in repository
chown -R apache.apache /srv/svn chmod g+s /srv/svn/db
then create password file
vim /srv/trac/conf/trac.htpasswd
then add user password to it
htpasswd -m /srv/trac/conf/trac.htpasswd charith
configure apache by editing /etc/httpd/conf.d/subversion.conf
add folowwing lines to it
    DAV svn    SVNPath /srv/svn    AuthType Basic    AuthName "svn"    AuthUserFile /srv/trac/conf/trac.htpasswd    Require valid-user  
restart httpd service. This service need to be running to be reload. If not it will out put as "failed"
/sbin/service httpd reload
then upload the code to the repository
svn import -m "intial upload" /home/charith/SvnTestfile:///srv/svn/SvnTest
Can test the subversion surver running properly by checking out the code to some other folder
svn co http://localhost/srv/svn/SvnTest
Make repository access by apache
chcon -R -h -t httpd_sys_content_t /srv/svn/

3) Installing trac
install trac using yum
yum install trac
create a directory to store trac project
mkdir -p /srv/trac
create new trac environment using trav-admin
trac-admin /srv/trac/test initenv
make folders own by apache
chown -R apache.apache /srv/trac
edit the file /etc/httpd/conf.d/trac.conf to point to new project environment
# Replace all occurrences of /srv/trac with your trac root below
# and uncomment the respective SetEnv and PythonOption directives.
    SetEnv TRAC_ENV /srv/trac/charith
   AuthType Basic
   AuthName "trac"
   AuthUserFile /srv/trac/conf/trac.htpasswd
   Require valid-user
    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnv /srv/trac/charith
restart httpd service. This service need to be running to be reload. If not it will out put as "failed"
/sbin/service httpd reload
Now you should be able to access the trac in local mahine using
http://localhost/cgi-bin/trac.cgi

If you have enable SELinux there are few things to do, I used following commands to enable web server to access trac and subversion repositories.
chcon -R -t httpd_sys_content_t /srv/trac chcon -R -t httpd_sys_content_t /srv/svn
Easiest thing is to view the SELinux warning message from the top pannel. It contains the command to configure the SELinux.

No comments: