Check out subversion repositories with ViewVC

Vincent Danen covers the basics of Web-based ViewVC, which is a Web-frontend to both subversion and Concurrent Versions System (CVS). ViewVC is written in python and is extremely simple to install and use.

Subversion is a fantastic version control system that is useful for development, keeping track of configuration file changes, document revision history, and so much more. A number of tools exist for a variety of platforms that allow you to inspect the contents of a subversion repository, view history, generate diffs between revisions, and more. Some are free, some are commercial. All are, generally speaking, useful in that they allow you to nose around in a repository and track changes much easier than is possible to do with command line clients.

One such tool is the Web-based ViewVC, which is a Web-frontend to both subversion and Concurrent Versions System (CVS). ViewVC is written in python and is extremely simple to install and use. To begin, download the tarball archive.

Since it is meant to work with a Web browser, we will look at setting it up with Apache. You can run it as a stand-alone server, but in the case of subversion, you may already be using Apache to serve up the actual subversion repository via HTTP or HTTPS. Using ViewVC alongside it is easy and makes sense.

When you have downloaded the file, install it using the following commands:

# tar xvzf viewvc-1.0.7.tar.gz
# cd viewvc-1.0.7
# ./viewvc-install

It will ask for the installation directory; this can be anywhere outside of the Web root of your Web site. A good location may be /usr/local/viewvc. It will then compile the python bits and install all of the required files. If you are upgrading ViewVC, it will tell you which files differ and give the option of ignoring, replacing, or viewing the differences of the files. This allows you to upgrade easily without clobbering any customizations you have made.

Once the installation is done, edit your Apache configuration file. Instead of copying the ViewVC CGI scripts to your /cgi-bin/ directory, we will use the ScriptAlias directive to give prettier URLs and use the scripts in their installed location. The following should be added to any VirtualHost directive you wish to use ViewVC with:

   ScriptAlias  /viewvc /usr/local/viewvc/bin/cgi/viewvc.cgi
   ScriptAlias  /query  /usr/local/viewvc/bin/cgi/query.cgi

Configuring ViewVC is quite easy. Edit the /usr/local/viewvc/viewvc.conf file. You can tweak quite a few things here to change the look and feel of ViewVC, but to get started quickly you only need to add the paths to your subversion or CVS repositories. If you are using Subversion, comment out the cvs_roots directive and uncomment svn_roots. For instance:

#cvs_roots = cvs: /home/cvsroot
svn_roots = packages: /subversion/annvix/repos/packages,
            ports: /subversion/annvix/repos/ports,
            tools: /subversion/annvix/repos/tools

This defines three subversion repositories that will be visible from ViewVC: packages, ports, and tools. Define as many as required using the name: /path/to/repository syntax.

You may now visit the site at You will see the repository listing of the defined repositories, which you can then click through to look at history, files, generate diffs, annotate files, download files, and so on.

Get the PDF version here.

Delivered each Tuesday, TechRepublic's free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

By Vincent Danen

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.