Marilag Ang Malaya

Friday, January 23, 2009

Subversion on Ubuntu 8.10

Access methods
  1. file:/// - direct access on local machine
  2. http:// - using WebDAV
  3. https:// - SSL-encrypted
  4. svn:// - access via svnserve machine
  5. svn+ssh:// - SSH-tunneled
Installation Instructions
  1. Install the necessary packages:
    $ sudo apt-get install apache2 subversion libapache2-svn
  2. Create the group (to contain subversion users)
    $ sudo groupadd subversion
  3. Create the repository folders
    $ sudo mkdir /srv/svn
    $ cd !$
    $ sudo mkdir new_project
    $ sudo chown -R www-data:subversion new_project
    $ sudo chmod g+rws new_project
  4. Tell subversion to create subversion repository. I"t will create new files.
    $ sudo svnadmin create /srv/svn/new_project
  5. (Optional) If you want to use the WebDAV (http, https) methods, you will need to repeat the last two commands in § 3, and apply these to the new files generated by § 4.
    $ sudo chown -R www-data:subversion new_project
    $ sudo chmod -R g+rws new_project
Enabling WebDAV access
  1. Now, edit the /etc/apache2/mods-available/dav_svn.conf file, and add the following lines:
    <Location "/svn/new_project">
    DAV svn
    SVNPath /srv/svn/new_project
    AuthType Basic
    AuthName "My Project Subversion Repository"
    AuthUserFile /etc/subversion/passwd
    Require valid-user
    You may also point it to the "root" subversion folder /srv/svn if you wish to view the repositories of all projects that you are hosting.
  2. Restart the web server.
    $ sudo /etc/init.d/apache2 restart
  3. (Optional) If you want to use WebDAV with SSL, simply follow standard Apache SSL certificate use.
  4. Add the subversion users.
    $ sudo htpasswd -c /etc/subversion/passwd first_user
    $ sudo htpasswd /etc/subversion/passwd subsequent_users
  5. Check if the passwd file exists.
    $ cat /etc/subversion/passwd
  6. Check if we can access the repository.
    $ svn co http://hostname/svn/new_project new_project \
    --username first_user
Access using SVN protocol
  1. Edit the configuration file, /srv/svn/new_project/conf/svnserve.conf
  2. Uncomment the these lines in the configuration file:
    password-db = passwd
    N.B. These lines must not contain spaces before them.
  3. Edit the passwd file in the same folder and add a new user using this syntax:
    username = password
  4. Now, run the svnserver with this command:
    $ sudo svnserve -d --foreground -r /srv/svn
  5. Now, try to access the SVN using:
    $ svn co svn://hostname/new_project new_project \
    --username first_user
  6. You can now use SVN sub-commands to add/edit/delete files here.
Access using SVN+SSH protocol
  1. After enabling the SVN protocol above, enable SSH on the SVN server and create accounts for people who are given access.
  2. Check the access to the SVN using this command:
    $ svn co svn+ssh://hostname/srv/svn/new_project new_project \
    --username first_user
  3. N.B. You must use the full path of the SVN repository.
Subversion, Ubuntu Documentation, accessed 2009 January 23.

Labels: , , ,


Post a Comment

Subscribe to Post Comments [Atom]

<< Home