CentOS 7中安装SVN服务器

最近上头安排了帮客户安装svn服务器,用了两种方式安装,yum命令安装,快速简洁容易上手,但是源码安装就比较繁琐,两种方式都试了一下,yum命令基本一个多小时就安装完了,但是源码安装弄了我两天的时间,比较蛋疼,看了网上很多的博文,踩了很多坑,最后也安装成功了,所就分享给有需要的人。
一、环境说明
操作系统:CentoS 7
Subversion版本:1.8.15
二、SVN安装

2.1 Subversion源码下载
下载地址:
选择版本:subversion-1.8.15.tar.gz (注,本文将所有安装过程需要的文件保存在/usr/local/java/svn目录下)

2.2 解压安装Subversion

#cd /usr/local/java/svn #tar -zxvf subversion-1.8.15.tar.gz #cd subversion-1.8.15 #./configure --prefix=/usr/local/subversion

2.3 configure: error: no suitable APRUTIL found
configure: WARNING: APR not found
The Apache Portable Runtime (APR) library cannot be found.
Please install APR on this system and configure Subversion
with the appropriate --with-apr option.
You probably need to do something similar with the Apache
Portable Runtime Utility (APRUTIL) library and then configure
Subversion with both the --with-apr and --with-apr-util options.
configure: error: no suitable APR found
搜索后发现缺乏apr和apr-util两个依赖包。
2.4 安装apr与apr-util
(以下的依赖软件包都传到/usr/local/java/svn/dependPackage/下,并且在这个目录下解压)
2.4.1 下载apr与apr-util
下载地址:
下载版本:apr-1.5.2.tar.gz apr-util-1.6.1.tar.gz
2.4.2 安装apr

#cd /usr/local/java/svn/dependPackage #tar -zxvf apr-1.5.2.tar.gz #cd apr-1.5.2 #./configure --prefix=/usr/local/apr

出现这个提示:cannot remove `libtoolT’: No such file or directory
解决方案:编辑 configure文件,查找 $RM "$cfgfile" 这个地方,用#注释掉,然后重新编译安装就可以了。

#make #make install

2.4.3 安装apr-util

#cd /usr/local/java/svn/dependPackage #tar -zxvf apr-util-1.6.1.tar.gz #cd apr-util-1.6.1 # ./configure --prefix=/usr/local/apr-uti --with-apr=/usr/local/apr #make #make install

2.5 重新配置subversion(每次重新配置都要回到subversion-1.8.15目录下)

#./configure --prefix=/usr/local/subversion --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

2.5.1 出现提示:configure: error: Subversion requires SQLite 说明缺乏sqlite依赖包
解决方案:
get the sqlite 3.7.15.1 amalgamation from: the archive using unzip and rename the resultingdirectory to:/RNA-data/software/S01_utilize/subversion-1.8.11/sqlite-amalgamation
下载sqlite-amalgamation-3071501.zip通过unzip解压到subversion-1.8.15/sqlite-amalgamation目录下

unzip sqlite-amalgamation-3230100.zip -d ../subversion-1.8.15 mv ../subversion-1.8.15/sqlite-amalgamation-3071501 ../subversion-1.8.15/sqlite-amalgamation

再次配置subversion
2.5.2 出现提示:configure: error: subversion requires zlib
解决方案:从下载zlib-1.2.8.tar.gz,并安装到/usr/local/zlib目录。

#cd /usr/local/java/svn/dependPackage #tar -zxvf zlib-1.2.1.tar.gz #cd zlib-1.2.1 #./configure --prefix=/usr/local/zlib #make #make install

2.6 重新配置subversion

#./configure --prefix=/usr/local/subversion --with-apr-util=/usr/local/apr-util --with-apr=/usr/local/apr --with-zlib=/usr/local/zlib #make #make install

三、配置环境变量
通过修改profile文件设置环境变量
#vi /etc/profile

#svn SVN_HOME=/usr/local/subversion export PATH=$PATH:$SVN_HOME/bin # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc #source /etc/profile (刷新设置,避免重启) #echo $PATH(查看设置是否生效)

四、测试安装是否成功
#svnserve --version

svnserve,版本 1.8.19 (r1643975) 编译于 Mar 1 2015,18:34:07 在 i686-pc-linux-gnu Copyright (C) 2014 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 下列版本库后端(FS) 模块可用: * fs_fs : 模块与文本文件(FSFS)版本库一起工作。

出现版本信息则安装subversion成功。

五SVN版本库的建立

A.我选择的目录是 /home/svn/作为SVN版本库的根目录,命令为:

# mkdir /home/svn

B.比如,现在我有一个名为“project”的项目需要用SVN做版本管理,那么我可以在svn根目录下建立一个 /project目录,我最终目的想让项目托管到/project目录下。接下来我需要新建这个目录:/home/svn/project
,命令为:

# mkdir -p /home/svn/project

C.然后需要将/project目录设定为版本库,命令如下:

# svnadmin create /home/svn/project

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。