****************************************************************
* Description: Install SVN server and repository on RHEL server
* Date: 05:50 PM EST, 04/27/2018
****************************************************************

		 
<1> Apache Subversion is a software versioning and revision control system distributed as open source under the Apache License:
     |
     |__ o. Install Apache as web server, since SVN needs web console.
     |
     |__ o. Install SVN software, and setup SVN server.
     |
     |__ o. Create SVN repository.	 
	
	
	
	
	

	
<2> In RHEL, the httpd package provides the Apache HTTP Server. Run below command as sudo to verify if httpd package is installed:
     |
     |__ $ rpm -q httpd	 
	
                 >> package httpd is not installed



			
			
	
<3> Install Apache by following command as sudo:
     |
     |__ $  yum install httpd


             Loaded plugins: downloadonly, security
             Bad id for repo: root@m1crh226 adm-nnassif, byte = @ 4
             mahc_rhel5-els_repo                                                                                                                              |  951 B     00:00
             mahc_rhel5-i386_repo                                                                                                                             |  951 B     00:00
             mahc_rhel5_repo                                                                                                                                  | 1.2 kB     00:00
             rhel5s-x86_64-epel                                                                                                                               | 2.5 kB     00:00
             rhel5s-x86_64-optional                                                                                                                           | 2.5 kB     00:00
             rhel5s-x86_64-rhn-updates                                                                                                                        | 2.5 kB     00:00
             rhel5s-x86_64-rpmfusion-free-updates                                                                                                             | 2.5 kB     00:00
             rhel5s-x86_64-rpmfusion-nonfree-updates                                                                                                          | 2.5 kB     00:00
             rhel5s-x86_64-spacewalk                                                                                                                          | 2.5 kB     00:00
             rhel5s-x86_64-spacewalk-client                                                                                                                   | 2.5 kB     00:00
             rhel5s-x86_64-supplementary                                                                                                                      | 2.5 kB     00:00
             rhel5s-x86_64-virtualization                                                                                                                     | 2.5 kB     00:00
             Setting up Install Process
             Resolving Dependencies
             --> Running transaction check
             ---> Package httpd.i386 0:2.2.3-92.el5_11 set to be updated
             mahc_rhel5-els_repo/filelists                                                                                                                    | 3.8 MB     00:00
             mahc_rhel5-i386_repo/filelists                                                                                                                   | 3.0 MB     00:00
             mahc_rhel5_repo/filelists                                                                                                                        |  34 MB     00:01
             rhel5s-x86_64-epel/filelists_db                                                                                                                  | 3.7 MB     00:00
             rhel5s-x86_64-optional/filelists_db                                                                                                              | 2.1 MB     00:00
             rhel5s-x86_64-rhn-updates/filelists_db                                                                                                           |  26 MB     00:01
             rhel5s-x86_64-rpmfusion-free-updates/filelists_db                                                                                                |  54 kB     00:00
             rhel5s-x86_64-rpmfusion-nonfree-updates/filelists_db                                                                                             |  11 kB     00:00
             rhel5s-x86_64-spacewalk/filelists_db                                                                                                             |  13 kB     00:00
             rhel5s-x86_64-spacewalk-client/filelists_db                                                                                                      |  13 kB     00:00
             rhel5s-x86_64-supplementary/filelists_db                                                                                                         | 2.1 MB     00:00
             rhel5s-x86_64-virtualization/filelists_db                                                                                                        | 209 kB     00:00
             --> Processing Dependency: libpcre.so.0 for package: httpd
             ---> Package httpd.x86_64 0:2.2.3-92.el5_11 set to be updated
             --> Running transaction check
             ---> Package pcre.i386 0:6.6-9.el5 set to be updated
             --> Finished Dependency Resolution
             
             Dependencies Resolved
             
             ========================================================================================================================================================================
              Package                          Arch                              Version                                       Repository                                       Size
             ========================================================================================================================================================================
             Installing:
              httpd                            i386                              2.2.3-92.el5_11                               mahc_rhel5-i386_repo                            1.2 M
              httpd                            x86_64                            2.2.3-92.el5_11                               mahc_rhel5-els_repo                             1.3 M
             Installing for dependencies:
              pcre                             i386                              6.6-9.el5                                     mahc_rhel5_repo                                 118 k
             
             Transaction Summary
             ========================================================================================================================================================================
             Install       3 Package(s)
             Upgrade       0 Package(s)
             
             Total download size: 2.6 M
             Is this ok [y/N]: y
             Downloading Packages:
             (1/3): pcre-6.6-9.el5.i386.rpm                                                                                                                   | 118 kB     00:00
             (2/3): httpd-2.2.3-92.el5_11.i386.rpm                                                                                                            | 1.2 MB     00:00
             (3/3): httpd-2.2.3-92.el5_11.x86_64.rpm                                                                                                          | 1.3 MB     00:00
             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
             Total                                                                                                                                   6.5 MB/s | 2.6 MB     00:00
             Running rpm_check_debug
             Running Transaction Test
             Finished Transaction Test
             Transaction Test Succeeded
             Running Transaction
               Installing     : pcre                                                                                                                                             1/3
               Installing     : httpd                                                                                                                                            2/3
               Installing     : httpd                                                                                                                                            3/3
             
             Installed:
               httpd.i386 0:2.2.3-92.el5_11                                                      httpd.x86_64 0:2.2.3-92.el5_11
             
             Dependency Installed:
               pcre.i386 0:6.6-9.el5
             
             Complete!
	
	


	

