1、yum install subversion
root用户登录,执行yum install subversion。
root用户登录,执行yum install subversion。
[root@localhost ~]# yum install subversion
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Determining fastest mirrors
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 33 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 2.6 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package subversion.x86_64 0:1.6.11-15.el6_7 will be installed
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion-1.6.11-15.el6_7.x86_64
--> Running transaction check
---> Package perl-URI.noarch 0:1.40-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================================================================================================
Installing:
subversion x86_64 1.6.11-15.el6_7 updates 2.3 M
Installing for dependencies:
perl-URI noarch 1.40-2.el6 base 117 k
Transaction Summary
==============================================================================================================================================================================================================================================================================
Install 2 Package(s)
Total download size: 2.4 M
Installed size: 12 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): perl-URI-1.40-2.el6.noarch.rpm | 117 kB 00:00
(2/2): subversion-1.6.11-15.el6_7.x86_64.rpm | 2.3 MB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 13 MB/s | 2.4 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-URI-1.40-2.el6.noarch 1/2
Installing : subversion-1.6.11-15.el6_7.x86_64 2/2
Verifying : perl-URI-1.40-2.el6.noarch 1/2
Verifying : subversion-1.6.11-15.el6_7.x86_64 2/2
Installed:
subversion.x86_64 0:1.6.11-15.el6_7
Dependency Installed:
perl-URI.noarch 0:1.40-2.el6
Complete!
2、输入rpm -ql subversion查看安装位置
[root@localhost ~]# rpm -ql subversion
/etc/bash_completion.d
/etc/bash_completion.d/subversion
/etc/rc.d/init.d/svnserve
..............................
..............................
..............................
/usr/share/man/man8/svnserve.8.gz
/usr/share/xemacs/site-packages/lisp/psvn.el
svn在bin目录下生成了几个二进制文件。
输入 svn --help可以查看svn的使用方法
输入 svn --help可以查看svn的使用方法
[root@localhost ~]# svn --help
usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.6.11.
..............................
Available subcommands:
add
blame (praise, annotate, ann)
cat
..............................
..............................
Subversion is a tool for version control.
For additional information, see http://subversion.tigris.org/
3、创建svn版本库目录
mkdir -p /var/svn/svnrepos
mkdir -p /var/svn/svnrepos
[root@localhost ~]# mkdir -p /var/svn/svnrepos
4、创建版本库
svnadmin create /var/svn/svnrepos
svnadmin create /var/svn/svnrepos
[root@localhost ~]# svnadmin create /var/svn/svnrepos
执行了这个命令之后会在/var/svn/svnrepos目录下生成如下这些文件
[root@localhost ~]# cd /var/svn/svnrepos
[root@localhost svnrepos]# ls
conf db format hooks locks README.txt
[root@localhost svnrepos]# cd conf
[root@localhost conf]# ls
authz passwd svnserve.conf
5、进入conf目录(svn版本库配置文件)
authz文件是权限控制文件
passwd是帐号密码文件
svnserve.conf SVN服务配置文件
6、设置帐号密码
vi passwd
vi passwd
在[users]模块中添加用户和密码,格式:帐号=密码,如nisj=159357
[root@localhost conf]# 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
nisj = 159357
7、设置权限
vi authz
在末尾添加如下代码:
[/]
nisj=rw
意思是
版本库的根目录nisj对其有读写权限,同理如果想让其只有只读权限nisj=r即可。
8、修改svnserve.conf文件
vi svnserve.conf
打开下面的几个注释:
anon-access = read #匿名用户可读
auth-access = write #授权用户可写
password-db = passwd #使用哪个文件作为账号文件
authz-db = authz #使用哪个文件作为权限文件
realm = /var/svn/svnrepos # 认证空间名,版本库所在目录
9、启动svn版本库
svnserve -d -r /var/svn/svnrepos
10、在windows上测试
新建一个测试文件夹,在该文件夹下右键选择 SVN checkout(要事先安装TortoiseSVN):
填写SVN的地址, 如下:svn://10.8.12.123
输入用户名密码,即可。
本测试Windows客户端所用的SVN安装包为 TortoiseSVN-1.9.1.26747-x64-svn-1.9.1.1441852832.msi。
新建一个测试文件夹,在该文件夹下右键选择 SVN checkout(要事先安装TortoiseSVN):
填写SVN的地址, 如下:svn://10.8.12.123
输入用户名密码,即可。
本测试Windows客户端所用的SVN安装包为 TortoiseSVN-1.9.1.26747-x64-svn-1.9.1.1441852832.msi。