【原创】centos下使用yum安装svn

7 篇文章 0 订阅
2 篇文章 0 订阅

这里的内容全部发生在svn服务器上

yum安装svn

[root@LAMP1 html]# yum -y install subversion
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.pubyun.com
 * updates: mirrors.pubyun.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package subversion.x86_64 0:1.6.11-12.el6_6 will be installed
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion-1.6.11-12.el6_6.x86_64
--> Processing Dependency: libneon.so.27()(64bit) for package: subversion-1.6.11-12.el6_6.x86_64
--> Running transaction check
---> Package neon.x86_64 0:0.29.3-3.el6_4 will be installed
--> Processing Dependency: libgnutls.so.26(GNUTLS_1_4)(64bit) for package: neon-0.29.3-3.el6_4.x86_64
--> Processing Dependency: libproxy.so.0()(64bit) for package: neon-0.29.3-3.el6_4.x86_64
--> Processing Dependency: libpakchois.so.0()(64bit) for package: neon-0.29.3-3.el6_4.x86_64
--> Processing Dependency: libgnutls.so.26()(64bit) for package: neon-0.29.3-3.el6_4.x86_64
---> Package perl-URI.noarch 0:1.40-2.el6 will be installed
--> Running transaction check
---> Package gnutls.x86_64 0:2.8.5-14.el6_5 will be installed
--> Processing Dependency: libtasn1.so.3(LIBTASN1_0_3)(64bit) for package: gnutls-2.8.5-14.el6_5.x86_64
--> Processing Dependency: libtasn1.so.3()(64bit) for package: gnutls-2.8.5-14.el6_5.x86_64
---> Package libproxy.x86_64 0:0.3.0-10.el6 will be installed
--> Processing Dependency: libproxy-python = 0.3.0-10.el6 for package: libproxy-0.3.0-10.el6.x86_64
--> Processing Dependency: libproxy-bin = 0.3.0-10.el6 for package: libproxy-0.3.0-10.el6.x86_64
---> Package pakchois.x86_64 0:0.4-3.2.el6 will be installed
--> Running transaction check
---> Package libproxy-bin.x86_64 0:0.3.0-10.el6 will be installed
---> Package libproxy-python.x86_64 0:0.3.0-10.el6 will be installed
---> Package libtasn1.x86_64 0:2.3-6.el6_5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================
 Package                                           Arch                                     Version                                           Repository                                 Size
==============================================================================================================================================================================================
Installing:
 subversion                                        x86_64                                   1.6.11-12.el6_6                                   updates                                   2.3 M
Installing for dependencies:
 gnutls                                            x86_64                                   2.8.5-14.el6_5                                    base                                      346 k
 libproxy                                          x86_64                                   0.3.0-10.el6                                      base                                       39 k
 libproxy-bin                                      x86_64                                   0.3.0-10.el6                                      base                                      9.0 k
 libproxy-python                                   x86_64                                   0.3.0-10.el6                                      base                                      9.1 k
 libtasn1                                          x86_64                                   2.3-6.el6_5                                       base                                      238 k
 neon                                              x86_64                                   0.29.3-3.el6_4                                    base                                      119 k
 pakchois                                          x86_64                                   0.4-3.2.el6                                       base                                       21 k
 perl-URI                                          noarch                                   1.40-2.el6                                        base                                      117 k

Transaction Summary
==============================================================================================================================================================================================
Install       9 Package(s)

Total download size: 3.2 M
Installed size: 14 M
Downloading Packages:
Setting up and reading Presto delta metadata
updates/prestodelta                                                                                                                                                    | 233 kB     00:00     
Processing delta metadata
Package(s) data still to download: 3.2 M
(1/9): gnutls-2.8.5-14.el6_5.x86_64.rpm                                                                                                                                | 346 kB     00:00     
(2/9): libproxy-0.3.0-10.el6.x86_64.rpm                                                                                                                                |  39 kB     00:00     
(3/9): libproxy-bin-0.3.0-10.el6.x86_64.rpm                                                                                                                            | 9.0 kB     00:00     
(4/9): libproxy-python-0.3.0-10.el6.x86_64.rpm                                                                                                                         | 9.1 kB     00:00     
(5/9): libtasn1-2.3-6.el6_5.x86_64.rpm                                                                                                                                 | 238 kB     00:00     
(6/9): neon-0.29.3-3.el6_4.x86_64.rpm                                                                                                                                  | 119 kB     00:00     
(7/9): pakchois-0.4-3.2.el6.x86_64.rpm                                                                                                                                 |  21 kB     00:00     
(8/9): perl-URI-1.40-2.el6.noarch.rpm                                                                                                                                  | 117 kB     00:00     
(9/9): subversion-1.6.11-12.el6_6.x86_64.rpm                                                                                                                           | 2.3 MB     00:00     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                         2.3 MB/s | 3.2 MB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libproxy-bin-0.3.0-10.el6.x86_64                                                                                                                                           1/9 
  Installing : libproxy-python-0.3.0-10.el6.x86_64                                                                                                                                        2/9 
  Installing : libproxy-0.3.0-10.el6.x86_64                                                                                                                                               3/9 
  Installing : perl-URI-1.40-2.el6.noarch                                                                                                                                                 4/9 
  Installing : libtasn1-2.3-6.el6_5.x86_64                                                                                                                                                5/9 
  Installing : gnutls-2.8.5-14.el6_5.x86_64                                                                                                                                               6/9 
  Installing : pakchois-0.4-3.2.el6.x86_64                                                                                                                                                7/9 
  Installing : neon-0.29.3-3.el6_4.x86_64                                                                                                                                                 8/9 
  Installing : subversion-1.6.11-12.el6_6.x86_64                                                                                                                                          9/9 
  Verifying  : libproxy-0.3.0-10.el6.x86_64                                                                                                                                               1/9 
  Verifying  : libproxy-bin-0.3.0-10.el6.x86_64                                                                                                                                           2/9 
  Verifying  : subversion-1.6.11-12.el6_6.x86_64                                                                                                                                          3/9 
  Verifying  : pakchois-0.4-3.2.el6.x86_64                                                                                                                                                4/9 
  Verifying  : libproxy-python-0.3.0-10.el6.x86_64                                                                                                                                        5/9 
  Verifying  : libtasn1-2.3-6.el6_5.x86_64                                                                                                                                                6/9 
  Verifying  : neon-0.29.3-3.el6_4.x86_64                                                                                                                                                 7/9 
  Verifying  : gnutls-2.8.5-14.el6_5.x86_64                                                                                                                                               8/9 
  Verifying  : perl-URI-1.40-2.el6.noarch                                                                                                                                                 9/9 

