SVN部署
部署SVN使用的服务器版本
[root@linux-node1 ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
服务器一般默认有安装,如果没有安装可以使用yum -y install 的方式来安装
[root@linux-node1 ~]# rpm -qa subversion subversion-1.7.14-10.el7.x86_64
创建SVN的数据目录、密码目录
[root@linux-node1 ~]# mkdir -pv /application/{svndata,svnpasswd}
mkdir: created directory ‘/application’
mkdir: created directory ‘/application/svndata’
mkdir: created directory ‘/application/svnpasswd’
[root@linux-node1 ~]# ll /application/
total 0
drwxr-xr-x 2 root root 6 Sep 19 05:59 svndata
drwxr-xr-x 2 root root 6 Sep 19 05:59 svnpasswd
创建SVN
[root@linux-node1 ~]# svnadmin create /application/svndata/sadoc
看一下create后生成什么
[root@linux-node1 ~]# tree /application/svndata/sadoc /application/svndata/sadoc ├── conf │ ├── authz │ ├── passwd │ └── svnserve.conf ├── db │ ├── current │ ├── format │ ├── fsfs.conf │ ├── fs-type │ ├── min-unpacked-rev │ ├── revprops │ │ └── 0 │ │ └── 0 │ ├── revs │ │ └── 0 │ │ └── 0 │ ├── transactions │ ├── txn-current │ ├── txn-current-lock │ ├── txn-protorevs │ ├── uuid │ └── write-lock ├── format ├── hooks │ ├── post-commit.tmpl │ ├── post-lock.tmpl │ ├── post-revprop-change.tmpl │ ├── post-unlock.tmpl │ ├── pre-commit.tmpl │ ├── pre-lock.tmpl │ ├── pre-revprop-change.tmpl │ ├── pre-unlock.tmpl │ └── start-commit.tmpl ├── locks │ ├── db.lock │ └── db-logs.lock └── README.txt
编辑svnserver.conf之前先做备份
[root@linux-node1 ~]# cd /application/svndata/sadoc/conf/
[root@linux-node1 conf]# ll
total 12
-rw-r--r-- 1 root root 1080 Sep 19 06:02 authz
-rw-r--r-- 1 root root 309 Sep 19 06:02 passwd
-rw-r--r-- 1 root root 3090 Sep 19 06:02 svnserve.conf
[root@linux-node1 conf]# cp svnserve.conf{,.bak}
进行编辑
19 anon-access = none 20 auth-access = write 27 password-db = /application/svnpasswd/passwd 34 authz-db = /application/svnpasswd/authz
比对
[root@linux-node1 conf]# diff svnserve.conf.bak svnserve.conf 19,20c19,20 < # anon-access = read < # auth-access = write --- > anon-access = none > auth-access = write 27c27 < # password-db = passwd --- > password-db = /application/svnpasswd/passwd 34c34 < # authz-db = authz --- > authz-db = /application/svnpasswd/authz
移动authz和passwd文件到svnpasswd下
[root@linux-node1 conf]# mv authz passwd /application/svnpasswd/ [root@linux-node1 conf]# cd /application/svnpasswd/ [root@linux-node1 svnpasswd]# ls authz passwd
svn的端口和帮助说明
# lsof -i:3690
svnserve --help
usage: svnserve [-d | -i | -t | -X] [options]
Valid options:
-d [--daemon] : daemon mode
-i [--inetd] : inetd mode
-t [--tunnel] : tunnel mode
-X [--listen-once] : listen-once mode (useful for debugging)
-r [--root] ARG : root of directory to serve
-R [--read-only] : force read only, overriding repository config file
--config-file ARG : read configuration from file ARG
--listen-port ARG : listen port
[mode: daemon, listen-once]
--listen-host ARG : listen hostname or IP address
[mode: daemon, listen-once]
-6 [--prefer-ipv6] : prefer IPv6 when resolving the listen hostname
[IPv4 is preferred by default. Using IPv4 and IPv6
at the same time is not supported in daemon mode.
Use inetd mode or tunnel mode if you need this.]
-c [--compression] ARG : compression level to use for network transmissions
[0 .. no compression, 5 .. default,
9 .. maximum compression]
-M [--memory-cache-size] ARG : size of the extra in-memory cache in MB used to
minimize redundant operations.
Default is 128 for threaded and 16 for non-
threaded mode.
[used for FSFS repositories only]
--cache-txdeltas ARG : enable or disable caching of deltas between older
revisions.
Default is no.
[used for FSFS repositories only]
--cache-fulltexts ARG : enable or disable caching of file contents
Default is yes.
[used for FSFS repositories only]
-T [--threads] : use threads instead of fork [mode: daemon]
--foreground : run in foreground (useful for debugging)
[mode: daemon]
--log-file ARG : svnserve log file
--pid-file ARG : write server process ID to file ARG
[mode: daemon, listen-once]
--tunnel-user ARG : tunnel username (default is current uid's name)
[mode: tunnel]
-h [--help] : display this help
--version : show program version information
-q [--quiet] : no progress (only errors) to stderr
启动svn
[root@linux-node1 conf]# svnserve -d -r /application/svndata/ [root@linux-node1 conf]# lsof -i:3690 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME svnserve 9989 root 3u IPv4 97822 0t0 TCP *:svn (LISTEN) [root@linux-node1 conf]# pwd /application/svndata/sadoc/conf
编辑密码文件
[users] # harry = harryssecret # sally = sallyssecret zhangsan = zhangsan123 lisi = lisi123 stu001 = 123 stu002 = 456
添加权限控制
[groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe user = stu001,stu002 # [/foo/bar] # harry = rw # &joe = r # * = # [repository:/baz/fuz] # @harry_and_sally = rw # * = r [sadoc:/] zhangsan = rw li = r @user = r
最后在客户端安装snv软件登陆 右击 SVN Checkout 填写你的SVN地址svn://192.168.56.11/sadoc 不要保存密码,成功之后就能updata和commit

浙公网安备 33010602011771号