本文主要是介绍centOS6.4 部署SVN,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
因工作需要,需要准备一台svn,开了几个帖子,有一点不尽人意,刚部署完,共享一份资料。
1、安装
[root@localhost ~]# yum install httpd mod_dav_svn subversion mod_ssl mod_authz_svn.so -y
这里可以直接 yum install httpd* subversion* mod_dav_svn* mod_authz_svn* -y
2、创建代码库
[root@localhost ~]# mkdir /svn/splunk
[root@localhost ~]# svnadmin create /svn/splunk
查看/svn/splunk/下,是否生成conf, db,format,hooks, locks, README.txt等文件,说明一个SVN库已经建立。
3、配置svn
[root@localhost ~]# cd /svn/splunk/conf/
[root@localhost conf]# ls
authz passwd svnserve.conf
(1)访问权限控制
[root@localhost conf]# vim authz
#配置组
[groups]
#可以创建一个test,组里包含user1和user2
#test = user1,user2
#配置访问控制
[/]
#可以设置组的权限如@test代表组权限,也可以单独配置用户
@test = rw
user1 = rw
(2)svn主配置文件
第8 13 20 27 32行去掉注释,顶行。
[root@localhost conf]# vim svnserve.conf
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
# anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
realm = /svn/splunk
4、配置httpd
[root@localhost conf]# cd /etc/httpd/conf.d/
[root@localhost conf.d]# vim subversion.conf
还配置文件低端添加,根据实际情况修改/svn/目录
<Location /svn>
DAV svn
SVNParentPath /svn/
AuthType Basic
AuthName "svn"
AuthUserFile /svn/splunk/conf/passwd
AuthzSVNAccessFile /svn/splunk/conf/authz
Require valid-user
</Location>
5、创建apache用户
因为svn通过httpd发出去,所有需要用apache用户登录
第一次创建账号
[root@localhost conf.d]# htpasswd -c /svn/splunk/conf/passwd user1
以后创建账号
[root@localhost conf.d]# htpasswd /svn/splunk/conf/passwd user2
创建完用户后记得在 3-(1)中给用户赋权。
6、启动服务
启动svn
[root@localhost conf.d]# service svnserve start
启动httpd
[root@localhost conf.d]# service httpd start
加入开机启动
[root@localhost conf.d]# chkconfig svnserve on
[root@localhost conf.d]# chkconfig httpd on
因为内网环境中iptables是关闭的,不考虑端口问题,如果开着的话,记的开端口。
[root@localhost conf.d]# iptables -I INPUT -p tcp --dport 3690 -j ACCEPT
有可能碰到的问题
Error: Can’t open ‘/home/svn/db/txn-current-lock’:拒绝访问
解决方法
给svn根目录赋权
[root@localhost conf.d]#chmod –R o+rw /svn/splunk/
在浏览器
http://svn服务器ip/svn/splunk/ 输入用户名密码就可以了
这篇关于centOS6.4 部署SVN的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!