Saturday, April 4, 2015

Installing SVN Repository in Linux

Steps for installing SVN repository installation in linux

1. Update pre-installed software:
# sudo yum update -y

2. If Apache is not installed (guide):
    # sudo yum groupinstall "Web Server" "MySQL Database" "PHP Support"
    # sudo yum install php-mysql
    # sudo service httpd start

3. Install subversion and mod_dav_svn (should see a long list of all changes):
# sudo yum install mod_dav_svn
# sudo yum install subversion

4. Edit the Apache configuration file for subversion:
# sudo vi /etc/httpd/conf.d/httpd.conf
    include the following lines

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
<VirtualHost *:70>
 <Location /repos>
DAV svn
SVNParentPath /var/www/svn
SVNListParentPath On
SVNPathAuthz On
AuthType Basic
AuthName "Subversion"
AuthUserFile /var/www/svn-auth/passwd
AuthzSVNAccessFile  /var/www/svn-auth/access
Require valid-user
Order deny,allow
Allow from all
  </Location>
</VirtualHost>

5. Modify the DocumentRoot and Listen port
DocumentRoot "/var/www"
Listen 70

6. Create the directory which will contain the subversion repository:
# sudo mkdir /var/www/svn

7. Create the directory which will contain the permissions files.
# sudo mkdir /var/www/svn-auth

Create the permission file:
# sudo vi /var/www/svn-auth/access
And fill it with (replace Eswar, Rajasekar, Simbu with your usernames):
[/]
Eswar = rw
Rajasekar = rw
Simbu = rw

8. Create and add to the password file (use -c the first time to create)
# sudo htpasswd -cb /var/www/svn-auth/passwd Eswar pwd
# sudo htpasswd -b /var/www/svn-auth/passwd Rajasekar pwd
# sudo htpasswd -b /var/www/svn-auth/passwd Simbu pwd

9. Create a repository (REPONAME is the name of your repository eg projectrepo):
    # cd /var/www/svn
    # sudo svnadmin create REPONAME

10. Change files authorization (again after creating new repos too):
# sudo chown -R apache.apache /var/www/svn /var/www/svn-auth
# sudo chmod 600 /var/www/svn-auth/access /var/www/svn-auth/passwd

11. Start apache web server:
    # sudo service httpd restart

Verify the subversion repo by opening in a browser:

http://YOUR_INSTANCE_IP/repos/REPONAME

You are done! Connect via Tortoise svn client using the url above.

No comments:

Post a Comment