Access the svn library in two ways: http and svn

  In the article [url] http://room-bb.iteye.com/blog/2190213[/url] to build the svn server, the svn warehouse is accessed through the svn:// method. This article focuses on using apache configuration to access the repository in http mode (this is useful for svn repository deployment on external network servers)

1: Create multiple svn repositories
svnadmin create /data/svn/exam_1
svnadmin create /data/svn/exam_2
svnadmin create /data/svn/exam_3

Note that you can also create an exam_1 without executing svnadmin multiple times, you can directly cp -r exam_1 exam_2


2: Configure svn
We have created three svn warehouses. You can move the configuration file in the /data/svn/exam_1/conf directory of one of the warehouses to /data/svn/conf, so that you can control the three through one configuration. The permissions of the warehouse are as follows:
mkdir -p /data/svn/conf
cp -r /data/svn/exam_1/conf/* /data/svn/conf

configure passwd
vi /data/svn/conf/passwd
manager = 123456
dev1 = 123456
dev2 = 123456
dev3 = 123456

art1 = 123456
art2 = 123456
art3 = 123456

des1 = 123456
des2 = 123456
des3 = 123456

configure authz
vi / data / svn / conf / authz
admin = manager

dev = dev1,dev2,dev3

art = art1,art2,art3

des = des1,des2,des3

[/]
@admin = rw
* =

[exam_1:/]
@admin = rw
@dev = rw
* =

[exam_2:/]
@admin = rw
@art = rw
* =

[exam_3:/]
@admin = rw
@des = rw
* =

Configure the global file svnserve.conf
vi /data/svn/conf/svnserve.conf
anon-access = none #Prohibit anonymous access, set to none. Default is read, parameters: read,write,none
auth-access = write #Authorized user write permission

password-db = /data/svn/conf/passwd
authz-db = /data/svn/conf/authz

realm = svn #The certification name of each SVN project will be displayed in the certification prompt. It is recommended to write the project name.

 
  3: Start svn and pay attention to the parameters, it is very important
svnserve -d -r /home/svn --config-file /data/svn/conf/svnserve.conf 


  4: Configure svn to support http access
Generate account password authentication file
htpasswd -cm /data/svn/conf/http_passwd manager #The first time to generate parameters -c
htpasswd -m /data/svn/conf/http_passwd dev1 #Users added later do not have parameters -c

http_passwd is the authentication file used in http mode, passwd is the authentication file used in svn mode,
The user and password in these two files should preferably be the same, so that the same user can access the svn library in two ways

setup apache svn configuration file
cd /etc/httpd/conf.d/

If there is no subversion.conf file, then execute yum -y install mod_dav_svn first
vi /etc/httpd/conf.d/subversion.conf
<Location /svn> #/svn ​​is a virtual directory, mapped to /data/svn.
   DAV svn
   
        #SvnPath /data/svn/ #Only support SVN repository of one home directory
        SVNParentPath /data/svn/ #Support multiple SVN repository with the same parent directory

   # Limit write permission to list of valid users.
   #<LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL

      AuthType Basic
      AuthName "Authorization SVN"
      AuthzSVNAccessFile /data/svn/conf/authz
          AuthUserFile /data/svn/conf/http_passwd
          Require valid-user
   #</LimitExcept>
</Location>

set permissions directory
  chown -R apache:apache /data/svn/

 restart apache service
  service httpd restart


5: Turn off SELinux . This is very important. I just didn't close it, so I couldn't log in all the time. After debugging all day, I was in tears.
getenforce ##View SELinux status
setenforce 0 ##Set SELinux to permissive mode without restarting, it will take effect immediately
                    ##setenforce 1 becomes enforcing mode

vi /etc/selinux/config
Change SELINUX=enforcing to SELINUX=disabled to take effect after restarting the machine



6: Test
svn access: under windows, enter svn://192.168.7.223/exam_1 http access
through the svn client, enter http://192.168.7.223/svn/exam_1 in the browser address bar Note: This is more than svn There is more /svn in the way, because we set a virtual path when configuring the location. If you want to access through the domain name, for example, http://www.bb.com/svn/exam_1 modify the hosts file vi /etc/hosts 192.168.7.223 www. If you can't log in to bb.com , check the firewall settings, iptables -L -n to see if the ports of svn and httpd are open
















Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326675372&siteId=291194637
svn