InstallTRAC

De Slacam_Wiki
Ir para: navegação, pesquisa

Instalação do TRAC


I’m using Slicehost, but these instructions should work for any hosting provider running CentOS 5. I am not using Subversion (because it sucks and has been slain by Git). If you need SVN support, check out the posts by Nick or Daniel Skinner.

Install python and mod_python (for Apache)

       yum install python mod_python

Install MySQL-python

       Download the tarball from http://sourceforge.net/projects/mysql-python
       Compile the package:
       python setup.py build && python setup.py install

Install Clearsilver, a templating package needed by Trac Download Clearsilver from http://www.clearsilver.net/downloads/ Compile Clearsilver:

       ./configure –with-python=/path/to/python && make && make install

Note: My path to python is /usr/lib/python2.4 Install Trac Download Trac from http://trac.edgewall.org/wiki/TracDownload Setup Trac:

       python ./setup.py install

Create a Trac project I’m going to keep all of my Trac projects in /var/www/apps/trac, and for this example, I’ll call my project MyTracProject

      trac-admin /var/www/apps/trac/MyTracProject initenv

Give your project a name of your choosing, but accept the default for all other settings. Install TracWebAdmin Note: This is an optional step, if you would like to administer Trac from within Trac itself. Also, installation of this plugin is only necessary if you’re running Trac version 0.10 or earlier as 0.11 has integrated this plugin into the core Trac package. In a temporaty directory, grab the TracWebAdmin package:

       svn co http://svn.edgewall.com/repos/trac/sandbox/webadmin/
       cd webadmin
       python setup.py egg_info
       cp dist/TracWebAdmin-0.1.2dev_r5753-py2.4.egg /var/www/apps/trac/MyTracProject/plugins (Note: the actual filename may be different, depending on the build)

Enable the plugin by adding the following to your trac.ini found at /var/www/apps/trac/MyTracProject/conf/trac.in

       1.[components]
       2.webadmin.* = enabled

Define some Trac users Create a file to store your authorized users:

       touch /var/www/apps/trac/auth-file

Add a user to the file:

       htpasswd -m /var/www/apps/trac/auth-file <username>

Give admin permissions to the Trac user

       trac-admin /var/www/apps/trac/MyTracProject permission add <username> TRAC_ADMIN

Configure Apache Load mod_python by editing your httpd.conf (for me this is /etc/httpd/conf/httpd.conf) and add “LoadModule python_module modules/mod_python.so” I want to access Trac via http://trac.mytrackproject.com You’ll need a CNAME record in your DNS to support the trac.mytrackproject.com subdomain. You’ll also need to create a VirtualHost section in Apache’s httpd.conf file. For example:

       01.<virtualHost *:80>
       02. 
       03.ServerName trac.mytrackproject.com
       04. 
       05.<location />
       06.SetHandler mod_python
       07.PythonHandler trac.web.modpython_frontend
       08.PythonOption TracEnv /var/www/apps/trac/mytrackproject
       09.PythonOption TracUriRoot /
       10.</location>
       11.<location "/login">
       12.AuthType Basic
       13.AuthName "trac"
       14.AuthUserFile /var/www/apps/trac/auth-file
       15.Require valid-user
       16.</location>
       17. 
       18.</virtualHost>

Restart Apache: service httpd restart Go to http://trac.mytrackproject.com and start using Trac