This howto outlines the process by which one can set up the Subversion version control system, and have it work in tandem with Trac, the project manager for software development projects, on a server running Ubuntu (or possibly Debian). It is brought to you by Openject Consulting.
Setting up Subversion
For detailed information on this, including alternate setups, have a look at Version Control with Subversion.
-
- Install the required packages.
- sudo aptitude install enscript libapache2-mod-python python-docutils trac db4.3-util libapache2-svn subversion-tools
-
- Create a virtual host directory for SVN. We’ll use /var/local/svn instead of /var/www so that Subversion instances don’t clog up the directory of web root directories.
- sudo mkdir -p /var/local/svn/svn.example.com
-
- Create a development group, and add the web user to it.
- sudo addgroup example; sudo adduser www-data example
-
- Add users to the development group. These are persons that need access to the repository.
-
- sudo adduser username1 example
- sudo adduser username2 example
- sudo adduser username3 example
-
- Set the proper permissions.
- sudo chmod 2770 /var/local/svn/svn.example.com
-
- Set up the repository.
- sudo svnadmin create /var/local/svn/svn.example.com
-
- Clear the current password file. By default it’s for the svnserve protocol, but we’ll be using HTTPS (or just HTTP). We’ll be adding users to this file later in the process.
- sudo rm /var/local/svn/svn.example.com/conf/passwd
sudo touch /var/local/svn/svn.example.com/conf/passwd
-
- Allow the group to write to the repository.
- sudo chmod -R g+w /var/local/svn/svn.example.com
-
- Set proper file ownership.
- sudo chown -R www-data:example /var/local/svn/svn.example.com
-
- Set the repository access permissions. Information on how to do this can be found in the Path-Based Authorization section of Version Control with Subversion.
- sudo vi /var/local/svn/svn.example.com/conf/authz
-
- Create a directory for the log files.
- sudo mkdir /var/log/apache2/svn.example.com
-
- Add the site to the log rotation list.
- sudo vi /etc/logrotate.d/apache2
-
- Configure the virtual host…
- sudo vi /etc/apache2/sites-available/svn.example.com
- …with the following data. If you don’t care about SSL, you can ignore the SSL options and run this on port 80.
-
<VirtualHost [server's IP address]:443> ServerName svn.example.com <Location /> DAV svn AuthType Basic AuthName "svn.example.com" AuthUserFile /var/local/svn/svn.example.com/conf/passwd AuthzSVNAccessFile /var/local/svn/svn.example.com/conf/authz SVNPath /var/local/svn/svn.example.com Require valid-user </Location> CustomLog /var/log/apache2/svn.example.com/access.log combined ErrorLog /var/log/apache2/svn.example.com/error.log SSLEngine on SSLCertificateFile /etc/apache2/ssl/apache.pem # Add this once there is a real (non self-signed) certificate. # SSLCertificateKeyFile /etc/apache2/ssl/server.key </VirtualHost> <VirtualHost [server's IP address]:80> ServerName svn.example.com Redirect / https://svn.example.com/ </VirtualHost>
- Reference:
- /etc/apache2/mods-enabled/dav_svn.conf
-
- Enable the subversion virtual host.
- sudo a2ensite svn.example.com
-
- Create user/password combinations.
- htpasswd /var/local/svn/svn.example.com/conf/passwd username
-
- Restart the web server.
- sudo /etc/init.d/apache2 restart
-
- If you’re going to have users working locally, set up svnwrap. (See the man page for details.)
- sudo ln -s /usr/bin/svnwrap /usr/local/bin/svn
Setting up Trac
-
- Create the web directory. We’ll use /var/local/trac instead of /var/www so as not to clog up the directory of webroots.
- sudo mkdir /var/local/trac/trac.example.com
-
- Set the proper permissions.
- sudo chmod 2770 /var/local/trac/trac.example.com
-
- Create a Trac instance.
- sudo trac-admin /var/local/trac/trac.example.com initenv
-
- Set proper ownership on the web directory.
- sudo chown -R www-data:example /var/local/trac/trac.example.com
-
- Allow the group to write to the repository.
- sudo chmod -R g+w /var/local/trac/trac.example.com
-
- Configure it.
- sudo vi /var/local/trac/trac.example.com/conf/trac.ini
-
- Create a directory for the log files.
- sudo mkdir /var/log/apache2/trac.example.com
-
- Add the site to the log rotation list.
- sudo vi /etc/logrotate.d/apache2
-
- Configure the virtual host…
- sudo vi /etc/apache2/sites-available/trac.example.com
- …with the following data. If you don’t care about SSL, you can skip the SSL options and run this on port 80.
-
# Trac Configuration <VirtualHost [server's IP address]:80> ServerName trac.example.com Redirect / https://trac.example.com/ </VirtualHost> <VirtualHost [server's IP address]:443> ServerName trac.example.com DocumentRoot /var/local/trac/trac.example.com/ Alias /trac/ /usr/share/trac/htdocs <Directory "/usr/share/trac/htdocs/"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <Location /> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonInterpreter main_interpreter PythonOption TracEnv /var/local/trac/trac.example.com/ PythonOption TracUriRoot / AuthType Basic AuthName "trac.example.com" # Use the SVN password file. AuthUserFile /var/local/svn/svn.example.com/conf/passwd Require valid-user </Location> CustomLog /var/log/apache2/trac.example.com/access.log combined ErrorLog /var/log/apache2/trac.example.com/error.log SSLEngine on SSLCertificateFile /etc/apache2/ssl/apache.pem # Add this once there is a real (non self-signed) certificate. # SSLCertificateKeyFile /etc/apache2/ssl/server.key </VirtualHost>
- Reference:
- http://trac.edgewall.org/wiki/TracOnUbuntu
-
- Enable the Trac virtual host.
- sudo a2ensite trac.example.com
-
- Restart the web server.
- sudo /etc/init.d/apache2 restart
The last thing to do is add the subdomains “svn” and “trac” to the DNS configuration for your domain. Once this is done, Subversion and Trac will be integrated into your server environment, and will be accessible from the web.
Hmm is anyone else experiencing problems with the pictures on this blog loading?
I’m trying to figure out if its a problem on my end or if it’s the blog.
Any suggestions would be greatly appreciated.
Thank you very much, but why wasn’t the fix to the Expose9 floating stauts bar included on it? If you activate Expose9 while the stauts bar is hidden on Chrome (e.g. page has already loaded and there is nothing to display), a phantom, transparent stauts bar is added to the Expose9 row – something that does not occur if the Status Bar is actually showing something.A bug has already been filled and properly closed for the nightlies…