Você pode ler este post em português também.
TRAC is the best open source SCM tool that I’ve listened. The Fedora distribution is a widely used GNU/Linux.
At the end of this article I’ll also show how to use it with the GIT, making it a version control system too.
Let’s do it!
- Packages installation:
yum install wget python python-devel python-setuptools python-genshi python-docutils python-pygments policycoreutils-python
yum install httpd httpd-tools mod_python
yum install python-offtrac trac trac-accountmanager-plugin trac-customfieldadmin-plugin trac-doxygen-plugin trac-iniadmin-plugin trac-privateticketsplugin trac-ticketdelete-plugin trac-tracnav-plugin trac-xmlrpc-plugin
- Creation of the TRAC environment on filesystem. We’ll call the base directory of your project of BASE_DIR (that’d be, for instance, /var/www/html/nome_projeto/scm). The commands
restorecongive to the TRAC files the same context of Apache to the SeLinux. Obviously, you can ignore them if your SeLinux is disabled:
trac-admin BASE_DIR initenv
chown -R apache.apache BASE_DIR
semanage fcontext -at httpd_sys_content_t "BASE_DIR(/.*)?"
semanage fcontext -at httpd_sys_content_rw_t "BASE_DIR/attachments(/.*)?"
semanage fcontext -at httpd_sys_content_rw_t "BASE_DIR/conf(/.*)?"
semanage fcontext -at httpd_sys_content_rw_t "BASE_DIR/db(/.*)?"
semanage fcontext -at httpd_sys_content_rw_t "BASE_DIR/log(/.*)?"
chown -R apache:apache BASE_DIR
restorecon -R BASE_DIR
- Creation of the user which will does the administration of the TRAC environment for the project. We’ll call this user ADMIN_USER:
htpasswd -c BASE_DIR/conf/trac.htpasswd ADMIN_USER
permission add ADMIN_USER TRAC_ADMIN
- To modify the Apache configuration. First, we’ll add an alias and a directory tag pointing to the base directory of TRAC (ScriptAlias e Directory). After, we’ll configure the specific directives for the environment (Location). Just to remind you, these directives could be, if necessary, inside a VirtualHost container:
ScriptAlias /trac/ "BASE_DIR/" <Directory "BASE_DIR"> AllowOverride None Options None Order allow,deny Allow from all </Directory> <Location /trac> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv BASE_DIR PythonOption TracUriRoot /trac SetEnv PYTHON_EGG_CACHE /tmp PythonInterpreter trac </Location> <Location /trac/login> AuthType Basic AuthName "Name of the project" AuthUserFile BASE_DIR/conf/trac.htpasswd Require valid-user </Location>
- The last step is to restart the Apache:
service httpd restart
Everything is done! Point your browser to access the TRAC environment (maybe the famous http://localhost/trac/) e have fun!
If you want use GIT as a plugin of TRAC, do the steps below, additionaly:
- Install GIT and the git plugin of the TRAC:
yum install git GitPython
yum install trac-git-plugin
- Modify the file BASE_DIR/conf/trac.ini as follow:
- The line repository_dir should point to same directory of the HEAD file of your repository (normally REPO_DIR/.git);
- Add the lines below to the end of file:
tracext.git.* = enabled
- The source directory must have its read and write permissions assigned to Apache.
The five steps above will give you a TRAC environment ready for use. To improve it and adapt it to your needs, visit the website TracHacks where there are many plugins for download.
See you 😉