Sun, 10 Oct 2004

HOWTO: Installing ViewCVS with Subversion on FC2

These are the installation instructions for Fedora Core 2.
I assume you have the following already installed:
  • yum repository support
  • current Apache RPM
  • current Python RPM
  • current mod_python RPM
  • Subversion 1.0.x client server and repository
If you don't have subversion installed it is easily installed with:
yum install subversion
If you don't have mod_python installed it is installed with:
yum install mod_python
You now must choose one of two options. To get the current HEAD version, which I haven't tested, do the following:
cvs -d :pserver:anonymous@cvs.sourceforge.net/cvsroot/viewcvs co viewcvs
The second option is to get the version I am using, which is tared here: viewcvs-1.0-dev-09012004.tgz. It is the HEAD revision from mid-day on September 1, 2004, and has no other special characteristics. You can download and untar it with the following commands:
wget http://www.baus.net/viewcvs-1.0-dev-09012004.tgz
tar zxvf viewcvs-1.0-dev-09012004.tgz
After doing one of the above change to the viewcvs directory:
cd viewcvs
There is an install script to get you started. Please note that it doesn't do everything necessary to get viewCVS running, but it is easy enough to run. The defaults are probably fine. Just press enter after each option. To run the script do the following:
./viewcvs-install 
You now need to configure Apache to call viewCVS, and you must tell viewCVS where your Subversion repositories are.

Let's start with Apache. Again, on Fedora Core 2:
cd /etc/httpd/conf.d 
You now need to create the file viewcvs.conf with the following contents. You can either paste the contents into your editor or using the cat command, paste the contents into the console window, then end the command with ctl-D. That's the true Linux hack way to do it. I assume you used the installation script defaults and viewCVS is installed at /usr/local/viewcvs-1.0-dev/. If not, edit ScriptAlias and PythonPath appropriately.
bash# cat > viewcvs.conf
ScriptAlias /viewcvs "/usr/local/viewcvs-1.0-dev/www/cgi/viewcvs.cgi"
<location /viewcvs>
   AddHandler python-program .py
   PythonPath "['/usr/local/viewcvs-1.0-dev/lib']+sys.path"
   PythonHandler apache
   PythonDebug On
</location> 
You now must configure viewCVS to find your Subversion repositories. There are two ways to do this. The first is to tell viewCVS where all your repositories are. The second is to tell it what subdirectory your repositories are stored in. I choose the second method, since it makes it easy to add repositories in the future.
cd /usr/local/viewcvs-1.0-dev/
Now edit the file viewcvs.conf.

Comment the svn_roots and cvs_roots lines out of the configuration using the # character. For instance, find the line:
cvs_roots = cvs: /home/cvsroot
and replace it with:
#cvs_roots = cvs:/home/cvsroot 
Again with subversion roots:
svn_roots = svn: /home/svnroot 
and replace it with
#svn_roots = cvs: /home/svnroot 
Uncomment the root_parents = line and replaced it with
root_parents = /path/to/my/repos : svn 
Of course put the proper repository path in place of /path/to/my/repos

Now modify default_root to point to your main repository. For instance:
default_root = myrepo 
In this case myrepo would be in the directory /path/to/my/repos/myrepo

Now restart Apache with:
service httpd restart 
Then use your web browser to view the repository:
http://myhostaddr/viewcvs 
You should see the current revision of your repository.

If you liked this article you might be interested in my qmake and subversion revision howto which is here.

permalink