Fork me on GitHub

CentOS安装和配置SVN

环境:centos 6.5 x64

#安装软件包

yum -y install mod_dav_svn
yum -y install httpd
#新建目录
mkdir -p /opt/svn
#新建仓库
svnadmin create /opt/svn/test(svnadmin create /opt/svn/repositories)

#cope配置文件(未测试,密码明文)
cp /opt/svn/test/conf/* /opt/svn/
# vim passwd
[users]
irving = 123456
:wq!
# vim /opt/svn/test/conf/authz
[groups]
[/]
irving=rw
:wq!

#配置授权文件

mkdir /opt/svn/conf
#新建用户
htpasswd -c /opt/svn/conf/pwd.conf irving(首次需要-c ,否则会覆盖上次用户)
htpasswd /opt/svn/conf/pwd.conf test
在用户最上方加上[users]
[users]
irving=xxxxxx
test=xxxxxx
#保存退出
:wq

#配置用户权限

vi /opt/svn/conf/authz.conf
[groups]
admin=irving,test
view=user1
@admin=rw
[test:/]
user1=r
[/]表示根目录以下的权限定义
[repos1:/]表示仓库下的权限定义
如果要分项目,则以此规则类推:
如:[repos1:/aaa]则表示仓库下的aaa项目的权限定义。
@admin 表示admin这个组下的用户权限。
user1=r 表示user1这个用户的权限。
权限类型:r,w,rw 分别表示只读,只写,读写。
#保存退出
:wq
#修改SVN版本库配置文件
vi /opt/svn/test/conf/svnserve.conf
[general]
anon-access = none   
auth-access = write
password-db = /opt/svn/conf/pwd.conf    #指向用户配置文件
authz-db = /opt/svn/conf/authz.conf     #指向权限配置文件
realm = test                            #指向svn仓库地址

#配置httpd

vi /etc/httpd/conf.d/subversion.conf
修改

<Location /svn>
  DAV svn
  SVNListParentPath on
  SVNParentPath /opt/svn
  AuthType Basic
  AuthName "Authorization Realm"
  AuthUserFile /opt/svn/conf/pwd.conf 
  AuthzSVNAccessFile /opt/svn/conf/authz.conf
  Require valid-user  
  # Limit write permission to list of valid users.
  # <LimitExcept GET PROPFIND OPTIONS REPORT>
     # Require SSL connection for password protection.
     # SSLRequireSSL
     # AuthType Basic
     # AuthName "Authorization Realm"
     # AuthUserFile /opt/svn/conf/pwd.conf 
     # AuthzSVNAccessFile /opt/svn/conf/authz.conf  
     # Require valid-user
 # </LimitExcept>
</Location>

#配置Apache对版本库的访问权限
chown -R apache.apache /opt/svn/test
#配置svn的端口
vi /etc/httpd/conf/httpd.conf
找到#Listen 12.34.56.78:80这一行 (默认80端口)
#重启httpd服务
service httpd restart
#系统启动时Apache自动运行
chkconfig httpd on
#查看进程
ps aux|grep svn
访问:
http://ip/svn/

Refer:
http://my.oschina.net/u/1245614/blog/340167
客户端
http://sourceforge.net/projects/tortoisesvn/

posted @ 2014-12-15 17:14  花儿笑弯了腰  阅读(308)  评论(0编辑  收藏  举报