How to install svn on ubuntu 12.04

Subversion (SVN):

Subversion, otherwise known as SVN, is an open source version control system used to store historical changes of your project files such as documentation, coding etc.
This article helps you to install svn on ubuntu 12.04 .
also see the SVN installation on centos 6
Install svn server on centos 6

Install svn on ubuntu 12.04.

» Install and configure Apache2
» Install and configure SVN
» Testing
Before installing SVN, you have to install and configure Apache webserver.
Press ALT + CTR + T to open terminal.
Install and configure Apache
Step 1 » Issue the below command to install apache2.krizna@leela:~$ sudo apt-get install apache2
Step 2 » After installation open this file /etc/apache2/httpd.conf and add the below line to avoid warning during apache service restart .ServerName localhost
Step 3 » Restart apache service .krizna@leela:~$ sudo /etc/init.d/apache2 restart
Step 4 » Open http://ipaddress in your browser ( Eg: ) , you will get the page like below .
Install svn on ubuntu 12.04
Install and configure SVN.
Step 5 » Now start installing SVN server. Type the below command to install SVN packages.krizna@leela:~$ sudo apt-get install subversion libapache2-svn
Step 6 » After installation, plan as per your needs and start creating repositories.In my case i’m creating folder structure like /svn/repositoryname .krizna@leela:~$ sudo mkdir /svn
Step 7 » create a repository test using the below command.krizna@leela:~$ sudo svnadmin create /svn/test
Step 8 » Modify the permissions for the repository.krizna@leela:~$ sudo chown -R www-data:www-data /svn/test
Step 9 » Create a file to store user authentication details (/etc/subversion/reponame.users).krizna@leela:~$ sudo htpasswd -c /etc/subversion/test.users krizna
New password:
Re-type new password:
Adding password for user krizna
Here test.users is the filename and krizna is the username for accessing repository. you must omit -c to add additional users.

Step 10 » Create /etc/apache2/conf.d/svn.conf file and add the below lines.

<location /repos>
DAV svn
# SVN path
SVNParentPath /svn/
AuthType Basic
AuthName "Authorization Realm"
#password file path
AuthUserFile /etc/subversion/test.users
Require valid-user

Step 11 » Now restart apache service.
krizna@leela:~$ sudo /etc/init.d/apache2 restartYou have successfully installed and configured SVN server on ubuntu 12.04.
Step 12 » For a quick testing , you can access http://yourip/repos/reponame in your browser ( Eg ) and you can see the page like below after successful authentication.
Install svn on ubuntu 12.04
Step 13 » You can test checkout and commit using command line .
create a folder to checkout
krizna@leela:~$ mkdir svntest
checkout new copy to svntest folder using the below command.
krizna@leela:~$ svn co http://krizna@ svntest/
create some files.
krizna@leela:~$ cd svntest/
krizna@leela:~/svntest$ touch test1.txt
krizna@leela:~/svntest$ touch test2.txt

add the files before commit.
krizna@leela:~/svntest$ svn add test1.txt test2.txt
A test1.txt
A test2.txt

now commit the added files . you can add log message and close the editor.
krizna@leela:~/svntest$ svn commit
Adding test1.txt
Adding test2.txt
Transmitting file data ..
Committed revision 1.

Now open your repository in the browser , you can see the committed files.
Install svn on ubuntu 12.04
You can use svn clients such as Tortoisesvn for windows and Rapidsvn for ubuntu.
good luck


Leave a Reply

Your email address will not be published.