Linux服务器SVN配置及管理项目迁移

2 篇文章 0 订阅
1 篇文章 0 订阅

前言:本文章根据有些公司对于项目管理,所以有些公司对于SVN使用有些挑剔,有些会使用GIT或者Github等等,这不我们公司使用的就是SVN,技术老大说要把Windows系统上的SVN项目迁移至公司Linux服务器上,顺便在Linux上面搭建SVN及配置SVN,第一次操作迁移至Linux服务器上,没办法搞呗,然后去网上查了一下,大部分的教程都是一样,没啥新意,但是有很多讲的教程信息不全,看到这里就想叼人,给人留这么多坑。经过我一天的研究,完美成功,下面就请大家来欣赏。

安装 SVN:

yum install subversion

创建svn仓库路径:

# cd /opt/svn/
# svnadmin create /opt/svn/test

创建成功后在 /opt/svn/test 会有相关文件夹 :

drwxr-xr-x 2 root root 4096 Mar 30 20:05 conf
drwxr-sr-x 6 root root 4096 Mar 30 20:05 db
-r--r--r-- 1 root root 2 Mar 30 20:05 format
drwxr-xr-x 2 root root 4096 Mar 30 20:05 hooks
drwxr-xr-x 2 root root 4096 Mar 30 20:05 locks
-rw-r--r-- 1 root root 229 Mar 30 20:05 README.txt

配置文件讲解:

上面的文件中 , 文件夹 conf 是用来存放配置文件的 :

authz 是权限控制文件
passwd 是帐号密码文件
svnserve.conf 是SVN服务配置文件

 

配置 authz:

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

#用户组
dev = dev
#项目用户名
bbt = yukai.li,test

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

#给予用户加入读写权限
[/]
@dev = rw
[/]
@bbt = rw

配置 passwd:

[root@bbt-dev conf]# more 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
test = 123456
yukai.li = 666666

 

修改配置 svnserve.conf,这里按照我配置修改就可以了:

#把这个几个前面#去掉就可以了,最后一个直接填写你创建的项目目录名
anon-access = one
auth-access = write
password-db = passwd
authz-db = authz
realm = test
[root@bbt-dev conf]# more svnserve.conf
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = one
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
realm = test

[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256
[root@bbt-dev conf]#

启动服务:

# svnserve -d -r /opt/svn/test

 查看SVN进程:

# ps -ef|grep svn
root 12538 1 0 14:40 ? 00:00:00 svnserve -d -r /opt/svn/test
#或者直接用这个命令查看;
[root@bbt-dev bbt]# ps -aux
root       6122  0.0  0.0 152416   864 ?        Ss   Sep21   0:00 svnserve -d -r /opt/svn/test
#这样表示已启动成功,再启动的时候你只需要启动你创建的test这个项目目录就好;

客户端连接:

使用 TortoiseSVN , 输入地址svn://192.168.0.204:3690/即可 , 再输入用户名和密码就能访问了
(注:那个端口加不加都行了,我个人测试了一下可以不用添加,另外解释一下为什么地址开头是svn,是因为
这个表示Linux服务器上定义的一个区别,用来区分http表示Windows上的svn,小编个人是这么认为的,如大家想知道,可以去研究一下)

 停止重启SVN:

# killall svnserve     //停止
# svnserve -d -r /opt/svn/test   // 启动

导入项目源代码:

# svn import [源路径][目标版本库路径] -m [日志信息]//例如:
svn import /home/work/ file:///svn/project1/trunk/ -m "Initial import"
#不过我这里没有这样操作使用,可以看看继续操作,因为感觉那样来回操作很麻烦;

接下来是我个人导入项目源码的方式,我是直接使用SVN客户端方式导入,我认为那样比较安全,速度还是比较快,你只需要把个人项目从SVN拉到本地电脑上,之后连接用客户端连接我们创建好的svn服务器,不多说了请大家看图:

1、首先桌面随便创建一个文件夹,选中右键然后选中版本库浏览器,输入地址

2、确定后,就会弹出让你输入用户名和密码,这里小编认为最好不要保存密码

3、确定密码后,就会弹出下面这个页面;

4、我们刚搞好的SVN服务器里面,这个里面是空的,所以你只需要选择左边的那个地址然后右键,直接新创建一个文件名,之后选中新创建的文件夹,然后右键选中加入文件夹,然后找到你拉下来的项目,然后确定就OK了,导入完后,个人可以直接checkOut一下就知道了

 

linux搭建配置SVN,eclipse连接时遇到的问题

到这里,小编还没讲完,因为搞好这些,我以为就完事了,因为我公司统一使用的eclipse开发,所以eclipse插件还是个问题,我在直接新建立资源位置的时候发现直接会返回这个错误Eclipse中的Subversion版本控制工具出现Malformed network data的问题,然后小编当场就蒙了,第一次遇到这个问题,我便上网查了很久后,都不可以,最后小编发现了一个牛掰的博客,我试了一下果然OK了,下面我给大家分享出来。

Eclipse安装SVN插件

使用SVN进行项目的版本管理是非常流行的操作,这篇博客将描述Eclipse安装SVN的方法(Linux安装服务器端的请参考CentOS安装SVN)。

从菜单栏依次打开 Help - Install New Software,然后在弹出的窗口点击Add,在Location里面输入如下地址,获取最新的SVN插件,如果需要其他版本,可以在 https://github.com/subclipse/subclipse/wiki 查找。

Subclipse - https://dl.bintray.com/subclipse/releases/subclipse/latest/

Name可以随便写,可以写Subversion,然后点击确定,等到获取了所有的插件列表后,勾选这些插件,点击下一步,然后接受协议,一步一步安装就好了。


安装完成后,需要打开SVN视图,在菜单栏依次点击 Window - Show View - Other,然后选择 SVN - SVN资源库,在资源库空白处右键单击,选择新建 - 资源库位置。然后依次填写信息即可。

到此完结Linux建立SVN配置连接,全部OK了,真的废了小编N个脑细胞

如有疑问不懂得,可以添加我的QQ:2919529566

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值