User Tools

Site Tools


blog:install_and_use_subversion_svn_and_viewvc_on_ubuntu

Install and Use Subversion (svn) and ViewVC on Ubuntu

Install Subversion with Web Access on Ubuntu

  1. To install subversion, open a terminal and run the following command:
    sudo apt-get install subversion libapache2-svn
  2. To create a folder for the subversion repository in /svn, use
    sudo svnadmin create /svn
  3. Edit the configuration file for the subversion webdav module.
    sudo nano /etc/apache2/mods-enabled/dav_svn.conf


    The Location element in the configuration file dictates the root directory where subversion will be acessible from, for instance: http://128.143.XX.XX/svn
    In the file uncomment the following lines

    <Location /svn>
    
    DAV svn
    
    #The SVNPath line should be set to the same place 
    #your created the repository with the svnadmin command.
    
    # Set this to the path to your repository
    SVNParentPath /svn
    
    # Uncomment the following 3 lines to enable Basic Authentication
    AuthType Basic
    AuthName “Subversion Repository”
    AuthUserFile /etc/apache2/dav_svn.passwd
    Require valid-user ## add this line
  4. To create a user on the repository, use the following command:
    sudo htpasswd -cm /etc/apache2/dav_svn.passwd <username>


    Type in password when required.

  5. If the password file exists, use the following command:
    sudo htpasswd -m /etc/apache2/dav_svn.passwd <username>


    Type in password when required.

  6. Restart apache by running the following command:
    sudo /etc/init.d/apache2 restart
  7. Now if you go in your browser to http://128.143.XX.XX/svn. Input username and password created when required.

Use SVN

  1. Create a repos using
    $ svnadmin create /svn/repos1

    on the server

  2. In the local computer, check out the repos1 by using
    svn checkout http://128.143.XX.XX/svn/repos1
  3. Now add a new or update a file on the server
    1. Create a file
      nano test.txt
    2. Add it to repos1
      svn add test.txt
    3. Upload it to the sever to repos1
      svn commit test.txt -m "Initial readme file"

Install ViewVC on Ubuntu

  1. In the terminal
    sudo apt-get install viewvc
  2. Edit SVN configuration file
    sudo nano /etc/apache2/mods-enabled/dav_svn.conf

    Add the following line in the file

    ScriptAlias /viewvc /usr/lib/cgi-bin/viewvc.cgi

    at the end of the file

  3. Edit the file
    /etc/viewvc/viewvc.conf

    Change the root_parents to

    root_parents = /svn : svn
  4. Restart apache by running the following command:
    sudo /etc/init.d/apache2 restart
  5. Visit
    http://128.143.XX.XX/viewvc/viewvc.cgi

Access control for ViewVC

By default, anyone can access ViewVC. To control access using the rules for svn. Open the svn configure file using

sudo nano /etc/apache2/mods-enabled/dav_svn.conf

and add the following at the end

<Location /viewvc>                                        
 AuthType Basic
 AuthName "ViewSVN"
 AuthUserFile /etc/apache2/dav_svn.passwd
 Require valid-user
 </Location>
You could leave a comment if you were logged in.
blog/install_and_use_subversion_svn_and_viewvc_on_ubuntu.txt · Last modified: 2016/01/24 09:48 by 127.0.0.1