Monday, 27 September 2010

Installing subversion on Ubuntu 10.04 Lamp server

This post is going to outline the steps i took to successfully install subversion on my LAMP server

First you need to add a new group call subversion, to do so you need to first enable viewing all users, to do this press ALT + F2. A run window would pop just like windows run command prompt, enter the following

  • gconf-editor
Now navigate to /apps/gnome-system-tools/users and click showall and close the window.


Go into System> Administration > Users and Groups and add a new group called subversion, add yourself and the user www-data to it. Press OK to save changes and close the window once done.

Fire up your terminal window and type sudo su admin rights


navigate to the root directory by

  • cd /
Then type:

  • mkdir /svn
  • cd /svn
  • mkdir /tester
Create an SVN repository by typing the following:

  • svnadmin create /svn/tester
Then type the following to correct the permissions:

  • chown -R www-data:subversion tester
  • chmod -R g+rws tester
To access the svn repository via your browser you have to tell apache where it is located. Firstly you have to install a package do so by typing the following:

  • apt-get install libapache2-svn

Now you will have to edit the dav_svn.conf file to tell it where the repositories are located, i like to have all the repositories listed when i type http://localhost/svn. To do so type the following at the terminal prompt:

  • gedit /etc/apache2/mods-available/dav_svn.conf

Once the text editor opens, type the following,


<Location /svn>
     DAV svn
     SVNParentPath /svn
     SVNListParentPath On
     AuthType Basic
     AuthName "Subversion Repository"
     AuthUserFile /etc/subversion/passwd
     <LimitExcept GET PROPFIND OPTIONS REPORT>
        Require valid-user
     </LimitExcept>
  </Location>

and hit save, close the editor.

Restart apache now by typing the following at the terminal prompt:

  • /etc/init.d/apache2 restart
Now that you have SVN setup you will have to create a password file for authentication, a -c delimiter will be used to create the file and then all other users will be added without the -c

  • htpasswd -c /etc/subversion/passwd user_name
It will prompt you for a password and then to confirm the password.

To add more users simply type the following at the terminal prompt:

  • htpasswd /etc/subversion/passwd Second_user_name


You should now be able to access your svn repository by pointing your browser to

  • http://localhost/svn
Happy Developing

--Eddy

No comments:

Post a Comment