pantz.org banner
Installing Trac
Posted on 04-05-2009 19:58:02 UTC | Updated on 04-05-2009 20:29:31 UTC
Section: /software/trac/ | Permanent Link

Trac is an issue/bug tracking system for software development projects. It has a built in wiki for documentation and a broseable interface to Subversion or other version control systems. All interaction is done with a a web browser which makes it easy and fast. It is programmed in Python.

We will be installing Trac on CentOS 5. There are a few things you will need to know about the following install. This install will be using Trac's built in web server instead of using another web server to serve the content. It will use Sqlite as the back end database and Subversion for the version control system. Note that Trac has to be installed on the same server as Subversion so it can read the repositories.

All versions in the examples where the versions of the software at the time. You will have to substitute the latest version numbers in for your install. Do all of the installs below as the root user.

Pre-install setup

Before starting the install let's make sure we have the packages we need to get Trac working. In CentOS 5 you will need the packages python, sqlite, and python-sqlite. To install them just issue the yum command and package names. If they are already installed yum will just tell you it's already installed. No big deal.

yum install sqlite python-sqlite python

Installing Trac itself

To make installing Trac much easier we are going to use a Python program called setuptools. Setuptools let's you download, build, install, upgrade, and uninstall Python packages in a very easy manner. Setup tools includes a program called easy_install. This is what we are going to use to install Trac.

Let's get and install setuptools.

wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c9-py2.4.egg

Install easyinstall

sh setuptools-0.6c9-py2.4.egg

Now we can install trac using easyinstall

easy_install Trac

Now that Trac is installed we can add some helpful Trac plugins. Plugins are optional and don't need to be installed for Trac to work. Plugins just help extend the features of Trac from the base install.

Install the trac plugin "customfieldadminplugin" for adding custom fields in the db via the webadmin.

easy_install http://trac-hacks.org/svn/customfieldadminplugin/0.11

Install trac plugin "iniadminplugin" to give the admin acces to edit the ini file.

easy_install http://trac-hacks.org/svn/iniadminplugin/0.11

Install trac plugin "tracwysiwygplugin" to give wiki editor wisiwyg properties.

easy_install http://trac-hacks.org/svn/tracwysiwygplugin/0.11

Trac configuration

Now that Trac is installed we can create some Trac sites. You can have as many Trac sites as you like. Make sure you have any Subversion repositories setup now before you make any Trac sites. You could go back in later and add them but it's just easy to do during setup.

Lets make a dir for all the Trac sites to live in. Each site will get it's own dir with all of it's own files. A nice clean setup. I'm going to install the Trac sites to a dir called /disk01/trac.

mkdir /disk01/trac

Let's create a new Trac environment for the project. We will use SITE1 as the example site name.

trac-admin /disk01/trac/SITE1 initenv

Follow the prompts and answer the questions for the site. The example of the answers are below. What you call the project name is what that sitename will be.

Project Name [My Project]> SITE1
Database connection string [sqlite:db/trac.db]> [Enter]
Repository type [svn]> svn
Path to repository [/path/to/repos]> /disk01/svn/SITE1

Let's add a user so they have an account on the Trac site. The username can be anything. I'll use john in the example. The realm is the name of the Trac site above. The password is an MD5 sum of the tuple username:realm:password. I'll use blahblah as the password in the example.

echo -e "john:SITE1:blahblah\c" | md5sum | cut -d ' ' -f 1

The output if the line above will give you the MD5 sum: 452079cd32f63d0c405a708d5cb0d264. That is our password. We take that password and put it in the tuple line to get john:SITE1:452079cd32f63d0c405a708d5cb0d264. This is the line we will need to put in the /disk01/trac/SITE1/conf/.htpasswd file in the Trac sites configuration directory. Create the file with your favorite editor and put in the line and save it. You can make as many accounts as you want this way. An example file with a few accounts are below.

john:SITE1:452079cd32f63d0c405a708d5cb0d264
josh:SITE1:918ca1ef117fe702b52100a8acb16cf4

Now we need to make some changes to the Trac.ini file. This file has the config settings for the Trac site. Edit the file /disk01/trac/SITE1/conf/trac.ini. Add the following lines in each section of the file. If the lines exist then change the value to match the line below. These are just settings that I like to change you can change whatever you like. The [components] section is needed for plugins. Every time you add a plugin you have to enable it for each site. These will enable the plugins we installed. Webadmin plugin is part of the .11 release of Trac. You still have to enable it though.

[attachment]
max_size = 10262144

[ticket]
restrict_owner = true

