CentOS7 Subversion安装

准备

1.subversion官网 http://subversion.apache.org/download/ 下载tar.gz的安装包

2.还需要到 http://apr.apache.org/download.cgi 下载subversion必须的apr和apr-util的tar.gz的包,subversion安装这2个包是必须的


Apr安装

1解压

 tar -zxvf apr-1.5.2.tar.gz


2 指定apr安装目录

[root@241 apr-1.5.2]# ./configure --prefix=/home/apr


3 编译安装

[root@241 apr-1.5.2]# make
[root@241 apr-1.5.2]# make install


Apr-util安装

1解压

tar -zxvf apr-util-1.4.1.tar.gz


2 指定apr-util安装目录

[root@241 apr-util-1.5.4]# ./configure --prefix=/home/apr-util --with-apr=/home/apr

注意需要使用—with-apr指定apr的安装目录


3 编译安装

[root@241 apr-util-1.5.4]# make

[root@241 apr-util-1.5.4]# make install


Subversion安装


1解压


[root@241 opt]# tar -zxvf subversion-1.9.4.tar.gz 


2指定svn安装目录

[root@241 subversion-1.9.4]# ./configure --prefix=/home/subversion --with-apr=/home/apr --with-apr-util=/home/apr-util  --with-sqlite=/home/sqlite

若提示如下错误:

configure: error: Subversion requires SQLite

则需要:

安装sqlite(http://www.sqlite.org/download.html)

下载最新安装包,目前最新为sqlite-autoconf-3071300.tar.gz

[root@241 opt]# tar -xzvf sqlite-autoconf-3150100.tar.gz 

[root@241 opt]# cd sqlite-autoconf-3150100

[root@241 sqlite-autoconf-3150100]# ./configure --prefix=/home/sqlite

[root@241 sqlite-autoconf-3150100]# make

[root@241 sqlite-autoconf-3150100]# make install




3 编译安装


[root@241 subversion-1.9.4]# make
[root@241 subversion-1.9.4]# make install


加入svn path

[root@241 etc]# vi /etc/profile

在文件最后面添加

    PATH=/u01/svnapp/subversion/bin:$PATH

    export PATH


 保存退出执行

[root@241 etc]# .  /etc/profile


测试SVN是否安装成功,执行:    svnserve --version




服务端配置


1资源库创建

利用svn命令创建资源库

[root@241 home]# svnadmin create/home/svn_repository/project_test


2 创建用户组及用户(注:修改的文件前面不能有空格,否则启动svn server出错

a.进入版本库中的配置目录conf,此目录有三个文件: svn服务综合配置文件(svnserve.conf)、 用户名口令文件(passwd)、权限配置文件(authz)

b.修改版本配置库文件[root@241 conf]# vi svnserve.conf 


在使用eclise安装的插件subclipse查看svn的提交历史记录的时候,提示org.apache.subversion.javahl.ClientException: Item is not readable错误:我的配置基本情况如下:

windows7安装eclise并安装subclise插件,在centos配置svn服务器,svn服务器中用户 demo权限是 

[/]

demo = rw

其中有一条:anon-access的配置条目是 anon-access=read

解决的方法是:

在conf目录下面的svnserve.conf 文件中 修改配置文件将anon-access=read修改成anon-access=none,然后重启svn服务器

再次访问就正常了,能看到历史记录信息了。



c.设置账号密码 [root@241 conf]# vi passwd

[root@241 conf]# vi 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
test1=123456
test2=123456
account1=123456
account2=123456
zhucw=123456
zhangtm=123456
huj=123456
yanxh=123456
liqy=123456
wangg=123456
huangjm=123456
zhangxy=123456
luxl=123456
xiaol=123456

d.设置权限[root@241 conf]# vi 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]
pdall = zhucw,xiaol,zhangtm,huangjm,huj,zhangxy
pd001 = zhucw
pd002 = zhucw
pd003 = zhucw
pd_b2b = xiaol,huj,huangjm,zhangxy,zhangtm
pd_b2b_r =
pd_admin = zhucw
pd_inter = zhucw
pd_test = liqy,yanxh
rd_admin = xiaol,zhucw
rdall = xiaol,zhucw
rd001 = zhucw,xiaol,zhangtm,huangjm,huj,zhangxy
rd_test = liqy,yanxh
devall = zhucw,xiaol,zhangtm,huangjm,huj,zhangxy



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


# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
@pd_admin=rw
#########################
[tshop:/]
@pdall = rw
#########################
[zgjf-pd:/]
@pdall=rw


e.启动svn服务

第一种:[root@241 conf]# svnserve -d -r /svn/

第二种:多版本库时可使用相同的配置文件

[root@241 svn]# mkdir conf

[root@241 svn]# cp -rp /svn/zgjf-pd/conf/svnserve.conf/svn/conf/

[root@241 svn]# cp -rp /svn/zgjf-pd/conf/authz /svn/conf/

[root@241 svn]# cp -rp /svn/zgjf-pd/conf/passwd /svn/conf/

第三种:指定端口启动

[root@241 conf]# svnserve -d -r /svn --config-file=/svn/conf/svnserve.conf --listen-port 88


3安装好的svn服务端,默认是不会开机自启动的,每次开机自己启动会很麻烦,我们可以把它设成开机启动

a.首先:编写一个启动脚本svn_startup.sh,我放在/svn/svn_startup.sh

[root@241 svn]# vi svn_startup.sh 
#!/bin/bash
#svnserve -d -r /svn --config-file=/svn/conf/svnserve.conf
/opt/svn1.8.16/bin/svnserve -d -r /svn --config-file=/svn/conf/svnserve.conf --listen-port 8888

这里的svnserve路径保险起见,最好写绝对路径,因为启动的时候,环境变量也许没加载。

绝对路径怎么查?

[root@241 svn]# which svnserve
/opt/svn1.8.16/bin/svnserve

b.然后修改该脚本的执行权限

[root@241 svn]# chmod 777 svn_startup.sh

c.最后:加入自动运行,rc.local末尾添加脚本的路径,如:

[root@241 svn]# vi /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.


touch /var/lock/subsys/local


/svn/svn_startup.sh



资源库迁移

1导出资源库到dump文件

[root@localhost home]# svnadmin dump /svn_repository/zgjf-pd  > /home/zgjf_pd_41185_41243.dump

2将dump文件拷贝到目标机器

[root@localhost home]# scp -r zgjf_pd_41185_41243.dump root@192.168.1.241:/home/

3导入dump文件到新的资源库位置

svnadmin load /svn/zgjf-pd  < /home/yy/svndump/zgjf_pd_41185_41243.dump



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值