ViewVC Installation and Configuration

ViewVC presents you with a nice browser interface to SVN and CVS
repositories. This is an installation document for ViewVC v1.1.5 on
RHEL 5.4. It depends on Python, but you should have that installed
on RHEL5 (for yum) anyway.

Download and Install

Get it here and extract the
tarball to a temporary location. Within, you will find viewvc-install,
a shell script which makes installation a breeze.

sudo ./viewvc-install  

I chose the installation directory at /var/www/html/viewvc. The
default is /usr/local/viewvc-1.1.5. Adapt to your liking.


All configuration is done via /var/www/html/viewvc/viewvc.conf. I’m
now going to set up ViewVC to see SVN and CVS repos on the same host.

Setting up the both Repositories

These are the only lines different from the original file:

cvs_roots = cvsroot: /home/cvs  
svn_roots = repository: /home/svn/repository  
root_parents = /home/svn : svn,  
               /home/cvs : cvs  
address =  
svn = /usr/bin/svn  
diff = /usr/bin/diff  
authorizer = svnauthz  
use_rcsparse = 1  
authzfile = /home/svn/repository/conf/authz

The configuration file is pretty nicely documented. The configuration
above respects the authz file for an SVN repo. Any user not authorized
to ‘see’ a project will not be able to do so, even via the web. Yay!

Telling Apache about ViewVC and securing the connection

In /etc/httpd/conf.d, create a config directive called viewvc.conf
and add the following:

ScriptAlias /viewvc "/var/www/html/viewvc/bin/cgi/viewvc.cgi"  
ScriptAlias /query "/var/www/html/viewvc/bin/cgi/query.cgi"

You will also want to prevent any external access. We will use LDAP and
SSL to secure access via Apache. The directives are similar to an SVN

<Location /viewvc>  
    # Integrate with LDAP server  
    AuthType Basic  
    AuthBasicProvider ldap  
    AuthName "CBCB SVN Server"  
    AuthzLDAPAuthoritative off  
    AuthLDAPURL "(ldap://,dc=directory,dc=example,dc=com?uid?sub)?(objectClass=*)"  
    Require valid-user  

Other Niceties


Displays a very nice graph
of revisions and branches for a given project. You can find it at
. Installation

yum install cvsgraph --enablerepo=epel  

The binary is /usr/bin/cvsgraph. Configuration is at
/etc/cvsgraph.conf. To configure ViewVC with it, append the following:

Under [utilities]  
  cvsgraph = /usr/bin/cvsgraph  
Under [options]  
  use_cvsgraph = 1  
  cvsgraph_conf = /etc/cvsgraph.conf  

I’ve included the config file since I enabled anti-aliasing.


This is a python package that prettifies source code views. You will
need the python-setuptools RPM. This installs (among other things) the
easy_install command which can be used to install Pygments and other
python packages.

yum install python-setuptools  
easy_install pygments

And you’re set! Your code displays should be spiffy now.

Custom Highlighting

I wanted to make .module for Drupal highlight as PHP files. For this,
I enabled/added the following to viewvc.conf:

mime_types_files = mimetypes.conf,  

This ensures that ViewVC is able to pass on to Pygments (the
highlighter) correct, comprehensive and custom MIME types. Now to enable
my custom config for .module files, I just add this to
mimetypes.conf (in the same folder):

application/x-httpd-php         php module


Rlog Errors

You might see this for a CVS project:

Error: Rlog output ended early. Expected RCS file...

To remedy this, you need to:

  1. Install RCS (yum install rcs)
  2. Tell Apache to serve them properly
  3. Make sure that the user Apache runs as can run
    rlog /home/cvs/filename.ext,v

For the latter, edit httpd.conf and find the following line:

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

Try removing the CVS and *,v entries.

If they’re still not solved

Just use the “experimental” rcsparse Python module. From this mailing

parser library instead of parsing the output of the RCS toolchain
keyword substitution).

Find use_rcsparse under [options] and set it to 1.