Here in this article we will try to setup a basic SVN server on ubuntu 14.04 OS.
Test Environment
Ubuntu 14.04 OS installed
Procedure
Step1: Install the subversion package from the repository
sudo apt-get install subversion
|
Step2: Verify the version of the subversion package that is installed
$ dpkg-query --show subversion
subversion 1.8.8-1ubuntu3.1
|
Step3: Create a new group and user id for accessing the svn repository
$ sudo groupadd svn
$ cat /etc/group | grep svn
svn:x:1002:
|
$ sudo useradd svn -g svn -c "svn user" -p svn
$ cat /etc/passwd | grep svn
svn:x:1002:1002:svn user: /home/svn :
|
Step4: Now create a svn home directory and repository directory for the project
$ sudo mkdir -p /opt/subversion/svn
$ sudo svnadmin create /opt/subversion/svn/repos
|
Step5: Change the ownership on the repos directory to svn group and user svn
$ cd /opt/subversion/svn
$ sudo chown -R svn:svn repos
|
Step6: Set the group id to svn so that any new files added into the repos directory have proper permission
$ cd /opt/subversion/svn/
$ sudo chown -R svn:svn repos
|
Step7: Install and configure the apache http server
$ sudo apt-get install libapache2-svn
$ sudo apt-get install apache2
|
Edit the below file as shown if not already present.
$ vi /etc/apache2/mods-available/dav_svn .load
LoadModule dav_module /usr/lib/apache2/modules/mod_dav .so
LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn .so
|
Edit the below file for creating apache virtual host as shown below.
$ vi /etc/apache2/mods-available/dav_svn .conf
|
Update the /etc/apache2/mods-available/dav_svn.conf file as below.
<Location /svn >
DAV svn
SVNParentPath /opt/subversion/svn
SVNListParentPath On
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
Require valid-user
< /Location >
|
Step8: Install the below package for using the htpasswd utility
$ sudo apt-get install apache2-utils
|
Step9: Add user svn for accessing the repository into /etc/subversion/passwd
$ sudo htpasswd -cm /etc/subversion/passwd svn
|
Additional users could be added without using the ‘c’ option.
Step10: Restart the apache service
$ sudo service apache2 restart
|
Step11: Access the repository using the below url
URL: http: //localhost/svn/
|
Step12: Check out and Check in files to the repository as below
$ sudo svn checkout http: //localhost/svn/repos
|
$ echo “Hello world” > Hello.txt
|
$ sudo svn commit Hello.txt -m “commiting test file ”
|
Hope you enjoyed reading this article. Thank you.
Leave a Reply
You must be logged in to post a comment.