Version 37 (modified by 16 years ago) ( diff ) | ,
---|
Trac on Ubuntu
These instructions were tested with a fresh install of 8.04, and installs Trac 0.11.
Also see TracInstallPlatforms, TracInstall, TracOnUbuntu, Ubuntu-Trac, hardy, cgi.
OS Installation
You can have a Ubuntu instance running on a real hardware or virtual machine session using VMWare or VirtualBox.
The Ubuntu machine info
me@ubuntu:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=8.04 DISTRIB_CODENAME=hardy DISTRIB_DESCRIPTION="Ubuntu 8.04.1" me@ubuntu:~$
Trac 0.11 Installation
1. Install Software Packages
To install Trac on your system, install apache, setuptools and some libraries:
sudo apt-get install apache2 libapache2-mod-python \ libapache2-svn python-setuptools subversion python-subversion sudo easy_install Trac
Install clearsilver if you want to install Bitten
sudo apt-get install python-clearsilver
2. Create the Trac Environments Directory
You'll need a directory for Trac's environments to live that should be writable by the default Apache user:
sudo mkdir /var/lib/trac sudo chown www-data:www-data /var/lib/trac
3. Setup Apache2
Next, create a new Apache-2 virtualhost, and paste the text below into the file:
sudo vi /etc/apache2/sites-available/trac
<VirtualHost *> ServerAdmin webmaster@localhost ServerName trac.example.com DocumentRoot /var/www ErrorLog /var/log/apache2/error.trac.log CustomLog /var/log/apache2/access.trac.log combined <Location /projects> SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracEnvParentDir /var/lib/trac PythonOption TracUriRoot /projects PythonOption PYTHON_EGG_CACHE /tmp </Location> # use the following for one authorization for all projects # (names containing "-" are not detected): <LocationMatch "/projects/[[:alnum:]]+/login"> AuthType Basic AuthName "trac" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user </LocationMatch> </VirtualHost>
Now, disable the default virtualhost, enable the Trac virtualhost, and restart Apache2:
sudo a2dissite default sudo a2ensite trac sudo /etc/init.d/apache2 reload
4. Creating Environments
SVN
I installed my Subversion repository at /var/lib/svn/YourProjectNameHere
. So I did a quick starting config of subversion with the following commands:
sudo mkdir /var/lib/svn sudo svnadmin create /var/lib/svn/YourProjectNameHere
Some permissions changes and an apache restart are now needed:
sudo chown -R www-data /var/lib/svn sudo chown -R www-data /usr/share/trac sudo /etc/init.d/apache2 reload
References: Commands populate files into SVN repository
Trac
I put my trac environment at /var/lib/trac/YourProjectNameHere
. Of course you could use any other path or name - something a little more descriptive of your project would probably be a good idea. First I ran these commands:
sudo mkdir /var/lib/trac sudo trac-admin /var/lib/trac/YourProjectNameHere initenv sudo chown -R www-data /var/lib/trac
The "trac-admin" command shown above prompted me to enter:
- the project name (
YourProjectNameHere
) - the path to svn repository (
/var/lib/svn/YourProjectNameHere
)
… then it prints out a bunch of stuff. If there are no errors you should now be able to surf to your Trac site at http://servername/projects
For more complex mod_python configs, see TracModPython
5. get subversion running as well
You will also need to uncomment the settings in /etc/apache2/mods-available/dav_svn.conf
<Location /svn> # Uncomment this to enable the repository, DAV svn # Set this to the path to your repository SVNParentPath /var/lib/svn </Location>
6. Add some plugins to have a usable system
There are still some software dependency issue need to be resolved using apt-get. Lots of Trac plugins depened on system software like htmldoc,enscript. Check your trac.log to see the complaining when depeneded software not installed.
Install more apt-get package for trac plugins later
sudo apt-get install build-essential graphviz sudo apt-get install htmldoc sudo apt-get install enscript
Using Easy_install to install more Trac plugins
sudo easy_install http://svn.edgewall.org/repos/genshi/trunk/ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk sudo easy_install http://trac-hacks.org/svn/customfieldadminplugin/0.11 sudo easy_install http://trac-hacks.org/svn/eclipsetracplugin/tracrpcext/0.10 sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11 sudo easy_install http://trac-hacks.org/svn/masterticketsplugin/0.11 sudo easy_install http://trac-hacks.org/svn/pagetopdfplugin/0.10/ sudo easy_install http://trac-hacks.org/svn/progressmetermacro/0.11 sudo easy_install http://trac-hacks.org/svn/ticketdeleteplugin/0.11 sudo easy_install http://trac-hacks.org/svn/tracwysiwygplugin/0.11 sudo easy_install http://wikinotification.ufsoft.org/svn/trunk
7. what one should probably do different than described here
sudo chown www-data /etc/apache2/dav_svn.passwd
Testing
Make sure trac's password file is writable by www-data user
me@ubuntu:~$ ls -l /etc/apache2/dav_svn.passwd -rw-r--r-- 1 www-data root 21 2008-09-23 21:03 /etc/apache2/dav_svn.passwd me@ubuntu:~$
Check the trac install directories layout
me@ubuntu:~$ tree -as /var/lib/trac/ /var/lib/trac/ `-- [ 4096] YourProjectNameHere |-- [ 98] README |-- [ 27] VERSION |-- [ 4096] attachments |-- [ 4096] conf | |-- [ 7025] trac.ini | |-- [ 4755] trac.ini.new | `-- [ 4187] trac.ini.sample |-- [ 4096] db | |-- [ 349184] trac.db | `-- [ 324608] trac.db.21.bak |-- [ 4096] htdocs |-- [ 4096] log | `-- [ 84562] trac.log |-- [ 4096] plugins | `-- [ 4096] TracWebAdmin-0.1.2dev-py2.5.egg | |-- [ 4096] EGG-INFO | | |-- [ 278] PKG-INFO | | |-- [ 335] SOURCES.txt | | |-- [ 1] dependency_links.txt | | |-- [ 218] entry_points.txt | | |-- [ 1] not-zip-safe | | `-- [ 9] top_level.txt | `-- [ 4096] webadmin | |-- [ 523] __init__.py | |-- [ 218] __init__.pyc | |-- [ 1594] basics.py | |-- [ 1682] basics.pyc | |-- [ 4096] htdocs | | |-- [ 4096] css | | | `-- [ 1900] admin.css | | |-- [ 4096] img | | | |-- [ 218] collapsed.png | | | `-- [ 227] expanded.png | | `-- [ 4096] js | | `-- [ 1286] admin.js | |-- [ 3930] logging.py | |-- [ 3133] logging.pyc | |-- [ 2659] perm.py | |-- [ 2585] perm.pyc | |-- [ 9247] plugin.py | |-- [ 8720] plugin.pyc | |-- [ 4096] templates | | |-- [ 954] admin.cs | | |-- [ 685] admin_basics.cs | | |-- [ 2961] admin_component.cs | | |-- [ 2202] admin_enum.cs | | |-- [ 1669] admin_log.cs | | |-- [ 3898] admin_milestone.cs | | |-- [ 1521] admin_perm.cs | | |-- [ 3167] admin_plugin.cs | | `-- [ 2901] admin_version.cs | |-- [ 16312] ticket.py | |-- [ 13250] ticket.pyc | |-- [ 5579] web_ui.py | `-- [ 6505] web_ui.pyc |-- [ 4096] snapshots `-- [ 4096] templates `-- [ 151] site.html 17 directories, 42 files me@ubuntu:~$
See the installed plugins in .egg format
me@ubuntu:~$ ls -d /usr/lib/python2.5/site-packages/*.egg /usr/lib/python2.5/site-packages/Bitten-0.6dev_r559-py2.5.egg /usr/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg /usr/lib/python2.5/site-packages/Genshi-0.6dev_r960-py2.5-linux-i686.egg /usr/lib/python2.5/site-packages/IniAdmin-0.2-py2.5.egg /usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg /usr/lib/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg /usr/lib/python2.5/site-packages/TracCustomFieldAdmin-0.2-py2.5.egg /usr/lib/python2.5/site-packages/TracExtendedXmlRpc-0.1-py2.5.egg /usr/lib/python2.5/site-packages/TracMasterTickets-2.1.3-py2.5.egg /usr/lib/python2.5/site-packages/TracPageToPDF-0.2-py2.5.egg /usr/lib/python2.5/site-packages/TracProgressMeterMacro-0.1-py2.5.egg /usr/lib/python2.5/site-packages/TracTicketDelete-2.0-py2.5.egg /usr/lib/python2.5/site-packages/TracWebAdmin-0.1.2dev-py2.5.egg /usr/lib/python2.5/site-packages/TracWikiNotification-0.2.0-py2.5.egg /usr/lib/python2.5/site-packages/TracWysiwyg-0.2_r4214-py2.5.egg me@ubuntu:~$