Wednesday, June 12, 2013

SVN Server on CentOS 6 with Web Access

Before installing the SVN Server,disabled the SELinux:
sudo nano /etc/selinux/config



Make SELINUX=disabled:



Restart the Server!

To install SVN server, run this command at the command prompt:
sudo yum install httpd mod_dav_svn subversion



Make the Apache service to run automatically at boot time:
sudo chkconfig httpd on



Edit the subversion.conf file:
sudo nano /etc/httpd/conf.d/subversion.conf



Delete all the data and make it simple like this :
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

<Location /svn>
DAV svn
SVNParentPath /svn
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile /svnauth/auth
Require valid-user
</Location>



Now, we create a separate directory where we will keep the authentication file:
sudo mkdir /svnauth
sudo chown -R apache.apache /svnauth/
sudo htpasswd -cm /svnauth/auth arbab



We only need to use the -c option for the FIRST TIME, when you create a user, after that you will only use the -m option.

After that, we make the directory where we want to keep the svn repositories and also create testrepo inside:



Make sure we set the permissions of the /svn directory to apache with the following command:



Restart the apache service:
sudo service httpd restart



Configure the iptables rule in order to allow access to the svn server:
sudo iptables -I INPUT 4 -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
sudo service iptables save



Now if we go to http://server-ip/svn/testrepo using web browser,it will ask for username and password:



Once we enter the correct username and password, we should see that the repository is enabled!



Now, we have a working subversion server!

Hope this will help you!

No comments:

Post a Comment