How to Install and Configure ViewVC for Subversion on CentOS

Another alternative for subversion repositories web viewer is ViewVC. Just like WebSVN, viewvc having many useful features such as viewing subversion repositories, directories, to view change log listings and it can display specific versions of files as well as diffs between those versions. At the time of this post wrote, the most recent stable release of ViewVC is release 1.1.10.

Prerequisite :
1. How to Install Apache Httpd Web Server on Linux
2. How to Install Subversion on CentOS 5.5 Server

Steps to Install and Configure ViewVC.
1. Download ViewVC stable release 1.1.10
You can download using wget command on CentOS server as below:

    wget http://viewvc.tigris.org/files/documents/3330/48879/viewvc-1.1.10.tar.gz
    
    [root@server ~]# cd /tmp
    [root@server tmp]# wget http://viewvc.tigris.org/files/documents/3330/48879/viewvc-1.1.10.tar.gz
    --2011-04-03 19:09:06--  http://viewvc.tigris.org/files/documents/3330/48879/viewvc-1.1.10.tar.gz
    Resolving viewvc.tigris.org... 204.16.104.146
    Connecting to viewvc.tigris.org|204.16.104.146|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 602017 (588K) [application/x-gzip]
    Saving to: `viewvc-1.1.10.tar.gz'
    
    100%[===========================================>] 602,017     20.0K/s   in 29s
    
    2011-04-03 19:09:38 (20.3 KB/s) - `viewvc-1.1.10.tar.gz' saved [602017/602017]
    

2. Extract and unzip the viewvc-1.1.10.tar.gz using below command:

    [root@server tmp]# tar xvfz viewvc-1.1.10.tar.gz
    

3. Go to viewvc-1.1.10 directory and start the installation:

    ./viewvc-install
    
    [root@server tmp]# cd viewvc-1.1.10
    [root@server viewvc-1.1.10]# ./viewvc-install
    This is the ViewVC 1.1.10 installer.
    
    It will allow you to choose the install path for ViewVC.  You will now
    be asked some installation questions.  Defaults are given in square brackets.
    Just hit [Enter] if a default is okay.
    
    Installation path [/usr/local/viewvc-1.1.10]:
    
    DESTDIR path (generally only used by package maintainers) []:
    -
    -
    -
    -
    -
    -
    -
    ViewVC file installation complete.
    
    Consult the INSTALL document for detailed information on completing the
    installation and configuration of ViewVC on your system.  Here's a brief
    overview of the remaining steps:
    
      1) Edit the /usr/local/viewvc-1.1.10/viewvc.conf file.
    
      2) Either configure an existing web server to run
         /usr/local/viewvc-1.1.10/bin/cgi/viewvc.cgi.
    
         Or, copy /usr/local/viewvc-1.1.10/bin/cgi/viewvc.cgi to an
         already-configured cgi-bin directory.
    
         Or, use the standalone server provided by this distribution at
         /usr/local/viewvc-1.1.10/bin/standalone.py.
    

3. Edit /viewvc.conf for your specific
configuration. In particular, examine the following configuration options:

          svn_roots (for Subversion)
          root_parents (for CVS or Subversion)
          default_root
          root_as_url_component
          rcs_dir
          mime_types_files
    
    [root@server ~]# vi /usr/local/viewvc-1.1.10/viewvc.conf
    
        147 ## Example:
        148 ## root_parents = /opt/svn: svn,
        149 ##                /opt/cvs: cvs
        150 ##
        151 root_parents =
        152
    

Uncomment line 151 and define the subversion root repositories.

    root_parents = /svn/repos: svn,
    

4. Locate your Apache configuration file. Typical locations are:

    /etc/httpd/httpd.conf,
    /etc/httpd/conf/httpd.conf, and
    /etc/apache/httpd.conf.
    

Depending on how Apache was installed. Configure Apache to expose ViewVC to users at the URL of your choice. Edit the apache web server config file as below:

    [root@server ~]# vi /etc/httpd/conf/httpd.conf
    
    565 ScriptAlias /viewvc /usr/local/viewvc-1.1.10/bin/cgi/viewvc.cgi
    566 ScriptAlias /query /usr/local/viewvc-1.1.10/bin/cgi/query.cgi
    

or if without line number, it will be as below:

    ScriptAlias /viewvc /usr/local/viewvc-1.1.10/bin/cgi/viewvc.cgi
    ScriptAlias /query /usr/local/viewvc-1.1.10/bin/cgi/query.cgi
    
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the realname directory are treated as applications and
    # run by the server when requested rather than as documents sent to the client.
    # The same rules about trailing "/" apply to ScriptAlias directives as to
    # Alias.
    #
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
    ScriptAlias /viewvc /usr/local/viewvc-1.1.10/bin/cgi/viewvc.cgi
    ScriptAlias /query /usr/local/viewvc-1.1.10/bin/cgi/query.cgi
    #
    # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
    

5. Save the httpd.conf then restart the apache server.
6. Test your http://servername/viewvc. If everything properly configured, you should see the page that lists your repositories.

Comments

1 Comment

  • Avatar Sharafudheen says:

    Hi,

    I have installed viewvc-1.1.5. How to integrate viewvc with ldap authentication. I did succesfully on svn , but in viewvc, it is not working. P

Leave a Reply to Sharafudheen Cancel reply

Your email address will not be published. Required fields are marked *