Ubuntu - Install subversion over apache2 & trac
This article covers installation subversion over apache2 and trac so that it can be easily accessed from other systems on a public network. Multiple projects are supported in this installation.
1. install related packages
You can use the Synaptic Package Manager or the sudo apt-get install command to download and install packages. The following steps only show the sudo apt-get install method.
1) install subversion
sudo apt-get install subversion
Install apache2 (+apache2-mpm-worker, apache2-utils, apache2.2-common, apache2-doc & libapache2-svn)
sudo apt-get install apache2 libapache2-svn3) install trac
Install trac (+python-clearsilver, python-pysqlite2, python-subversion, libapache2-mod-python & libapache2-mod-python-doc)
sudo apt-get install trac libapache2-mod-python libapache2-mod-python-doc2. create svn repository
There are several typical places to put a subversion repository; most common places are: /srv/svn, /usr/local/svn & /home/svn. The following comand uses the /srv/svn:
sudo mkdir -p /srv/svnThe /srv/svn is a root directory for multiple projects. To create a project use the command like this:
sudo svnadmin create /srv/svn/project1The project1 is the project name, you can change to your project name. And then change the owner of the folder:
sudo chown -R www-data:www-data /srv/svn/projectModify the configuration file:
sudo vi /etc/apache2/mods-available/dav_svn.conf
<Location /svn>After the changes have been made, restart the apache2:
DAV svn
SVNParentPath /srv/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
&LimitExcept ...> </LimitExcept>
</Location>
sudo /etc/init.d/apache2 restartCreate user account and set password (please change bhduan to your own user account):
sudo htpasswd -cm /etc/apache2/dav_svn.passwd bhduan3. Create trac Environments Directory
sudo mkdir /srv/tracThis is the root directory for multiple projects. If you put your environment somewhere else, make sure to note that and use that location in the appropriate places in the next steps. To enable the trac site by the apache2 server:
cd /etc/apache2/sites-availableTo create and initialize the trac environment:
sudo cp default trac
sudo vi trac
<Location>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /srv/trac
PythonOption TracUrlRoot /trac
</Location>
sudo a2dissite default
sudo a2ensite trac
sudo /etc/init.d/apache2 reload
sudo trac-admin /srv/trac/project1 initenvPlease note that you must fill the correct svn path (/srv/svn), change the owner:
sudo chown -R www-data:www-data /srv/tracSet authenfication:
sudo vi /etc/apache2/sites-available/tracAdd the following lines before </Location>
<Location /trac>4. Create new project example
# ...
AuthType Basic
AuthName "Trac Projects"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>
The following example shows the steps to create a project named as linux:
1) Open a Terminal and change the current directory to /srv/svn
cd /srv/svn2) Create a new project named as linux
sudo svnadmin create linux3) Change the owner of the folder and its sub directories and files:
sudo chown -R www-data:www-data linux4) Change current directory to trac
cd /srv/trac5) Create and initialize the linux trac environment, set Project Name [My Project] > as Linux and set Path to repository [/path/to/repos]> to /srv/svn/linux, and use default value for other options:
sudo trac-admin /srv/trac/linux initenv6) Also change its owner
sudo chown -R www-data:www-data linux7) Change current directory to your project's working folder, the following just shows the empty project in a tmp foler:
mkdir ~/tmp8) Import the project to the svn
cd ~/tmp
mkdir branches tags trunk
svn import -m "original version for testing" ./ http://localhost/svn/linuxHere I use the localhost as the svn server address, you can change it to your real svn server ip address.
1 Comments:
the following two steps also required to enable your trac site:
1) sudo a2dissite default
2) sudo a2ensite trac
Post a Comment
Subscribe to Post Comments [Atom]
<< Home