BIP KB:
How To Set Up Subversion And Trac On Ubuntu
Article By BIP Admin
![]() |
In this tutorial you will learn now to set up Subversion version control system, with Trac, the project manager for software development projects, on a server running Ubuntu. |
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.
-
ServerName svn.example.com 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 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 ServerName svn.example.com Redirect / https://svn.example.com/ - 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 -p /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
ServerName trac.example.com Redirect / https://trac.example.com/ ServerName trac.example.com DocumentRoot /var/local/trac/trac.example.com/ Alias /trac/ /usr/share/trac/htdocs Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all 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 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 - Reference:
- http://trac.edgewall.org/wiki/TracOnUbuntu
- Enable the Trac virtual host.
- sudo a2ensite trac.example.com
- Configure Trac permissions. Once you're inside the administration console, execute the command "help permission" for information on how to do this. This is important because some settings are permissive by default, when they should be restrictive. Also, see the wiki page TracPermissions that comes with your new installation.
- trac-admin /var/local/trac/trac.example.com
- Restart the web server.
- sudo /etc/init.d/apache2 restart
Tags: ubuntu, education, Application, Server, Software, ersion control, set, setting up subversion, Subversion, sudo, Trac
Spin Up A VPS Server In No Time Flat
Simple Setup
Full Root Access
Straightforward Pricing
DEPLOY A SECURE VPS SERVER TODAY!Leave a Reply
Feedbacks
![]() This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. |