<4> After Apache package installed, run below command to verify:
     |
     |__ $ rpm -q httpd
	 
                 >> httpd-2.2.3-92.el5_11
      
	
	
	
	

<5> Checking if Apache server up and running by either of the command:
     |
     |__ $ /etc/init.d/httpd status	 
     |
     |__ $ service httpd status
	 
                 >> httpd is stopped
	
	
	
	


<6> Some of the RHEL system enables SELinux[Security Enhanced]. If the feature turned on, before starting Apache , please take reference for addition step:
     |
     |__ $ sestatus

                 >> SELinux status: disabled	
	
	
	
	
	
	
<7> Start Apache server:
     |
     |__ $ service httpd start
     |
     |           >> Starting httpd:  [  OK  ]
     |
     |
     |__ $ service httpd status
  
                 >> httpd (pid  987) is running...
	 
	
	
	
	
	
<8> The URL of Apache landing page is https:localhost:
     |
     |__ o. The default html file is /var/www/index.html	 
	
	
	
	
	
	
	
	
<9> Install SVN software and module mod_dav_svn. The purpose of "mod_dav_svn" is communicating SVN with Apache to display the repository directory on Web GUI:	
     |
     |__ $ yum install mod_dav_svn subversion
		 
             Loaded plugins: downloadonly, security
             Bad id for repo: root@m1crh226 adm-nnassif, byte = @ 4
             Setting up Install Process
             Package subversion-1.6.11-12.el5_10.x86_64 already installed and latest version
             Package subversion-1.6.11-12.el5_10.i386 already installed and latest version
             Resolving Dependencies
             --> Running transaction check
             ---> Package mod_dav_svn.i386 0:1.6.11-12.el5_10 set to be updated
             ---> Package mod_dav_svn.x86_64 0:1.6.11-12.el5_10 set to be updated
             --> Finished Dependency Resolution
             
             Dependencies Resolved
             
             ========================================================================================================================================================================
             Package                               Arch                             Version                                    Repository                                      Size
             ========================================================================================================================================================================
             Installing:
             mod_dav_svn                           i386                             1.6.11-12.el5_10                           mahc_rhel5-i386_repo                            79 k
             mod_dav_svn                           x86_64                           1.6.11-12.el5_10                           mahc_rhel5-els_repo                             79 k
             
             Transaction Summary
             ========================================================================================================================================================================
             Install       2 Package(s)
             Upgrade       0 Package(s)
             
             Total download size: 158 k
             Is this ok [y/N]: y
             Downloading Packages:
             (1/2): mod_dav_svn-1.6.11-12.el5_10.i386.rpm                                                                                                     |  79 kB     00:00
             (2/2): mod_dav_svn-1.6.11-12.el5_10.x86_64.rpm                                                                                                   |  79 kB     00:00
             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
             Total                                                                                                                                   571 kB/s | 158 kB     00:00
             Running rpm_check_debug
             Running Transaction Test
             Finished Transaction Test
             Transaction Test Succeeded
             Running Transaction
             Installing     : mod_dav_svn                                                                                                                                      1/2
             Installing     : mod_dav_svn                                                                                                                                      2/2
             
             Installed:
             mod_dav_svn.i386 0:1.6.11-12.el5_10                                               mod_dav_svn.x86_64 0:1.6.11-12.el5_10
             
             Complete!
	
	
	
	
	
	
	
<10> After SVN package installed, then starting config SVN server. Firstly, creating SVN parent folder, which is equal to root volume of a system:
     |
     |__ $ mkdir /var/www/svn
           chmod 755 /var/www/svn	 
	
	
	
	
	
	 
