1、安装 subversion
yum install subversion #最终显示 Installed: subversion.x86_64 0:1.6.11-12.el6_6 Dependency Installed: apr.x86_64 0:1.3.9-5.el6_2 apr-util.x86_64 0:1.3.9-3.el6_0.1 libproxy.x86_64 0:0.3.0-10.el6 libproxy-bin.x86_64 0:0.3.0-10.el6 libproxy-python.x86_64 0:0.3.0-10.el6 neon.x86_64 0:0.29.3-3.el6_4 pakchois.x86_64 0:0.4-3.2.el6 perl-URI.noarch 0:1.40-2.el6 Complete! #代表安装成功
2、判断是否安装成功
svnserve --version svnserve, version 1.6.11 (r934486) compiled Feb 10 2015, 22:08:22 Copyright (C) 2000-2009 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). The following repository back-end (FS) modules are available: * fs_base : Module for working with a Berkeley DB repository. * fs_fs : Module for working with a plain file (FSFS) repository. Cyrus SASL authentication is available.
3、建立SVN库。
[[email protected] ~]# mkdir -p /opt/svn/repos [[email protected] ~]# svnadmin create /opt/svn/repos
执行完上面的命令后,在repos下建立conf, db,format,hooks, locks, README.txt。
4、配置svn
进入上面生成的文件夹conf下,进行配置, 有以下几个文件authz, passwd, svnserve.conf
其中authz 是权限控制,可以设置哪些用户可以访问哪些目录, passwd是设置用户和密码的, svnserve是设置svn相关的操作。
[[email protected] ~]# cd /opt/svn/repos [[email protected] repos]# ll total 24 drwxr-xr-x 2 root root 4096 Feb 24 06:31 conf drwxr-sr-x 6 root root 4096 Feb 24 06:31 db -r--r--r-- 1 root root 2 Feb 24 06:31 format drwxr-xr-x 2 root root 4096 Feb 24 06:31 hooks drwxr-xr-x 2 root root 4096 Feb 24 06:31 locks -rw-r--r-- 1 root root 229 Feb 24 06:31 README.txt [[email protected] repos]#
进入conf打开passwd
[[email protected] repos]# cd conf [[email protected] conf]# ll total 12 -rw-r--r-- 1 root root 1080 Feb 24 06:31 authz -rw-r--r-- 1 root root 309 Feb 24 06:31 passwd -rw-r--r-- 1 root root 2279 Feb 24 06:31 svnserve.conf [[email protected] conf]# vim passwd
[users] # harry = harryssecret # sally = sallyssecret ningyuqiao=ningyuqiao 用户名=密码
打开authz,设置权限
[/] ningyuqiao=rw
意思是ningyuqiao用户对所有的目录有读写权限
设定svnserv.conf
anon-access = none # 使非授权用户无法访问 auth-access = write # 使授权用户有写权限 password-db = passwd authz-db = authz # 访问控制文件 realm = /opt/svn/repos # 认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字。
注意:把中文全部去掉,否则会报错。
启动svn服务
svnserve -d -r /opt/svn/repos
如果已经有svn在运行,可以换一个端口运行
svnserve -d -r /opt/svn/repos --listen-port 3391
采用TortoiseSVN, 连接地址为: svn://your server address (如果指定端口需要添加端口 :端口号)
时间: 2024-10-06 16:15:00