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: -
To install svn in your ubuntu Linux you have to go through the following steps.
sudo apt-get update
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
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
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
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
# Path of your svn directory
#Path of the user account file
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.
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