[components]
webadmin.* = enabled
customfieldadmin.* = enabled
iniadmin.iniadmin.iniadminplugin = enabled
tracwysiwyg.* = enabled

Now we can make the admin for the Trac site. The admin username has to be a user in the /disk01/trac/SITE1/conf/.htpasswd file. So lets use john.

trac-admin /disk01/trac/SITE1 permission add john TRAC_ADMIN

Now that we have the new site created we need to add a line to the Trac startup. The line will be the Trac realm name used when making the line for the .htpasswd file. Tracd is the daemon that runs the Trac site. We will run Trac out of /etc/rc.local. In there you can put a line that looks like the following.

tracd -d -b 192.168.0.2 -e /disk01/trac/ \
--auth=SITE1,/disk01/trac/SITE1/conf/.htpasswd,SITE1 \
--auth=SITE2,/disk01/trac/SITE2/conf/.htpasswd,SITE2

This is the line used to start the Trac built in web server. It will start on port 80 by default and you can specify the ip for it to bind to if need be. If there is already a web server running on that machine just make an interface alias and add another ip and bind Trac to it. You can just copy and paste the start line above to the command line and execute it to see if it works. Just make sure you remove any sites you have not made already before you run it. If it works then throw that line in /etc/rc.local and it will start on boot.

After you start the Tracd deamon you can browse to your new Trac site with a web browser. It's just the hosts name with the name of the Trac site like for example http://trac.pantz.org/SITE1.

Keep adding as many sites as you like. Just keep making Trac environments and setting them up the way we just did. To backup the Trac sites just backup the directories you have the Trac sites in. For this example it would be /disk01/trac. It's that easy.

Del.icio.us! | Digg Me! | Reddit!

Related stories


RSS Feed RSS feed logo
About


3com
3ware
alsa
alsactl
alsamixer
amd
android
apache
areca
arm
ati
auditd
awk
badblocks
bash
bind
bios
bonnie
cable
carp
cat5
cdrom
cellphone
centos
chart
chrome
cifs
cisco
cloudera
comcast
commands
comodo
compiz-fusion
corsair
cpufreq
cpufrequtils
cpuspeed
cron
crontab
crossover
cu
cups
cvs
database
dbus
dd
dd_rescue
ddclient
debian
decimal
dhclient
dhcp
diagnostic
diskexplorer
disks
dkim
dns
dos
dovecot
drac
dsniff
dvdauthor
e-mail
echo
editor
emerald
ethernet
expect
ext3
ext4
fat32
fedora
fetchmail
fiber
filesystems
firefox
firewall
flac
flexlm
floppy
flowtools
fonts
format
freebsd
ftp
gdm
gmail
gnome
greasemonkey
greylisting
growisofs
grub
hacking
hadoop
harddrive
hba
hex
hfsc
html
html5
http
https
idl
ie
ilo
intel
ios
iperf
ipmi
iptables
ipv6
irix
javascript
kde
kernel
kickstart
kmail
kprinter
krecord
kubuntu
kvm
lame
ldap
linux
logfile
lp
lpq
lpr
maradns
matlab
memory
mencoder
mhdd
mkinitrd
mkisofs
moinmoin
motherboard
mouse
movemail
mplayer
multitail
mutt
myodbc
mysql
mythtv
nagios
nameserver
netflix
netflow
nginx
nic
ntfs
ntp
nvidia
odbc
openbsd
openntpd
openoffice
openssh
openssl
openvpn
opteron
parted
partimage
patch
perl
pf
pfflowd
pfsync
photorec
php
pop3
pop3s
ports
postfix
power
procmail
proftpd
proxy
pulseaudio
putty
pxe
python
qemu
r-studio
raid
recovery
redhat
router
rpc
rsync
ruby
saltstack
samba
schedule
screen
scsi
seagate
seatools
sed
sendmail
sgi
shell
siw
smtp
snort
solaris
soundcard
sox
spam
spamd
spf
sql
sqlite
squid
srs
ssh
ssh.com
ssl
su
subnet
subversion
sudo
sun
supermicro
switches
symbols
syslinux
syslog
systemrescuecd
t1
tcpip
tcpwrappers
telnet
terminal
testdisk
tftp
thttpd
thunderbird
timezone
ting
tls
tools
tr
trac
tuning
tunnel
ubuntu
unbound
vi
vpn
wget
wiki
windows
windowsxp
wireless
wpa_supplicant
x
xauth
xfree86
xfs
xinearama
xmms
youtube
zdump
zeromq
zic
zlib