SVN 服务器搭建步骤及使用实战(5)

wKioL1hqEe6RQaWGAAB4pluw_Ks821.png

接下来可以在tags目录下看到刚才打的版本号:

wKioL1hqErGREXcGAADMyHUUU3w371.png

(9)配置Apache,让svn支持http协议访问

[root@node02 conf.d]# pwd

/etc/httpd/conf.d

[root@node02 conf.d]# ll

total 20

-rw-r--r-- 1 root root   46 Dec 31 18:25 passwd

-rw-r--r-- 1 root root  392 Nov 19 07:49 README

-rw-r--r-- 1 root root 1049 Dec 31 18:35 subversion.conf

-rw-r--r-- 1 root root 1042 Dec 31 18:23 subversion.conf.bak

-rw-r--r-- 1 root root  299 Nov  3 22:33 welcome.conf

[root@node02 conf.d]# 

[root@node02 conf.d]# cat subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so

LoadModule authz_svn_module   modules/mod_authz_svn.so

#

# Example configuration to enable HTTP access for a directory

# containing Subversion repositories, "/var/www/svn".  Each repository

# must be both:

#

#   a) readable and writable by the 'apache' user, and

#

#   b) labelled with the 'httpd_sys_content_t' context if using

#   SELinux

#

#

# To create a new repository "http://localhost/repos/stuff" using

# this configuration, run as root:

#

#   # cd /var/www/svn

#   # svnadmin create stuff  

#   # chown -R apache.apache stuff

#   # chcon -R -t httpd_sys_content_t stuff

#

<Location /repos>

   DAV svn

   SVNParentPath /application/svn/svndata

    AuthType Basic

    AuthName "Authorization Realm"

    AuthUserFile /etc/httpd/conf.d/passwd

    Require valid-user

</Location>

[root@node02 conf.d]# 

生成认证用户和密码

[root@node02 conf.d]# htpasswd /etc/httpd/conf.d/passwd user001

New password: 

Re-type new password: 

Updating password for user user001

[root@node02 conf.d]# 

wKiom1hsu5Wwinm3AANMfzILz0k562.png

另外在配置多个项目时,务必要统一配置文件,比如这里的项目是project001,则project001的配置文件必须跟其他项目文件保持同一份文件否则认证失败:

[root@node02 conf]# pwd

/application/svn/svndata/project001/conf

[root@node02 conf]# egrep -v "^#" svnserve.conf

[general]

anon-access = read

auth-access = write

password-db = /application/svn/svndata/svnpasswd/passwd

authz-db = /application/svn/svndata/svnpasswd/authz

[sasl]

[root@node02 conf]# 

http访问svn时所用的认证配置文件为:

[root@node02 conf]# pwd

/application/svn/svndata/project001/conf

[root@node02 conf]# cd /etc/httpd/conf.d/

[root@node02 conf.d]# pwd

/etc/httpd/conf.d

[root@node02 conf.d]# ll

total 20

-rw-r--r-- 1 root root   22 Jan  5 01:01 passwd

-rw-r--r-- 1 root root  392 Nov 19 07:49 README

-rw-r--r-- 1 root root 1049 Dec 31 18:35 subversion.conf

-rw-r--r-- 1 root root 1042 Dec 31 18:23 subversion.conf.bak

-rw-r--r-- 1 root root  299 Nov  3 22:33 welcome.conf

[root@node02 conf.d]# cat passwd 

user001:vQWeaqcB4YzpU

[root@node02 conf.d]# ll passwd 

-rw-r--r-- 1 root root 22 Jan  5 01:01 passwd

[root@node02 conf.d]# 

此时passwd文件中的用户名和密码要与svn的passwd中的用户名和密码保持相同

[root@node02 svnpasswd]# cat passwd 

### This file is an example password file for svnserve.

### Its format is similar to that of svnserve.conf. As shown in the

### example below it contains one section labelled [users].

### The name and password for each user follow, one account per line.

[users]

# harry = harryssecret

# sally = sallyssecret

admin = admin

user001 = 123456

[root@node02 svnpasswd]# 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/679a668307474be7542bc5e79284d555.html