1:安装过程,这里采用了yum的方式安装,编译的话有点麻烦。shell
[root@localhost data]# yum install subversion
执行如下的命令:less
svn --version
若是显示svn
svn, version 1.6.11 (r934486)
之类的信息,那么表明安装成功了。
ui
二、创建版本库this
首先咱们创建一个文件夹来专门存放svn项目,以下
code
[root@localhost data]# mkdir /data
咱们使用命令创建两个项目:orm
[root@localhost data]# svnadmin create /data/onethink [root@localhost data]# svnadmin create /data/p2
此时会在文件夹/data/下面生成两个项目onethink和p2,目录结构以下:ci
drwxr-xr-x. 6 root root 4096 May 23 22:10 onethink drwxr-xr-x. 6 root root 4096 May 24 01:06 p2
每一个项目的目录结构以下:it
drwxr-xr-x. 2 root root 4096 May 24 01:15 conf drwxr-sr-x. 6 root root 4096 May 24 01:24 db -r--r--r--. 1 root root 2 May 24 01:06 format drwxr-xr-x. 2 root root 4096 May 24 01:06 hooks drwxr-xr-x. 2 root root 4096 May 24 01:06 locks -rw-r--r--. 1 root root 229 May 24 01:06 README.txt
其中 conf 文件夹中的三个文件为svn的配置文件,包括:io
-rw-r--r--. 1 root root 1093 May 7 06:41 authz -rw-r--r--. 1 root root 320 May 7 06:39 passwd -rw-r--r--. 1 root root 2259 May 7 06:43 svnserve.conf
其中authz为权限文件,passwd为用户验证文件,svnserve.conf为项目配置文件。为了方便咱们把authz passwd这两个文件独立开来,成为每一个项目的公用权限和验证文件。咱们把它们放在/data/conf目录下。
此时的目录结构以下:
drwxr-xr-x. 2 root root 4096 May 24 01:26 conf drwxr-xr-x. 6 root root 4096 May 23 22:10 onethink drwxr-xr-x. 6 root root 4096 May 24 01:06 p2
[root@localhost data]# ll conf onethink/ p2/ conf: total 8 -rw-r--r--. 1 root root 1031 May 24 01:24 authz -rw-r--r--. 1 root root 338 May 23 22:08 passwd onethink/: total 24 drwxr-xr-x. 2 root root 4096 May 23 22:56 conf drwxr-sr-x. 6 root root 4096 May 24 01:18 db -r--r--r--. 1 root root 2 May 23 21:50 format drwxr-xr-x. 2 root root 4096 May 23 21:50 hooks drwxr-xr-x. 2 root root 4096 May 23 21:50 locks -rw-r--r--. 1 root root 229 May 23 21:50 README.txt p2/: total 24 drwxr-xr-x. 2 root root 4096 May 24 01:15 conf drwxr-sr-x. 6 root root 4096 May 24 01:24 db -r--r--r--. 1 root root 2 May 24 01:06 format drwxr-xr-x. 2 root root 4096 May 24 01:06 hooks drwxr-xr-x. 2 root root 4096 May 24 01:06 locks -rw-r--r--. 1 root root 229 May 24 01:06 README.txt
接下来咱们配置用户名及密码
打开/data/conf/passwd文件,增长两个用户
[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 tttt = 111111 #用户1 tttt2 = 111111 #用户2
接着咱们设置项目onethink和p2下面的conf/svnserve.conf文件,令到它能够使用公共的/data/conf/passwd及/data/conf/authz
anon-access = none //无权限时 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 = /data/conf/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 = /data/conf/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 = p2 //貌似这个叫什么来着?
配置好后,咱们还须要配置/data/conf/authz权限管理文件
[groups] g1 = tttt #用户组1 g2 = tttt2 #用户组2 [onethink:/] #onethink项目的权限设置 @g1 = rw #onethink项目组,用户组1是有读写的 @g2 = #onethink项目组,用户组2是没有任何权限的 [p2:/] #p2项目组的权限,同上 @g2= rw [p2:/txt] #配置p2项目下的txt文件夹的权限,这里用户组2是没有权限的 @g2=
配置好后,咱们启动svn服务
[root@localhost conf]# svnserve -d -r /data/
这时咱们在window环境下就能够使用软件来访问了,两个项目的访问地址分别为
svn://192.168.110.129/p2
svn://192.168.110.129/onethink