SVN (Subversion) is an opensource version control system. it is used to store previous changes of your project files like documentation, coding etc. also you can track and identify who made the particular changes in the project files . Here in this article we can see how to setup SVN server on ubuntu 14.04 .
Setup SVN server on ubuntu 14.04
Let’s start the installation .
Step 1 » Issue the below command to update the repositories.
sudo apt-get update
Step 2 » After updating repositories , Issue the below command to install SVN and apache webserver (To access SVN through http ) .
sudo apt-get install subversion apache2 libapache2-svn apache2-utils
Step 3 » Now create a directory and create a new repository in that directory ( Here i’m using testrepo as repository name ).
sudo mkdir -p /svn/repos/
sudo svnadmin create /svn/repos/testrepo
Step 4 » Now change ownership for the repository.
sudo chown -R www-data:www-data /svn/repos/testrepo
Step 5 » Create a file testrepo.conf in /etc/apache2/sites-available/ and add the below lines for creating apache virtual host.
1
2
3
4
5
6
7
8
|
<Location /svn>
DAV svn
SVNParentPath /svn/repos/
AuthType Basic
AuthName “Test Repo”
AuthUserFile /etc/svnpasswd
Require valid–user
</Location>
|
SVNParentPath /svn/repos/ : Parent Directory without repository name.
AuthUserFile /etc/svnpasswd : File need to be created ( Step 8) for user details.
Step 6 » Issue the below command to enable the Site ( testrepo in the below command should match the file name created in the previous step )
sudo a2ensite testrepo
Step 7 » Now restart or reload apache service.
sudo service apache2 reload
Step 8 » Issue the command to create user for accessing repository and add the user details to /etc/svnpasswd file.
Use this command to create first user.
sudo htpasswd -cm /etc/svnpasswd user1
Use the same command without c option to create additional users.
sudo htpasswd -m /etc/svnpasswd ami
Step 9 » Now you can access http://yourip/svn/testrepo in your browser ( Eg http://192.168.1.7/svn/testrepo ) Enter your username and password:
you can see the page like below after successful authentication.
That’t it , your server is ready.
You could use svn clients such as Tortoisesvn on windows and Rapidsvn on ubuntu for commiting and updating repository.
For Windows
Here i am using Tortoisesvn so my client is windows
first we need to install Tortoisesvn
After that click all programmes>tortoisesvn>tortoise repository browser to open
enter your url info my case http://192.168.1.7/svn/testrepo/
It will ask your username and password see below :
This html file was created in windows through pop up menu add file option ie ami.html
User info:
Now check with your url : you can see the revision 3 I made three changes
We can go with revision 1 or 2 what we wanted later if we made anything done wrong coding.