Install Trac

Install Packages

aptitude install trac trac-bzr trac-spamfilter
aptitude install python-mysqldb
aptitude install python-pypdf
aptitude install libtiff-tools

aptitude install vim
aptitude install sshfs
aptitude install libapache2-mod-wsgi
aptitude install mysql-server

Setup Mysql

mysql -u root -p

create database trac;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON trac.* TO 'trac'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Create Trac project

trac-admin /path/to/myproject initenv
#System will ask:
Project Name [My Project]> familytrac   (enter your project name)
Database connection string [sqlite:db/trac.db]> mysql://username:password@localhost:3306/databasename
#Example:
Database connection string [sqlite:db/trac.db]> mysql://trac:mysecretpassword@localhost:3306/trac
Repository type [svn]> bzr (I work with bzr,pick yours)
Path to repository [/path/to/repos]> (I don't currently have a repozitory, so I'll skip this part. I can add it later in trac.ini)

== Start Trac using apache modwsgi module ==
 *Create apache folder where we will create config files.
{{{
cd trac
mkdir apache
cd apache
htpasswd -c .htpasswd admin
htpasswd -c .htpasswd myname
htpasswd -c .htpasswd lucas
htpasswd -c .htpasswd mycoworkername

vi trac.wsgi

import os

os.environ['PYTHON_EGG_CACHE'] = '/path/to/trac/apache/eggs'

import trac.web.main
def application(environ, start_response):
  environ['trac.env_path'] = '/path/to/trac' 
  return trac.web.main.dispatch_request(environ, start_response)

vi trac

WSGIDaemonProcess trac threads=7 processes=8 maximum-requests=5000
WSGIProcessGroup trac
WSGIScriptAlias /trac /path/to/trac/apache/trac.wsgi

<Directory /path/to/trac/apache>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
</Directory>

<Location "/trac/login">
  AuthType Basic
  AuthName "Trac"
  AuthUserFile /path/to/trac/apache/.htpasswd
  Require valid-user
</Location>

cp trac /etc/apache2/sites-available/trac

chown www-data:www-data attachments
chown www-data:www-data conf

If you wanted to see if trac is working you could use:

tracd -p 8080 --basic-auth=*,/path/to/trac/apache/.htpasswd,

tracd -p 8080 --basic-auth=*,/path/to/trac/apache/.htpasswd,/path/to/trac/ /path/to/trac/

Create login file, add Users

cd trac
mkdir apache
cd apache
htpasswd -c .htpasswd admin
htpasswd -c .htpasswd lucas
htpasswd -c .htpasswd mycoworker

Give admin permissions

trac-admin /path/to/trac/ permission add admin TRAC_ADMIN
trac-admin /path/to/trac/ permission add lucas TRAC_ADMIN

Customize Milestone, components,version

=== Remove default milestones,version, components ===

trac-admin ./trac/ milestone remove milestone1
trac-admin ./trac/ milestone remove milestone2
trac-admin ./trac/ milestone remove milestone3
trac-admin ./trac/ milestone remove milestone4

trac-admin ./trac/ version remove 1.0
trac-admin ./trac/ version remove 2.0

trac-admin ./trac/ component remove component1
trac-admin ./trac/ component remove component2

Add custom milestones,version, components

trac-admin ./trac/ version add 2008
trac-admin ./trac/ version add 2009
trac-admin ./trac/ version add 2010
trac-admin ./trac/ version add 2011
trac-admin ./trac/ version add 2012

trac-admin ./trac/ milestone add Incoming
trac-admin ./trac/ milestone add Bills
trac-admin ./trac/ milestone add Vehicles
trac-admin ./trac/ milestone add Home
trac-admin ./trac/ milestone add School
trac-admin ./trac/ milestone add Medical

trac-admin ./trac/ component add None somebody
trac-admin ./trac/ component add ComEd somebody
trac-admin ./trac/ component add Att  somebody
trac-admin ./trac/ component add Nicor somebody
trac-admin ./trac/ component add CellPhone somebody
trac-admin ./trac/ component add CityOf somebody
trac-admin ./trac/ component add Other  somebody

Auto Upload

XML-RPC

aptitude install trac-xmlrpc

python fax2trac.py /home/lucas/ScanFolder/mydocument.pdf

Modify trac.ini

#Add
#[components]
#tracbzr.* = enabled
#tracrpc.* = enabled
#acct_mgr.admin.AccountManagerAdminPage = enabled

#
#[ticket-custom]
#claim_number=text
#claim_number.label= Claim Number
#
#policy_number=text
#policy_number.label=Policy Number
#agency_number=text
#agency_number.label=Agency Number

vi ./trac/conf/trac.ini

default_type = task

* Change attachment file size:

max_size = 52480000

default_milestone =Incoming
default_component =None

Backup

mysqldump --user=root -p trac >trac_db_backup.sql

mysql -u root -p
create database trac;
exit;

mysql -u root -p trac < /tmp/trac_db_backup.sql

mysql -u root -p
grant usage on trac.* to trac@localhost identified by 'somepassword';
grant all privileges on trac.* to trac@localhost;
FLUSH PRIVILEGES;
{{{
cd /home/trac/
scp -r username@server:/home/trac/trac ./

aptitude install mysql-server

MyWiki: FaxServer/Trac (last edited 2011-10-01 19:15:24 by LukaszSzybalski)