(1)查看系统版本
[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
(2)查看系统全部信息
[[email protected] ~]# uname -a
Linux node-005 2.6.32-642.15.1.el6.x86_64 #1 SMP Fri Feb 24 14:31:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
(3)查看系统内核
[[email protected] ~]# uname -r
2.6.32-642.15.1.el6.x86_64
安装SVN
1、修改yum仓库配置(可不做,我这里做事保留SVN安装包)
[[email protected] ~]# sed -i ‘s#keepcache=0#keepcache=1#g‘ /etc/yum.conf
[[email protected] ~]# grep keepcache /etc/yum.conf #rpm包不删除
keepcache=1
[[email protected] ~]# yum -y install subversion
2、查找查找SVN安装包
[[email protected] ~]# find / -name subversion-1.6.11-15.el6_7.x86_64.rpm
/var/cache/yum/x86_64/6/base/packages/subversion-1.6.11-15.el6_7.x86_64.rpm
[[email protected] packages]# rpm -aq subversion
subversion-1.6.11-15.el6_7.x86_64
配置并启动SVN
1、创建SVN版本库根目录(svndata)及密码权限目录(svnpasswd)
[[email protected] ~]# mkdir -p /application/svndata
[[email protected] ~]# mkdir -p /application/svnpasswd
[[email protected] ~]# tree /application/svn*
/application/svndata
/application/svnpasswd
0 directories,0 files
2、启动SVN服务指定服务的SVN根目录
[[email protected] ~]# svnserve -d -r /application/svndata/
后台运行;-r 指定运行目录
注:查看svnserver命令帮助
[[email protected] ~]# svnserve --help
用法: svnserve [-d | -i | -t | -X] [options]
有效选项:
-d [--daemon] : 后台模式
-i [--inetd] : inetd 模式
-t [--tunnel] : 隧道模式
-X [--listen-once] : 监听一次方式(调试用)
-r [--root] ARG : 服务的根目录
-R [--read-only] : 强制只读;覆盖版本库配置文件
--config-file ARG : 从文件 ARG 读取配置
--listen-port ARG : 监听端口
[方式: daemon,listen-once]
--listen-host ARG : 监听主机名称或IP地址
[方式: daemon,listen-once]
-T [--threads] : 使用线程代替进程 [方式: daemon]
--foreground : 在前台运行(调试用)
[方式: daemon]
--log-file ARG : svnserve 日志文件
--pid-file ARG : 写进程 PID 到文件 ARG
[方式: daemon,listen-once]
--tunnel-user ARG : 隧道用户名(默认是当前UID对应的用户名)
[方式: tunnel]
-h [--help] : 显示本帮助
--version : 显示程序版本信息
3、查看服务是否启动
(1)查看进程
[[email protected] ~]# ps -ef |grep svn
root 67481 0 15:25 ? 00:00:00 svnserve -d -r /application/svndata/
root 67526658 0 15:34 pts/0 00:00:00 grep svn
(2)查看端口
[[email protected] ~]# netstat -lntup |grep svn
tcp 00 0.0.0.0:36900.0.0.0:* LISTEN 6748/svnserve
(3):已知端口号查看进程
[[email protected] ~]# lsof -i tcp:3690
COMMAND PID USERFD TYPE DEVICE SIZE/OFF NODE NAME
svnserve 6748 root 3u IPv448866 0t0 TCP *:svn (LISTEN)
创建SVN版本库
1、新的Subversion项目
(1)创建一个新的Subversion项目(版本库)
[[email protected] ~]# svnadmin create /application/svndata/sadoc
[[email protected] ~]# ll /application/svndata/sadoc/
总用量 24
drwxr-xr-x 2 root root 4096 4月 20 15:47 conf
drwxr-sr-x 6 root root 4096 4月 20 15:47 db
-r--r--r-- 1 root root 2 4月 20 15:47 format
drwxr-xr-x 2 root root 4096 4月 20 15:47 hooks
drwxr-xr-x 2 root root 4096 4月 20 15:47 locks
-rw-r--r-- 1 root root 229 4月 20 15:47 README.txt
(2)查看帮助
[[email protected] ~]# svnadmin --help
一般用法: svnadmin SUBCOMMAND REPOS_PATH [ARGS & OPTIONS ...]
使用“svnadmin help <subcommand>” 得到子命令的帮助信息。
使用“svnadmin --version”查看程序的版本号和文件系统模块。
可用的子命令:
crashtest
create
deltify
dump
...
[[email protected] ~]# svnadmin help create
create: 用法: svnadmin create REPOS_PATH
在 REPOS_PATH 创建一个新的空版本库。
...
2、仓库用户权限配置
(1)配置允许用户solin读写访问
①备份配置文件
[[email protected] ~]# cd /application/svndata/sadoc/conf/
[[email protected] conf]# /bin/cp svnserve.conf svnserve.conf.solin$(date +%F)
②过滤要修改的配置
[[email protected] conf]# egrep "\-access|\-db =" svnserve.conf # anon-access = read # auth-access = write # password-db = passwd # authz-db = authz
③修改后的参数(可以用sed替换,也可用vi/vim直接修改)
[[email protected] conf]# egrep "-access|-db =" svnserve.conf
# anon-access = none #不允许匿名访问 # auth-access = write #允许可写 # password-db = /application/svnpasswd/passwd #密码数据库,存放SVN密码 # authz-db = /application/svnpasswd/authz #控制权限的数据库
另:修改后对比
[[email protected] conf]# egrep "-access|-db =" 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
[[email protected] conf]# diff svnserve.conf.solin2017-04-20 svnserve.conf
12a13
anon-access = none
13a15
auth-access = write
20a23
password-db = /application/svnpasswd/passwd
27a31
authz-db = /application/svnpasswd/authz
3、配置authz、passwd证书文件
[[email protected] conf]# cp authz passwd /application/svnpasswd/
[[email protected] conf]# chmod 700 /application/svnpasswd/*
[[email protected] conf]# ll /application/svnpasswd/
总用量 8
-rwx------ 1 root root 1080 4月 20 17:22 authz
-rwx------ 1 root root 309 4月 20 17:22 passwd
(2)authz、passwd的配置
[[email protected] svnpasswd]# cat /application/svnpasswd/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 oldboy = 123456 gongli = 123456 stu001 = 123456 stu002 = 123456
[[email protected] svnpasswd]# cat /application/svnpasswd/authz
...
[groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe # [/foo/bar] # harry = rw # &joe = r # * = # [repository:/baz/fuz] # @harry_and_sally = rw # * = r # [sadoc:/] oldboy = rw [sadoc:/stu001] stu001 = rw [sadoc:/gongli] gongli = rw
4、重启SVN
[[email protected] conf]# pkill svnserve
[[email protected] conf]# svnserve -d -r /application/svndata/
[[email protected] conf]# ps -ef |grep svn
root 68341 0 17:52 ? 00:00:00 svnserve -d -r /application/svndata/
root 68366658 0 17:52 pts/0 00:00:00 grep svn
Windows(客户端)安装TortoisSVN
将文件导入到svn服务器:
svn import /tmp/oldboy/ svn://139.199.160.55/sadoc -m "import svntree"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。