Subversion is a open source version control system that will manages files and will keep the changes made to the files. With Subversion, it can help you to recovers the older files and directories and also to examine the history of your files and directories how they are changed all over time. This post will discuss how you can install and configure Subversion 1.8 on CentOS 6.5
1. Prepare WANdisco repo :
[root@centos6-05 ~]# wget opensource.wandisco.com/RPM-GPG-KEY-WANdisco -O /tmp/RPM-GPG-KEY-WANdisco
[root@centos6-05 ~]# wget opensource.wandisco.com/RPM-GPG-KEY-WANdisco -O /tmp/RPM-GPG-KEY-WANdisco --2014-03-11 23:29:59-- http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco Resolving opensource.wandisco.com... 54.248.108.17 Connecting to opensource.wandisco.com|54.248.108.17|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1759 (1.7K) [application/octet-stream] Saving to: â/tmp/RPM-GPG-KEY-WANdiscoâ 100%[==========================================================>] 1,759 --.-K/s in 0.003s 2014-03-11 23:30:00 (665 KB/s) - â/tmp/RPM-GPG-KEY-WANdiscoâ
2. Import RPM-GPG-KEY-WANdisco. Once imported, it safe to delete :
[root@centos6-05 ~]# rpm --import /tmp/RPM-GPG-KEY-WANdisco [root@centos6-05 ~]# rm -rf /tmp/RPM-GPG-KEY-WANdisco
You can get more subversion file from the followings :
http://opensource.wandisco.com/rhel/6/svn-1.8/RPMS/x86_64/
3. Configure WANdisco repo file :
[root@centos6-05 ~]# vi /etc/yum.repos.d/WANdisco-1.8.repo
[WANdisco] name=WANdisco SVN Repo 1.8 enabled=1 baseurl=http://opensource.wandisco.com/rhel/6/svn-1.8/RPMS/ gpgcheck=1
4. Install subversion using yum install :
[root@centos6-05 ~]# yum install subversion mod_dav_svn -y
Full installation screen :
[root@centos6-05 ~]# yum install subversion mod_dav_svn -y Loaded plugins: fastestmirror Determining fastest mirrors epel/metalink | 5.2 kB 00:00 * Webmin: download.webmin.com * base: centos.ipserverone.com * epel: epel.mirror.net.in * extras: centos.ipserverone.com * updates: centos.ipserverone.com WANdisco | 951 B 00:00 WANdisco/primary | 65 kB 00:00 WANdisco 309/309 Webmin | 951 B 00:00 Webmin/primary | 21 kB 00:00 Webmin 168/168 base | 3.7 kB 00:00 base/primary_db | 4.4 MB 00:45 epel | 4.2 kB 00:00 epel/primary_db | 6.0 MB 01:51 extras | 3.4 kB 00:00 extras/primary_db | 19 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 2.1 MB 00:18 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mod_dav_svn.x86_64 0:1.8.8-1 will be installed ---> Package subversion.x86_64 0:1.8.8-1 will be installed --> Processing Dependency: libserf-1.so.1()(64bit) for package: subversion-1.8.8-1.x86_64 --> Running transaction check ---> Package serf.x86_64 0:1.3.2-2 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: mod_dav_svn x86_64 1.8.8-1 WANdisco 77 k subversion x86_64 1.8.8-1 WANdisco 2.2 M Installing for dependencies: serf x86_64 1.3.2-2 WANdisco 43 k Transaction Summary ==================================================================================================== Install 3 Package(s) Total download size: 2.3 M Installed size: 7.8 M Downloading Packages: (1/3): mod_dav_svn-1.8.8-1.x86_64.rpm | 77 kB 00:00 (2/3): serf-1.3.2-2.x86_64.rpm | 43 kB 00:00 (3/3): subversion-1.8.8-1.x86_64.rpm | 2.2 MB 00:19 ---------------------------------------------------------------------------------------------------- Total 112 kB/s | 2.3 MB 00:20 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : serf-1.3.2-2.x86_64 1/3 Installing : subversion-1.8.8-1.x86_64 2/3 Installing : mod_dav_svn-1.8.8-1.x86_64 3/3 Stopping httpd: [ OK ] Starting httpd: [ OK ] Verifying : mod_dav_svn-1.8.8-1.x86_64 1/3 Verifying : subversion-1.8.8-1.x86_64 2/3 Verifying : serf-1.3.2-2.x86_64 3/3 Installed: mod_dav_svn.x86_64 0:1.8.8-1 subversion.x86_64 0:1.8.8-1 Dependency Installed: serf.x86_64 0:1.3.2-2 Complete!
5. Setting up SVN directories :
[root@centos6-05 ~]# mkdir /svn [root@centos6-05 ~]# mkdir /svn/repos [root@centos6-05 ~]# mkdir /svn/users [root@centos6-05 ~]# mkdir /svn/permissions [root@centos6-05 ~]# chown -R apache:apache /svn
6. Configure httpd Apache server as below :
[root@centos6-05 ~]# vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80> ServerAdmin webmaster@svn.ehowstuff.local DocumentRoot /svn/repos ServerName svn.ehowstuff.local ErrorLog logs/svn.ehowstuff.local-error_log CustomLog logs/svn.ehowstuff.local-access_log common </VirtualHost>
7. Do a backup of origial subversion file :
[root@centos6-05 ~]# mv /etc/httpd/conf.d/subversion.conf /etc/httpd/conf.d/subversion.conf.bak
8. Create and Configure subversion.conf :
[root@centos6-05 ~]# vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn/repos> DAV svn SVNParentPath /svn/repos AuthType Basic AuthName "Authorization Realm" AuthUserFile /svn/users/passwords AuthzSVNAccessFile /svn/permissions/svnaccess Require valid-user </Location>
9. Create first repository using svnadmin command :
[root@centos6-05 ~]# svnadmin create /svn/repos/testrepo [root@centos6-05 ~]# chown -R apache:apache /svn/repos/testrepo
10. Create htpasswd user to access the testrepo repository :
[root@centos6-05 ~]# htpasswd -c /svn/users/passwords svnuser1 New password: Re-type new password: Adding password for user svnuser1
11. Create svnaccess file to access the testrepo repository :
[root@centos6-05 ~]# vi /svn/permissions/svnaccess
Add the following :
[testrepo:/] svnuser1 = rw
12. Restart httpd :
[root@centos6-05 ~]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
13. Test your subversion server from browser :
http://svn.ehowstuff.local/svn/repos/testrepo/