Installed:
  subversion.x86_64 0:1.6.11-12.el6_6                                                                                                                                                         

Dependency Installed:
  gnutls.x86_64 0:2.8.5-14.el6_5     libproxy.x86_64 0:0.3.0-10.el6     libproxy-bin.x86_64 0:0.3.0-10.el6     libproxy-python.x86_64 0:0.3.0-10.el6     libtasn1.x86_64 0:2.3-6.el6_5    
  neon.x86_64 0:0.29.3-3.el6_4       pakchois.x86_64 0:0.4-3.2.el6      perl-URI.noarch 0:1.40-2.el6          

Complete!
[root@LAMP1 html]# 

之后就安装成功了,我们创建一个svn的根目录:

mkdir /var/www/svndata

之后我们需要使用svnadmin创建一个代码库chatroom:

svnadmin create /var/www/svndata/chatroom

(注意:代码仓库在svn中被叫做Repository,现在只是在svn中创建一份Repository,和你实际的工程目录目前还没有发生关系,这里叫chatroom只是为了和你实际的工程目录关联而已,如果想要把实际的工程代码import到代码仓库中,还要等待接下来的过程)。

现在我们就创建了代码仓库(Repository),但是如果你现在就打算import代码到此仓库,就会提示有问题:

[root@LAMP1 www]# svn import ./chromext_server svn://localhost/chromext_server/trunk -m 'init import'
svn: 认证失败

因为我们还没有给这个仓库设置任何权限,所以认证就失败了,所以我们要配置下我们这个myproject1下的的svn用户和权限。

首先我们可以看到/var/www/svndata/chatroom/目录下的结构:

[root@LAMP1 chatroom]# ll
总用量 24
drwxr-xr-x. 2 root root 4096 3月  19 15:03 conf
drwxr-sr-x. 6 root root 4096 3月  19 13:54 db
-r--r--r--. 1 root root    2 3月  19 13:33 format
drwxr-xr-x. 2 root root 4096 3月  19 13:33 hooks
drwxr-xr-x. 2 root root 4096 3月  19 13:33 locks
-rw-r--r--. 1 root root  229 3月  19 13:33 README.txt
[root@LAMP1 charroom]# 

我们需要到conf下,这里有很多好东西:

[root@LAMP1 conf]# ll
总用量 12
-rw-r--r--. 1 root root 1174 3月  19 14:39 authz
-rw-r--r--. 1 root root  314 3月  19 14:38 passwd
-rw-r--r--. 1 root root 2274 3月  19 13:34 svnserve.conf
[root@LAMP1 conf]# 

首先我们要到svnserve.conf里设置匿名用户和授权用户的权限:

anon-access = none
auth-access = write
password-db = passwd
authz-db = authz

我有一次上面的authz-db忘记去掉注释,结果导致权限没有work起来,任意人可以提交到trunk,失误啊。。。

然后我们到passwd文件里创建用户:

[users]
san.zhang=123456
si.li=123456
wu.wang=123456

然后到authz文件里设置用户组和授权:

[groups]
users=si.li,wu.wang
admin=san.zhang

[/]
@admin=rw
*=r

[chromext:/branches]
@users=rw

其中@代表后面的是组,没有@的话代表用户名。

最后我们开启我们的svn服务器就好了:

svnserve -d -r /var/www/svndata/

这里就发生在我们自己的电脑上了:

然后我们终于要来把我们的代码导入svn了,我们的代码架设在我们本地的机器上的这个目录:/user/local/webdata/mychatroom/

那么我们要这么做,首先,我们在我们本地的电脑中建立一个目录:

mkdir chatroom

然后我么cd chatroom,之后:

svn co svn://我们的svn服务器ip/chatroom .

这样就把svn上的chatroom仓库checkout到了本地,然后我们在chatroom中建立三个目录:

release
trunk
branches

然后我们:

svn add *
svn commit

之后我们可以:

svn import /usr/local/webdata/mychatroom svn://我们的svn服务器ip/chatroom/trunk -m 'init import'

然后我们可以把上面几个临时目录删掉,然后真正的从svn repository中拿代码到本地了:

svn co svn://我们的svn服务器ip/chatroom/trunk .

看看,是不是代码已经拉取到我们本地了呢,哈哈~~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值