学习代码管理平台之svn的安装于使用

SVN的安装与使用

一、svn的安装和配置
实验为两个节点
1、服务端安装

安装
[root@localhost ~]# yum install -y subversion
创建一个目录
[root@localhost ~]# mkdir -p /data/svnroot/myproject
指定目录创建版本库
[root@localhost ~]# svnadmin create /data/svnroot/myproject
进入以上目录
[root@localhost ~]# cd !$
cd /data/svnroot/myproject
[root@localhost myproject]# cd conf
这下面三个需要配置的文件              
[root@localhost conf]# ll
total 12
-rw-r--r--. 1 root root 1080 Nov  6 16:58 authz
-rw-r--r--. 1 root root  309 Nov  6 16:58 passwd
-rw-r--r--. 1 root root 3090 Nov  6 16:58 svnserve.conf

首先配置authz文件

[root@localhost conf]# vi authz
添加以下内容
[groups]
admins = lsk,user1			//admins组包含lsk与user1用户
[/]						//指项目目录
@admins = rw				//设置组权限
*= r
[myproject:/]				//针对项目设置权限
user1 = rw

设置用户密码

[root@localhost conf]# vi passwd 
添加
[users]
lsk=lsk000
user1=user1000
user2=user2000

配置svnserve.conf文件

[root@localhost conf]# vi svnserve.conf 
添加
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = /data/svnroot/myproject

然后启动

[root@localhost conf]# svnserve -d -r /data/svnroot

拉去项目

[root@localhost conf]# cd /opt/
[root@localhost opt]# svn checkout svn://192.168.200.70/myproject --username=lsk      // 拉取项目
Authentication realm: <svn://192.168.200.70:3690> /data/svnroot/myproject
Password for 'lsk':       // 输入lsk用户的密码

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://192.168.200.70:3690> /data/svnroot/myproject

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes     // 输入yes 
Checked out revision 0.

然后再/opt/有一个mypeoject的目录下会有一个隐藏的 .svn

[root@localhost opt]# cd myproject/
[root@localhost myproject]# ll
total 0
[root@localhost myproject]# ls -la
total 0
drwxr-xr-x. 3 root root 17 Nov  6 17:09 .
drwxr-xr-x. 4 root root 35 Nov  6 17:09 ..
drwxr-xr-x. 4 root root 70 Nov  6 17:09 .svn

2、客户端安装使用
安装和拉取

[root@localhost yum.repos.d]# yum install -y subversion
[root@localhost yum.repos.d]# cd /opt/
[root@localhost opt]# svn checkout svn://192.168.200.70/myproject --username=lsk   拉取项目
Authentication realm: <svn://192.168.200.70:3690> /data/svnroot/myproject
Password for 'lsk': 
Authentication realm: <svn://192.168.200.70:3690> /data/svnroot/myproject
Username: lsk
Password for 'lsk': 

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://192.168.200.70:3690> /data/svnroot/myproject

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Checked out revision 0.
[root@localhost opt]# ll
total 2
dr-xr-xr-x. 8 root root 2048 Dec 10  2015 cdrom
drwxr-xr-x. 2 root root    6 Nov 26 01:23 lv
drwxr-xr-x. 3 root root   17 Nov 26 05:16 myproject
drwxr-xr-x. 2 root root    6 Nov 26 00:36 sdb1
[root@localhost opt]# cd myproject/
[root@localhost myproject]# ll -la
total 0
drwxr-xr-x. 3 root root 17 Nov 26 05:16 .
drwxr-xr-x. 6 root root 54 Nov 26 05:16 ..
drwxr-xr-x. 4 root root 70 Nov 26 05:16 .svn

把文件添加到版本控制中心

[root@localhost myproject]# cp /etc/fstab .
[root@localhost myproject]# svn add fstab

A fstab
把文件上传到服务器

[root@localhost myproject]# svn commit -m"add fstab file"
Adding         fstab
Transmitting file data .
Committed revision 1.

在本地删除

[root@localhost myproject]# svn delete fstab
D         fstab

在服务器上提交删除操作

[root@localhost myproject]# svn commit -m "delete fstab file"
Deleting       fstab

Committed revision 2.

把当前目录下的文件都更新到最新版

[root@localhost myproject]# svn update
Updating '.':
At revision 1.

查看变更日志

[root@localhost myproject]# svn update
Updating '.':
At revision 1.
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值