一、svn服务端配置
1.准备并安装部署Svn版本系统_rec
使用 yum命令安装 openssh-server subversion 这两个软件
yum install openssh-serversubversion -y
[root@iZ25nzu9bj6Z ~]# yum install openssh-serversubversion -y
2.查看有没有安装
[root@iZ25nzu9bj6Z ~]# rpm -aq subversion subversion-1.6.11-15.el6_7.x86_64
3.配置启动SVN服务并检查启动结果
建立svn版本库数据存储根目录(svndata)及用户、密码权限目录svnpasswd
[root@iZ25nzu9bj6Z ~]# mkdir -p /application/svndata 数据存储根目录 [root@iZ25nzu9bj6Z ~]# mkdir -p /application/svnpasswd 用户、密码权限目录
4.启动svn
[root@iZ25nzu9bj6Z ~]# svnserve -d -r /application/svndata/
5.查看有没有启动
[root@iZ25nzu9bj6Z ~]# ps -ef|grep svn root 31793 1 0 21:57 ? 00:00:00 svnserve -d -r /application/svndata/ root 31795 31730 0 21:58 pts/1 00:00:00 grep svn
6.检测svn端口
[root@iZ25nzu9bj6Z ~]# netstat -lntup|grep 3690 tcp 0 0 0.0.0.0:3690 0.0.0.0:* LIST EN 31793/svnserve
7.建立项目版本库
创建一个新的sudversion项目sadoc,其实,类似sadoc这样的项目可以创建多个,每个项目对应不同的代码,这里只是以创建一个项目为例演示:
[root@iZ25nzu9bj6Z ~]# svnadmin create /application/svndata/sadoc
[root@iZ25nzu9bj6Z ~]# ll /application/svndata/ total 4 drwxr-xr-x 6 root root 4096 Apr 29 22:08 sadoc
[root@iZ25nzu9bj6Z ~]# tree /application/svndata/ /application/svndata/ └── sadoc ├── conf │ ├── authz │ ├── passwd │ └── svnserve.conf ├── db │ ├── current │ ├── format │ ├── fsfs.conf │ ├── fs-type │ ├── min-unpacked-rev │ ├── rep-cache.db │ ├── 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 11 directories, 28 files
8.调整svn配置文件及权限文件
配置允许用户oldboy读写访问
[root@iZ25nzu9bj6Z ~]# cd /application/svndata/sadoc/conf [root@iZ25nzu9bj6Z conf]# ll total 12 -rw-r--r-- 1 root root 1080 Apr 29 22:08 authz -rw-r--r-- 1 root root 309 Apr 29 22:08 passwd -rw-r--r-- 1 root root 2279 Apr 29 22:08 svnserve.conf
修改前做一个备份
[root@iZ25nzu9bj6Z conf]# cp svnserve.conf svnserve.conf.ori
[root@iZ25nzu9bj6Z conf]# vim svnserve.conf # anon-access = read
改为
anon-access = none
# auth-access = write
改为
auth-access = write
# password-db = passwd
改为
password-db = /application/svnpasswd/passwd
# authz-db = authz
改为
authz-db = /application/svnpasswd/authz
9.备份前和备份后对比
[root@iZ25nzu9bj6Z conf]# diff svnserve.conf.ori svnserve.conf 12,13c12,13 < # anon-access = read < # auth-access = write --- > anon-access = none > auth-access = write 20c20 < # password-db = passwd --- > password-db = /application/svnpasswd/passwd 27c27 < # authz-db = authz --- > authz-db = /application/svnpasswd/authz
[root@iZ25nzu9bj6Z conf]# ll /application/svnpasswd total 0 [root@iZ25nzu9bj6Z conf]# cp passwd authz /application/svnpasswd/
让非root用户不能查看
[root@iZ25nzu9bj6Z conf]# cd /application/svnpasswd/ [root@iZ25nzu9bj6Z svnpasswd]# chmod 700 * [root@iZ25nzu9bj6Z svnpasswd]# ll total 8 -rwx------ 1 root root 1080 Apr 29 22:30 authz -rwx------ 1 root root 309 Apr 29 22:30 passwd
10.为Svn版本库创建用户并授权访问指定项目版本库
[root@iZ25nzu9bj6Z svnpasswd]# vi passwd [users] # harry = harryssecret # sally = sallyssecret oldboy = oldboy123 gongli = gongli guozhen= guozhen
提示:
1.等号前为svn帐号,等号后为svn密码,密码是明文的,注意密码权限;
2.更改svnserve.conf时,需要重启svn,更改authz,paswd文件时不需要重启svn服务。
[root@iZ25nzu9bj6Z svnpasswd]# vi authz
[sadoc:/]
oldboy = rw
gongli = r
guozhen = rwx
管理组时定义一个组
sagroup = oldboy,gongli,guozhen [sadoc:/] oldboy = rw gongli = r guozhen = rwx @sagroup = r
重启svn
[root@iZ25nzu9bj6Z svnpasswd]# pkill svnserve [root@iZ25nzu9bj6Z svnpasswd]# svnserve -d -r /application/svndata/ [root@iZ25nzu9bj6Z svnpasswd]# ps aux |grep svn root 31860 0.0 0.0 156996 760 ? Ss 23:01 0:00 svnserve -d -r /application/svndata/ root 31862 0.0 0.0 103256 840 pts/1 S+ 23:02 0:00 grep svn
二、客户端配置
https://help.aliyun.com/knowledge_detail/6562974.html?pos=2