linux源码编译安装subversion

一、下载安装包

subversion源码包下载
https://subversion.apache.org/download.cgi

apr源码包
https://dist.apache.org/repos/dist/release/apr/

apr-util源码包
https://dist.apache.org/repos/dist/release/apr/

serf源码包
https://www.apache.org/dist/serf/

scons源码包
https://sourceforge.net/projects/scons/files/scons

sqlite-amalgamation源码包
http://www.sqlite.org

二、安装必要依赖

yum -y install zlib zlib-devel openssl openssl-devel

三、安装apr

[root@SVNSAPP1 tomcat]# tar -xvf apr-1.7.0.tar.gz
[root@SVNSAPP1 apr-1.7.0]#cd /tomcat/apr-1.7.0 
[root@SVNSAPP1 apr-1.7.0]#./configure --prefix=/data/apr
[root@SVNSAPP1 apr-1.7.0]#make && make instlal

报错处理rm: cannot remove `libtoolT’: No such file or directory
处理:将configure文件中的 R M " RM " RM"cfgfile"这行代码注释掉就可以了

四、安装apr-util

[root@SVNSAPP1 tomcat]# tar -xvf apr-util-1.6.1.tar.gz 
[root@SVNSAPP1 tomcat]# cd apr-util-1.6.1
[root@SVNSAPP1 apr-util-1.6.1]#./configure --prefix=/data/apr-util --with-apr=/data/apr
[root@SVNSAPP1 apr-util-1.6.1]# make && make install

错误:xml/apr_xml.c:35:19: 错误:expat.h:没有那个文件或目录
处理:在https://launchpad.net/ubuntu/+source/expat/2.0.1-7.2ubuntu1.4找到了expat_2.0.1.orig.tar.gz包进行安装,然后重新编译通过

[root@SVNSAPP1 expat-2.0.1]# ./configure
[root@SVNSAPP1 expat-2.0.1]# make && make install

五、安装scons

[root@SVNSAPP1 tomcat]# cd scons-2.5.1
[root@SVNSAPP1 scons-2.5.1]# python setup.py install --prefix=/data/scons

六、安装serf

[root@SVNSAPP1 tomcat]# cd serf-1.3.9
[root@SVNSAPP1 serf-1.3.9]# /data/scons/bin/scons PREFIX=/data/serf APR=/data/apr APU=/data/apr-util
[root@SVNSAPP1 serf-1.3.9]# /data/scons/bin/scons install
[root@SVNSAPP1 serf-1.3.9]# cp /data/serf/lib/libserf-1.so* /usr/local/lib/

七、安装svn

[root@SVNSAPP1 tomcat]# mkdir -p /data/subversion/sqlite-amalgamation
[root@SVNSAPP1 tomcat]# unzip sqlite-amalgamation-3380200.zip -d /data/subversion
[root@SVNSAPP1 subversion-1.14.1]# ./configure --prefix=/data/svn --with-apr=/data/apr --with-apr-util=/data/apr-util --with-serf=/data/serf --enable-mod-activation --with-lz4=internal --with-utf8proc=internal
[root@SVNSAPP1 subversion-1.14.1]# make && make install

错误1:cannot stat `sqlite-amalgamation-3280000’: No such file or directory
处理:需要将sqlite-amalgamation-3380200.zip此文件解压到你当前subversion编译安装所处目录的sqlite-amalgamation(自己新建)目录中。
mv sqlite-amalgamation-3280000 subversion-1.12.0/sqlite-amalgamation

错误2:configure: error: Subversion requires LZ4 >= r129, or use --with-lz4=internal
解决:./configure命令添加 --with-lz4=internal选项

错误3:configure: error: Subversion requires UTF8PROC
解决:./configure命令添加 --with-utf8proc=internal

八、添加环境变量

[root@SVNSAPP1 subversion-1.14.1]# echo "export PATH=/data/svn/bin:$PATH" >> /etc/profile
[root@SVNSAPP1 subversion-1.14.1]# source /etc/profile

九、查看安装信息

[root@SVNSAPP1 /]# svnserve --version
svnserve,版本 1.14.1 (r1886195)
   编译于 Apr  6 2022,11:59:08 在 x86_64-unknown-linux-gnu

Copyright (C) 2021 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

下列版本库后端(FS) 模块可用: 

* fs_fs : 模块与文本文件(FSFS)版本库一起工作。
* fs_x : Module for working with an experimental (FSX) repository.

[root@SVNSAPP1 /]# svn --version
svn: error while loading shared libraries: libserf-1.so.1: cannot open shared object file: No such file or directory
[root@SVNSAPP1 /]# 

错误:svn: error while loading shared libraries: libserf-1.so.1: cannot open shared object file: No such file or director
处理:编辑把我们拷贝serf的文件的目录加上

