SVN or Subversion:

A subversion or svn is an open source version control management system. It is used to maintain the project team and the historical changes of you project while working in a team development. It can keep track of all changes made by the individual developer in your organization. As it can maintain all historical records once if we face any problem with the up-gradation or if we need to rollback to a previous stage of development you can easily rollback to that specific date of specific point of changes made. So in a team development every developer will have their individual user account in the svn, which will keep your projects safe from unauthorized access. In this article I will show you how to install svn with apache dav_svn in your ubuntu Linux machine. So go through the following steps to complete the installation: -

install svn with apache dav_svn on ubuntu

 

Install subversion or svn in Ubuntu Linux:

To install svn in your ubuntu Linux you have to go through the following steps.

  • Make your repository up-to-date.
  • Install subversion, Subversion Tools and Libapache2 package and Apache2 server.
  • Install Apache2 utilities.
  • Creating your first repository in SVN
  • Secure your repository with username and password.
  • Importing your project in SVN repository.

 

Make your repository update using the following command:

sudo apt-get update

Install subversion, Subversion Tools and Libapache2 package and Apache2 server:

Type the following command in the terminal to install subversion and Apache2 Server and press Enter

sudo apt-get install subversion subversion-tools libapache2-svn apache2

So, once the installation becomes complete, open your browser and type localhost in the browser address bar and you will find something as follows

install apache server and subversion

 

Install Apache2 utilities:

After successful installation of subversion and Apache2 server now its time to install some of the utilities of apache2. To install apache2 utilities type the following command in the terminal

sudo apt-get install apache2-utils

Restart your apache server using the following command:

sudo /etc/init.d/apache2 restart

Creating you first repository in SVN:

After installing the SVN, its time to create your first repository. To create a repository, first of all create a folder structure where you will keep your repository.

Step – 1: Suppose in this case I am going to create the folder in the following mentioned path.

sudo mkdir /usr/local/svn

Step – 2: Create a repository project1 using the following command.

sudo svnadmin create /usr/local/svn/project1

Step – 3: Change the permission for the repository using the following command.

sudo chown -R www-data:www-data /usr/local/svn/project1


Secure your repository with username and password:

Step – 4: Create a file to store the users authentication details. The user name and the password for the users who will access the repository.

sudo htpasswd -cm /etc/apache2/dav_svn.passwd username1
New password:
Re-type new password:
Adding password for user username

Note: Add -c for the first time you create a user account. Do not add -c each time because it will delete or override the previously created user accounts. Add more user using the same command except -c.

sudo htpasswd -m /etc/apache2/dav_svn.passwd username2

Step – 5: Now its time to map your svn repository location and the user authentication file location. To do this edit the file apache2.conf under /etc/apache2/apache2.conf using the following command

sudo gedit  /etc/apache2/apache2.conf

and add the following lines at the bottom of the file

<Location /usr/local/svn>
   DAV svn
   # Path of your svn directory    
   SVNParentPath /usr/local/svn/
   AuthType Basic
   AuthName "project1"
   #Path of the user account file
   AuthUserFile /etc/apache2/dav_svn.passwd
   Require valid-user
</Location>

Step – 6: Restart your apache2 server using the following command.

sudo /etc/init.d/apache2 restart

So far you have successfully installed and configured your svn. Now you can import your project in the svn repository.

Importing your project in SVN repository:

Step – 7: To import your project in the svn repository type the following command.

sudo svn import /your/project/folder/location http://your/svn/repository/location

Ex: sudo svn import /opt/lampp/htdocs/myproject http://192.168.254.3/usr/local/svn/project1

Check Page Rank