Installing Trac on the Hostmonster or Bluehost

Installing Trac on the Hostmonster or Bluehost

Popular content

Donate to Us


Who's online

There are currently 0 users and 18 guests online.

Installing Trac on the Hostmonster or Bluehost

This guide was made primarily to help Hostmonster customers setup Trac. However, the setup is generic enough, that with only little modification, this guide can be applied to any shared-hosting setup running the Apache webserver (or if you want to use cgi for some reason). To work, you will need access to shell, and have basic understanding of text editing in shell. Hostmonster provides python2.3, and easy subversion repository setup - so these are assumed to already be in place.

Also, because I do not like the login hack described on the Hostmonster Trac Wiki, I have assumed that you will install one of the login plugins. However, if you have access to the Apache setup file and do not wish to use a login manager, you can use the account setup method outlined in the Trac wiki.

My installed Trac

http://trac.heidisoft.com

Requirements
Please use fresh copy of the shared host, NUKE process will do that, ask it from support.

Warning:
When you copy a string from here make sure the correct syntax is there (Eg: ",` ... ).
In the "wget" some of them should have "" in the URL string make sure to put those too.

Python
I found installing a local copy of python to be unnecessary, as the extra modules can be installed in the trac's lib path. To assure access to these libs, the PYTHONPATH environment variable must reference the aforementioned path.

Environmental Variables


Add this to ~/.bash_profile:
export PYTHONPATH="$HOME/packages/lib/python2.3/site-packages"
export LD_LIBRARY_PATH="$HOME/packages/lib"
export PATH="$HOME/packages/bin:$PATH"
source ~/.bash_profile

Installation

Setup

I recommend making a special directory for the install files and packages; this makes it easier to manage, and you can delete the entire directory of install files at the end. I used ~/packages and ~/install_files personally, and will be using them throughout these instructions - so if you want to use another directory, just replace all references.


* cd
* mkdir install_files
* mkdir packages
* mkdir trac_sites

Install Trac (0.10.3)


* cd ~/install_files
* wget http://ftp.edgewall.com/pub/trac/trac-0.10.3.tar.gz
* tar zxf trac-0.10.3.tar.gz
* cd trac-0.10.3
* python setup.py install --prefix=$HOME/packages


Install Clearsilver (0.10.4)


* cd ~/install_files
* wget http://www.clearsilver.net/downloads/clearsilver-0.10.4.tar.gz
* tar zxf clearsilver-0.10.4.tar.gz
* cd clearsilver-0.10.4
sed -i "s@/usr/local/bin/python@/usr/bin/env python@g" \
scripts/document.py
PYTHON_SITE=`/home/{username}/packages/bin/python -c \
"import sys; print [path for path in sys.path if \
path.find('site-packages') != -1][0]"` \
./configure --with-python=/home/{username}/packages/bin/python \
--prefix=$HOME/packages \
--disable-ruby --disable-java --disable-apache --disable-csharp --disable-perl
* make
* make install


Install SQLite (3.3.13)


* cd ~/install_files
* wget http://www.sqlite.org/sqlite-3.3.13.tar.gz
* tar zxf sqlite-3.3.13.tar.gz
* cd sqlite-3.3.13
* ./configure --prefix=$HOME/packages
* make
* make install
* ln -s $HOME/packages/bin/sqlite3 $HOME/packages/bin/sqlite


Install PySQLite (2.3.3)


* cd ~/install_files
* wget http://initd.org/pub/software/pysqlite/releases/2.3/2.3.3/pysqlite-2.3.3...
* tar zxf pysqlite-2.3.3.tar.gz
* cd pysqlite-2.3.3
* In setup.py, change
include_dirs = [] to include_dirs = ['$HOME/packages/include']
and
library_dirs = [] to library_dirs = ['$HOME/packages/lib']
* python setup.py build
* python setup.py install --prefix=$HOME/packages


Install SWIG (1.3.31)


* cd ~/install_files
* wget http://dl.sourceforge.net/sourceforge/swig/swig-1.3.31.tar.gz
* tar zxf swig-1.3.31.tar.gz
* cd swig-1.3.31
* ./configure --prefix=$HOME/packages --with-python=/usr/bin/python
* make
* make install


Install Subversion (1.4.3)


* cd ~/install_files
* wget http://subversion.tigris.org/downloads/subversion-1.4.3.tar.gz
* tar zxf subversion-1.4.3.tar.gz
* cd subversion-1.4.3
* ./configure PYTHON=/usr/bin/python --prefix=$HOME/packages \
--with-swig=$HOME/packages/bin/swig --without-berkeley-db \
--with-ssl --with-zlib
* make
* make install
* make swig-py
* make install-swig-py
* cd ~/packages/lib/python2.3/site-packages
* echo $HOME/packages/lib/svn-python > subversion.pth
* ln -s ~/packages/lib/svn-python/libsvn
* ln -s ~/packages/lib/svn-python/svn
* Test it with python -c "from svn import client" (No errors should result.)


Setup Trac Environment


* trac-admin $HOME/trac_sites/{your trac project id} initenv
("{your trac project id}" can be anything you like. Putting all your Trac environments in your trac_sites directory allows for simpler backup!)
You will be asked for
o Project Name: {Whatever you want}
o Database connection string: {Accept the default (just hit return)}
o Type of version control: {Accept the default (just hit return)}
o Path to repository: /home/{yourusername}/svn/{your svn project id}
o Templates directory: {Accept the default (just hit return)}
* trac-admin $HOME/trac_sites/{your trac project id} will put you into interactive mode. You can issue a simple help at the prompt to see what you can do. There are lots of administrative actions in interactive mode that can make your life a little easier than it would be if you always had to go through the WebAdmin interface.
You should add at least one user with admin powers. To do this, in interactive mode:
o permission add admins TRAC_ADMIN
o permission add {username} admins
o exit (to quit interactive mode)
During interactive mode, permission list should show the new users on the list.


Make Trac Web Accessible


* cd ~/{my.domain.name}
* Make index.cgi (make sure to set the permissions so the webserver can read it - 775):
#!/bin/bash
export HOME="/home/{username}"
export TRAC_ENV="$HOME/trac_sites/{your trac project id}"
export PYTHONPATH="$HOME/packages/lib/python2.3/site-packages"
export PATH="$HOME/packages/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/packages/lib"
exec $HOME/packages/share/trac/cgi-bin/trac.cgi
Then set the default by editing .htaccess:
DirectoryIndex index.cgi

Now direct your browser in to the {my.domain.name} you must see the Trac project page,if not go to the CPanel and PHP Config, and install PHP.ini Master file. That's all. :).
For any question contact me : heshanmw (at) gmail.com

Prettiness

Pretty URLs


Setup static mapping

This allows the common static files (images, CSS, javascript, etc) to be accessed directly, rather than mapping through the cgi script. (This makes Trac faster, while providing compatibility with the prettiness.)


* cd ~/{domain name}
* mkdir chrome
* ln -s $HOME/packages/share/trac/htdocs ./chrome/common
Setup Rewrite Rule
Edit .htaccess located in the {domain name} directory
DirectoryIndex index.cgi
Options ExecCGI FollowSymLinks

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.cgi/$1 [L]

This will prefix any failed request with index.cgi (to run it through Trac).

Hack the Trac base_url

This sets any links Trac generates to ignore the file generated from, and just start from the directory, rather than the file that processed the generation. (/blarg/foobar, instead of /blarg/index.cgi/foobar)


* cd $HOME/packages/lib/python2.3/site-packages/trac/web
* Backup the original api.py in case you want to revert.
cp api.py api.py.backup
* Edit api.py, change
base_path = property(fget=lambda self: self.environ.get('SCRIPT_NAME', ''),
doc='The root path of the application')
to base_path = property(fget=lambda self: os.path.dirname(self.environ.get('SCRIPT_NAME', '')),
doc='The root path of the application')

Plugins

Setup Tools

We'll be using this to install the other plugins; so it is necessary to install this to follow my steps.


* cd ~/install_files
* wget http://peak.telecommunity.com/dist/ez_setup.py
* python ez_setup.py --prefix=$HOME/packages


WebAdmin Plugin


* cd ~/install_files
* svn co http://svn.edgewall.com/repos/trac/sandbox/webadmin/
* cd webadmin
* python setup.py egg_info
* python setup.py bdist_egg
* cd dist
* easy_install --prefix=$HOME/packages *.egg
* Now tell trac to load the plugin by editing $HOME/trac_sites/{your trac project id}/conf/trac.ini and adding to the components section:
[components]
webadmin.* = enabled


AccountManager Plugin

NOT COMPATIBLE WITH DbAuth

This will make the htpasswd login method much more pleasing. New users can register on their own using the site, and they can change their passwords if necessary. This also allows login via form, rather than the HTTP authentication.


* cd ~/install_files
* svn co http://trac-hacks.org/svn/accountmanagerplugin/0.10 accountmanagerplugin
* cd accountmanagerplugin
* python setup.py bdist_egg
* cd dist
* easy_install --prefix=$HOME/packages *.egg
* You must add an initial user, to create the initial trac.htpasswd file:
htpasswd -c ~/trac_sites/trac.htpasswd {username}
You'll then enter the password twice.
* Now tell trac to load the plugin by editing $HOME/trac_sites/{your trac project id}/conf/trac.ini and adding to the components section:
[components]
trac.web.auth.LoginModule = disabled
acct_mgr.* = enabled
[account-manager]
password_format = htpasswd
password_file = /home/{your username}/trac_sites/trac.htpasswd


DbAuth Plugin

NOT COMPATIBLE WITH AccountManager

Makes more sense than the normal login method. However it does not support new user registration like AccountManager, rather, you are required to enter all users in manually using sqlite. Because of this, I use AccountManager instead.


* cd ~/install_files
* svn co http://trac-hacks.org/svn/dbauthplugin/0.10 dbauthplugin
* cd dbauthplugin
* python setup.py bdist_egg
* cd dist
* easy_install --prefix=$HOME/packages *.egg
* cd ../install
* cp dbauth.db ~/trac_sites
* chmod 775 ~/trac_sites/dbauth.db
* Now you need to add some users; you'll have to do this manually. You'll probably want to add the same username(s) as you setup earlier.
o sqlite ~/trac_sites/dbauth.db
o INSERT INTO trac_users VALUES ('all', 'username', 'passwd', 'email@email.com');
INSERT INTO trac_permissions VALUES ('all', 'username', 'admins');
o .quit
* Now tell trac to load the plugin by editing $HOME/trac_sites/{your trac project id}/conf/trac.ini and adding to the components section:
[components]
trac.web.auth.* = disabled
dbauth.* = enabled
#trac.userdir.* = enabled # only if you want to use this
[central]
database = /home/{your username}/trac_sites/dbauth.db
envroot = /home/{your username}/trac_sites/{your trac project id}


IniAdmin Plugin

Adds the ability to configure trac.ini via a web interface.


* cd ~/install_files
* svn co http://trac-hacks.org/svn/iniadminplugin/trunk/ iniadmin
* cd iniadmin
* python setup.py bdist_egg
* cd dist
* easy_install --prefix=$HOME/packages *.egg
* Now tell trac to load the plugin by editing $HOME/trac_sites/{your trac project id}/conf/trac.ini and adding to the components section:
[components]
iniadmin.* = enabled


TracNav Plugin

Adds ability to add navigation elements to wiki pages.


* cd ~/install_files
* svn co http://svn.ipd.uni-karlsruhe.de/repos/javaparty/JP/trac/plugins/tracnav/
* cd tracnav
* python setup.py bdist_egg
* cd dist
* easy_install --prefix=$HOME/packages *.egg
* Now tell trac to load the plugin by editing $HOME/trac_sites/{your trac project id}/conf/trac.ini and adding to the components section:
[components]
tracnav.* = enabled


Cleanup

Now that you have everything setup the way you want, you can go ahead and delete all those setup files, and switch to fast_cgi

Delete setup files

Since you won't be using those setup files after you're done, if you don't want all those setup files to take up hard drive space, you can delete them.


* cd
* rm -rf install_files

Reference : http://natmaster.com/articles/installing_trac_0.10.php

Share/Save
9.44444
Average: 9.4 (9 votes)
Your rating: None
Tags
Comments

Hello

I have followed all the details from this page and managed to start Trac. However I am not able to see any plugins on my website after installing them. I first installed the plugins in the ~/install_files directory as mentioned in this email, I beleive this installs the plugins globally and requires adding the component details to trac.ini which I have done.

As this did not change anything in the front end of my trac site, I also installed the plugins in the local project's plugin directory as well the same way mentioned in the above post but no luck. I do not know what I am missing, maybe something I am very sure of. Here are the version details I am working on.

Hosted on HostMonster Shared server:
OS: CentOS release 4.7 (Final)
Python: Python 2.3.4
clearsilver-0.10.5
pysqlite-2.3.3
sqlite-amalgamation-3.6.10
subversion-1.4.3
swig-1.3.38
trac-0.10.5

Please help.

Are you running on a Shared Host?

Good walkthrough, thanks. I don't see anyplace in Hostmonster cPanel that has to do with Subversion, so i'm curious how one is supposed to tell Apache about the repos. This typically done with a VirtualHost definition. Without this, repo browsing through Trac will work but ci/co won't. Cheers

Post new comment

 
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.