System environment:
[[email protected] conf]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [[email protected] conf]# uname -r3.10.0-327.el7.x86_64
Install SVN
[[email protected] conf]# yum install -y subversion #安装SVN[[email protected] ~]# svn --version #查看SVN版本svn,版本 1.7.14 (r1542130) 编译于 Apr 11 2018,02:40:28版权所有 (C) 2013 Apache 软件基金会。此软件包含了许多人的贡献,请查看文件 NOTICE 以获得更多信息。Subversion 是开放源代码软件,请参阅 http://subversion.apache.org/ 站点。可使用以下的版本库访问模块: * ra_neon : 通过 WebDAV 协议使用 neon 访问版本库的模块。 - 处理“http”方案 - 处理“https”方案* ra_svn : 使用 svn 网络协议访问版本库的模块。 - 使用 Cyrus SASL 认证 - 处理“svn”方案* ra_local : 访问本地磁盘的版本库模块。 - 处理“file”方案
[[email protected] conf]# mkdir -p /home/data/svn/ #创建SVN目录[[email protected] conf]# cd /home/data/svn/[[email protected] conf]# svnadmin create fendo #创建仓库[[email protected] conf]# cd fendo/conf/ #进入配置目录
(1) SVN service configuration file: Under Conf directory, file name is svnserve.conf
(2) User name password file: In the Conf directory, the file name is passwd
(3) Permission profile, under Conf directory, file name is Authz
[[email protected] conf]# cp svnserve.conf svnserve.conf.ori #备份配置文件预防出错[[email protected] conf]# vim svnserve.conf #修改为以下几个参数 anon-access = none #匿名访问的权限,可以是read,write,none,默认为read auth-access = write #使授权用户有写权限password-db = passwd #密码数据库的路径authz-db = authz #访问控制文件realm = /home/data/svn/fendo #认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字
Modify the passwd file
[[email protected] conf]# vim passwd[users] admin = admin test = test
Modify Authz
[[email protected] conf]# vim authz[/]admin = rw* =[/fendo]test = rw* =
[[email protected] conf]# svnserve -d -r /home/data/svn/fendo/ #启动SVN服务[[email protected] conf]# ps -ef|grep svn|grep -v greproot 19711 20296 0 20:55 pts/0 00:00:00 vim svnserve.confroot 21410 1 0 21:29 ? 00:00:00 svnserve -d -r /home/data/svn/fendo/
Attention:
Realm =/home/data/svn/fendo is not accessible in the svnserve.conf configuration file
Install Apache to support HTTP access
[[email protected] conf]# yum install -y httpd mod_dav_svn检查Apache,mod_dav_svn是否安装成功[[email protected] conf]# find / -name mod_dav_svn.so/usr/lib64/httpd/modules/mod_dav_svn.so[[email protected] conf]# find / -name mod_authz_svn.so/usr/lib64/httpd/modules/mod_authz_svn.so
Modify the configuration file/etc/httpd/conf.d/subversion.conf (no new), content is:
[[email protected] conf]# vim /etc/httpd/conf.d/subversion.confLoadModule dav_svn_module modules/mod_dav_svn.soLoadModule authz_svn_module modules/mod_authz_svn.so<Location /svn> DAV svn SVNParentPath /home/data/svn AuthType Basic AuthName "Authorization SVN" AuthzSVNAccessFile /home/data/svn/authz AuthUserFile /home/data/svn/passwd Require valid-user</Location>
Create user Files passwd
[[email protected] conf]# touch /home/data/svn/passwd #创建用户文件[[email protected] conf]# htpasswd /home/data/svn/passwd admin #创建用户admin密码123456#web登陆使用的账户密码New password: Re-type new password: Adding password for user admin[[email protected] conf]# cat /home/data/svn/passwd #查看用户密码admin:$apr1$14TFxRn7$mBb78VyFANCN38NMDGUp/0
Create a permissions file Authz
[[email protected] conf]# cp /home/data/svn/fendo/conf/authz /home/data/svn/authz[[email protected] conf]# cat /home/data/svn/authz
Configure Papche to SVN directory permissions
[[email protected] conf]# chown -R apache:apache /home/data/svn/fendo[[email protected] conf]# ll /home/data/svn/总用量 8-rw-r--r-- 1 root root 1125 8月 21 14:56 authzdrwxr-xr-x 6 apache apache 80 8月 21 15:06 fendo-rw-r--r-- 1 root root 44 8月 21 14:55 passwd
Configure HTTPD
[[email protected] conf]# vim /etc/httpd/conf/httpd.confAllowOverride None改为AllowOverride All
Launch Apache
[[email protected] conf]# service httpd starthttpd -v #查看已经安装的httpd的版本rpm -qa | grep httpd #查看是否已经安装了httpdps -ef | grep httpd #查看httpd的进程service httpd status #查看httpd的运行状态service httpd stop #可以停止httpdservice httpd start #可以启动http
SVN+APACHE+SSL installation configuration, access via SSL