Random thoughts shooting out of volatile mind
Installing and configuring Subversion with Apache on Ubuntu
To install the Subversion a popular version control system in Ubuntu or Debian based distro's follow the following steps. I'm configuring subversion with apache webserver using dav_svn module of apache2.
1. Get the subversion and tools using following command
sudo apt-get install subversion subversion-tools

2. If you have not already install apache2 install using following command
sudo apt-get install apache2

3. Install the subversion module for apache i.e mod_dav_svn. Use the following command
sudo apt-get install libapache2-svn
Next is to create and configure a repository to work with. I've created a folder called svn in / folder inside which all repositories reside. You can choose any folder of your choice.
1. Create a directory svn under root partition i.e /
sudo mkdir svn
2. Create a folder for your project with which you want to use subversion. Taking project name is myproject here is the procedure to create svn repository
cd /svn
sudo mkdir myproject
sudo svnadmin create myproject
The svnadmin create command creates the repository. Next is to configure Apache server for serving this repository. Open the file /etc/apache2/mods-available/dav_svn.conf in your favourite editor. (Note you need to have su rights to save changes). Add the following lines
<Location /svn/myproject>
   DAV svn
   SVNPath /svn/myproject
   AuthType Basic
   AuthName "Subversion repository for myproject"
   AuthUserFile /etc/subversion/passwd
   Require valid-user
</Location>
SVNPath points to your repository. AuthType Basic means requires authentication. Now you need to create AuthFile i.e passwd file and also need to create the users for the repository. First lets see how to create the users.
1. Go to repository folder and enter the conf directory. i.e
cd /path/to/repository/conf

2. edit the authz file. You may need to use sudo for that purpose. add the following lines.
[group]
commiter=vasudev
developer=somedeveloper

[repository:/]
@commiter=rw
@developer=r
I always use this way you can create individual user and give them permissions though. [group] tells svn the groups of user for this repository. Second set i.e [repository:/] this is used to give permissions on particular folder tree under repository (normally repository will have trunk tag branches directory). The permission here applies to all the folder (i.e trunk tag branches). You can customize permission on each folder using several these sections. (If you use so be sure to put the root section at the end )

3. Next is creating the password file. I chose /etc/subversion folder to place my password file. Use the htpasswd command to create the password for each user mentioned in each group of authz file. After you are done reload the apache using following command
sudo /etc/init.d/apache2 reload

4. Next is trunk tags and branches import. Create directories /tmp/myproject /tmp/myproject/trunk /tmp/myproject/tags /tmp/myproject/branches folder. And use the following command
svn import /tmp/myproject http://localhost/svn/myproject -m "Initial directory imports"

SVN will ask for the user name and password and then adds the directories to your repository. Once this is done you can use the svn import to import your existing project work to the trunk of the repository.

Well thats it you can access your repository by following http://localhost/svn/myproject from your browser or using any clients or IDE plugins. If you want nice UI while accessing the svn from browser you can either install view vc for apache2 or use WebSVN. Well let me write a post on Websvn, till then C ya.








Posted by: copyninja on Sunday, 21 February 2010

blog comments powered by Disqus
Fork me on GitHub