vi /etc/ld.so.conf
把我们拷贝serf的文件的目录加上
/usr/local/lib
ldconfig
[root@SVNSAPP1 /]# svn --version
svn,版本 1.14.1 (r1886195)
   编译于 Apr  6 2022,11:59:08 在 x86_64-unknown-linux-gnu

Copyright (C) 2021 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

可使用以下的版本库访问模块: 

* ra_svn : 使用 svn 网络协议访问版本库的模块。
  - 处理“svn”方案
* ra_local : 访问本地磁盘的版本库模块。
  - 处理“file”方案
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.9 (compiled with 1.3.9)
  - 处理“http”方案
  - 处理“https”方案

The following authentication credential caches are available:

* GPG-Agent

[root@SVNSAPP1 /]# 

十、创建svn仓库

[root@SVNSAPP1 /]# mkdir -p /data/rst  #创建代码目录
[root@SVNSAPP1 /]# svnadmin create /data/rst/ztylsy #创建svn代码库
[root@SVNSAPP1 /]#  cd /data/rst/ztylsy
[root@SVNSAPP1 ztylsy]# ls
conf  db  format  hooks  locks  README.txt
[root@SVNSAPP1 ztylsy]# 

十一、svn配置路径

配置文件存放目录/data/rst/ztylsy/conf

1、权限配置文件 authz

[groups]
# 按用户组分权限
yh = yh_wxc,yh_ldc  # yh为用户组,等号之后的为用户
wd = wd_lmf,wd_hlh  # wd为用户组,等号之后的为用户
# /表示仓库根目录,用户名=权限
[/]   #表示/data/rst/ztylsy
@yh = rw
@wd = r

[/yh] #/data/rst/ztylsy/yh
@yh = rw     # 表示yh组对yh目录有读写权限


第一种方式:单个添加:
[/]
admin = rw
test = r
第二种方式(后面采用此方式配置):用户分组,再设权限
[/]
@admin = rw
@test = r

2、用户名口令文件 passwd

[users]
test = 123456
yh_wxc = Yinhai@123

格式为 账号 = 密码,上面配置了两个用户test和yh_wxc。

3、svn服务配置文件 svnserve.conf

[general]
#禁止匿名访问,默认为read,参数:read,write
anon-access = none
#授权用户写权限
auth-access = write
#用户密码文件
password-db = passwd
#授权登录文件
authz-db = authz
#每个svn项目认证名,建议写项目名
realm = /data/rst/ztylsy

参数一定要[general]模块里面,要不然不生效。

十二、启动关闭svn服务

一台机器可以启动多个svn服务,需修改不同端口号。

[root@SVNSAPP1 conf]#  svnserve -d -r /data/rst --listen-port 3690
[root@SVNSAPP1 conf]# ps -ef|grep svn
root     24761     1  0 12:25 ?        00:00:00 svnserve -d -r /data/rst --listen-port 3690
root     24763 43575  0 12:25 pts/0    00:00:00 grep svn
[root@SVNSAPP1 conf]# netstat -ln|grep 3690
tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      
[root@SVNSAPP1 conf]# killall svnserve
[root@SVNSAPP1 conf]# netstat -ln|grep 3690
[root@SVNSAPP1 conf]# 

十三、设置svn服务开机启动

方法一:
修改/etc/rc.d/rc.local文件,添加如下命令

/data/svn/bin/svnserve -d -r /data/rst --listen-port 3690

方法二:
在/etc/init.d/目录下创建svn文件并设置权限755,代码如下

#!/bin/bash
# centos下可以用如下命令管理svn: service svn start(restart/stop)
SVN_HOME=/data/rst
if [ ! -f "/data/svn/bin/svnserve" ]
then
    echo "svnserver startup: cannot start"
    exit
fi
case "$1" in
    start)
        echo "Starting svnserve..."
        /data/svn/bin/svnserve -d --listen-port 3690 -r $SVN_HOME
        echo "Finished!"
        ;;
    stop)
        echo "Stoping svnserve..."
        killall svnserve
        echo "Finished!"
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: svn { start | stop | restart } "
        exit 1
esac

chmod +x /etc/init.d/svn #添加执行权限

其它:为便于管理建议把SVN的版本库建在同一个目录中/data/rst/项目1,/data/rst/项目2,/data/rst/项目3。这样子最后在启动的时候只要启动最外一层目录就可以了:svnserve -d -r /data/rst
svn的个URL就是svn://IP/项目3,svn://IP/项目2,svn://IP/项目1

十四、测试svn可用性

1、windows客户端做chekcout。
在这里插入图片描述

在这里插入图片描述
2、新建一个文件上传,commit提交
在这里插入图片描述
3、linux使用SVN命令进行checkout操作,登录后可以看到Windows上创建的文件已经出现cs.txt
在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值