svn的部署

1、服务器端的搭建

1.1 安装软件

[root@svn-server ~]# yum install subversion –y

1.2 创建目录

[root@svn-server ~]# mkdir -p /home/svn/test

1.3 创建新的repository(版本库)

[root@svn-server ~]# svnadmin create /home/svn/test
test为版本库目录名称
创建版本库后,在这个目录下会生成3个配置文件:

[root@svn-server ~]# cd /home/svn/test/conf/
[root@svn-server conf]# ls
authz  passwd  svnserve.conf

svnserve.conf 文件, 该文件配置参数项分为以下5项:

  • anon-access: 控制非鉴权用户访问版本库的权限。
  • auth-access: 控制鉴权用户访问版本库的权限。
  • password-db: 指定用户名口令文件名。
  • authz-db:指定权限配置文件名,通过该文件可以实现以路径为基础的访问控制。
  • realm:指定版本库的认证域,即在登录时提示的认证域名称。若两个版本库的认证域相同,建议使用相同的用户名口令数据文件

1.4 修改配置文件

[root@svn-server conf]# vim svnserve.conf      //下面5行注释打开
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz
realm = My First Repository
image.png

1.5 修改口令文件

[root@svn-server conf]# vim passwd

image.png

1.6 修改权限配置文件

[root@svn-server conf]# vim authz
[groups]
oneice = oneice      //定义组youngfit,且里面只有一个用户youngfit,组名可以自定义,用户名可以加多个,以逗号隔开
[test:/]
@oneice = rw      //定义目录,此目录是项目test的根目录
* = rw
image.png

1.7 启动服务

[root@svn-server conf]# svnserve -d -r /home/svn/
服务搭建结束
默认端口号:

[root@svn-server conf]# lsof -i:3690
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
svnserve 11148 root    3u  IPv4  36574      0t0  TCP *:svn (LISTEN)

服务器端使用:
查看版本库:

[root@svn-server conf]# svnlook tree /home/svn/test/ --full-paths --show-ids 
/ <0.0.r0/17>
--full-paths 显示路径
--show-ids 显示版本号

2、centos客户端连接测试

2.1 客户端安装:

[root@svn-client ~]# yum -y install subversion

2.2 checkout 把整个版本库下载下来

[root@svn-client ~]# svn checkout svn://10.8.156.34/test      //test为服务端版本库目录
[root@svn-client ~]# ls
anaconda-ks.cfg  test
[root@svn-client ~]# cd test/

提交代码文件:
服务器上没有的文件,在客户端需要先add预提交,再commit,如果服务器端已有的文件,直接commit

svn add /root/davesvn/test

svn ci /root/davesvn/test -m "创建新文件" //ci是commit的缩写, -m是添加注释

//提交,俗称存入

[root@svn-client test]# vim test1.txt    //随便写一些东西
[root@svn-client test]# svn add test1.txt
A         test1.txt
[root@svn-client test]# svn commit test1.txt -m "test1"
image.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。