<11> Under Apache server folder, there is configuration file for SVN. By which, telling the SVN metadata to Apache:
     |
     |__ $ vi /etc/httpd/conf.d/subversion.conf	 
	
	
                     #========== Original ============= 
                     #    LoadModule dav_svn_module     modules/mod_dav_svn.so
                     #    LoadModule authz_svn_module   modules/mod_authz_svn.so
                     #    
                     #    <Location /svn>
                     #    DAV svn
                     #    SVNParentPath /var/www/svn
                     #    
                     #    Limit write permission to list of valid users.
                     #    <LimitExcept GET PROPFIND OPTIONS REPORT>
                     #    	# Require SSL connection for password protection.
                     #    	# SSLRequireSSL
                     #    
                     #    	AuthType Basic
                     #    	AuthName "Subversion repositories"
                     #    	AuthUserFile /etc/svn-auth-users
                     #    	Require valid-user
                     #    </LimitExcept>
                     #    </Location>
	
	
                     #=========== After re-configurion ==========
                     <Location /svn>
                       DAV svn
                       SVNParentPath /var/www/svn
                     
                       <LimitExcept GET PROPFIND OPTIONS REPORT>
                         AuthType Basic
                         AuthName "Subversion repositories"
                         # Create repository username/password, and saving the credential enclosed this file: 
                         AuthUserFile /etc/svn-auth-users
                         # Saving repository user permission enclosed this access control file:
                         AuthzSVNAccessFile /etc/svn-access-control
                         Require valid-user
                       </LimitExcept>
                     </Location>
	
	
                     #=========== Create SVN repository on a regular volume ==========
                     <Location /repo_name>
                       DAV svn
                       SVNPath /u01/repo_name
                     
                       <LimitExcept GET PROPFIND OPTIONS REPORT>
                         AuthType Basic
                         AuthName "Subversion repositories"
                         AuthUserFile /etc/svn-auth-users
                         AuthzSVNAccessFile /etc/svn-access-control
                         Require valid-user
                       </LimitExcept>
                     </Location>	
	
	
	
	
	
<12> Creating repository username. For example, "test_user" is the username:
     |
     |__ $ htpasswd -m /etc/svn-auth-users test_user            
     |	
     |             New password: <typeing in password>
     |             Re-type new password: <typeing in password again>
     |             Adding password for user test_user	 
     |
     |
     |
     |
     |_ $ cat /etc/svn-auth-users
			
                   test_user:$apr1$opiTm...$RxRjzf.tj.q/cQBvcba/y0
	
	
	


	
<13> Creating SVN repository:
     |
     |__ $ pwd 
     |
     |            /var/www/svn
     |
     |
     |__ $ svnadmin create testrepo
     |
     |
     |__ $  ls -ltr
     |             
     |            drwx------ 6 root root 4096 Apr 12 12:38 testrepo
     |		  
     |		  
     |__ $ chown -R apache.apache testrepo
     |
     |
     |__ $ ls -ltr
     |
     |            drwx------ 6 apache apache 4096 Apr 12 12:38 testrepo	 
     |
     |
     |__ $ service httpd restart
	 
	 
	 
	 
	
	
	
<14> Assigning permission to repository users/roles by copying following content within repo access control file:	
     |
     |__ $ cp /var/www/svn/testrepo/conf/authz /etc/svn-access-control 
     |
     |
     |__ $ vi /etc/svn-access-control	 
		
		
                         [groups]
                         admin=test_user
                         
                         [/]
                         @admin=rw
                         
                         [testrepo:/]
                         test_user=rw
	
	
	
	
	
	
	
	
<15> Modify SVN repository config file to limit anonymous control by uncommenting below 2 parameters:
     |
     |__ $ vi /var/www/svn/testrepo/conf/svnserve.conf	
		
			
                         ## Disable anonymous access ##
                         anon-access = none
                         
                         ## Enable access control ##
                         authz-db = authz
	
	

	
	
	
	
	
<16> Restart Apache:
     |
     |__ $ service httpd restart
	 
	 
                         Stopping httpd:         [  OK  ]
                         Starting httpd:         [  OK  ]	
	
	
	
	
	
	
<17> Create trunk, branches and tags structure under testrepo:
     |
     |__ o. Create “template” directories with following command:
     |      |
     |      |__ $ mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}
     |	
     |	
     |
     |
     |__ o. Then import template to project repository using “svn import” command:
             |
             |__  $ svn import -m 'Initial import' /tmp/svn-structure-template/ http://10.234.92.21/svn/testrepo/
			 
			 
                         Adding         /tmp/svn-structure-template/trunk
                         Adding         /tmp/svn-structure-template/branches
                         Adding         /tmp/svn-structure-template/tags
                         
                         Committed revision 1.	
	
	
	
	
	
	
	
<18> Now, the SVN parent folders should be hooked with Web GUI on browser - http://10.234.92.21/svn/testrepo/, or use TortoiseSVN repo-brower:	


                 
	
	
	
		
	
	
	
	
<19> Reference:
     |
     |__ o. SVN Installation - https://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/
     |
     |__ o. SELinux Status Verification - https://www.centos.org/docs/5/html/5.1/Deployment_Guide/sec-selinux-status-viewing.html
     |
     |__ o. REHL Apache - https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/managing_confined_services/chap-managing_confined_services-the_apache_http_server
     |
     |__ o. SVN Permission - http://svnbook.red-bean.com/en/1.7/svn.serverconfig.pathbasedauthz.html	 
		
    
	

Your Comments