svn搭建步骤
环境:centos7.4
方式:使用yum方式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | 1、yum -y install subversion 2、查看版本 svnversion --version 3、查看默认版本库 cat /etc/sysconfig/svnserve # OPTIONS is used to pass command-line arguments to svnserve. # # Specify the repository location in -r parameter: OPTIONS="-r /var/svn" 可以看到默认是在/var/svn目录下,我们可以修改成自己需要的。 4、建立版本库 svnadmin create /var/svn/project 我们创建好之后,默认该目录下会自动创建几个目录: [root@xs_test_bk project]# ll total 28 drwxr-xr-x 2 root root 4096 Apr 19 11:18 conf drwxr-sr-x 6 root root 4096 Apr 19 11:48 db -r--r--r-- 1 root root 2 Apr 18 18:21 format drwxr-xr-x 2 root root 4096 Apr 18 18:21 hooks drwxr-xr-x 2 root root 4096 Apr 18 18:21 locks -rw-r--r-- 1 root root 229 Apr 18 18:21 README.txt drwxr-xr-x 2 root root 4096 Apr 18 18:45 xscode 5、配置 1)添加用户 vim conf/passwd [users] # harry = harryssecret # sally = sallyssecret admin = xs@0418 qiantao = qiantao@0307 xuehua = xuehua jyp = yuanpeng0224 等号左边是用户名,右边是密码 2)设置权限 vim conf/authz [root@xs_test_bk conf]# cat authz ### This file is an example authorization file for svnserve. ### Its format is identical to that of mod_authz_svn authorization ### files. ### As shown below each section defines authorizations for the path and ### (optional) repository specified by the section name. ### The authorizations follow. An authorization line can refer to: ### - a single user, ### - a group of users defined in a special [groups] section, ### - an alias defined in a special [aliases] section, ### - all authenticated users, using the '$authenticated' token, ### - only anonymous users, using the '$anonymous' token, ### - anyone, using the '*' wildcard. ### ### A match can be inverted by prefixing the rule with '~'. Rules can ### grant read ('r') access, read-write ('rw') access, or no access ### (''). [aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe xs = admin,qiantao,xuehua # [/foo/bar] # harry = rw # &joe = r # * = [project:/] admin = rw qiantao = rw xuehua = rw jyp = rw # [repository:/baz/fuz] # @harry_and_sally = rw # * = r 这里我们也可以创建一个组,将用户全都放到组里,例如: [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe xs = admin,qiantao,xuehua [project:/] @xs = rw 3)编辑svnserve.conf配置文件 添加以下内容 [general] anon-access = none auth-access = write password-db = passwd authz-db = authz realm = project 6、启动 systemctl enable svnserve.service 添加开机启动 systemctl start svnserve.service |
---|
至此搭建工作完成,需要注意的是svn默认监听端口3690,我们需要在防火墙里放通,如果使用的是云主机,还需要在控制台安全组处放通该端口。