闪入 ... ...
一、下载
下载 SVN 安装包: subversion-1.11.1.tar.gz
下载地址: Download Apache Subversion Sources
下载 APR 安装包 :apr-1.6.5.tar.gz (SVN依赖环境包)
下载 APR-UTIL 安装包 : apr-util-1.6.1.tar.gz
下载地址: Download - The Apache Portable Runtime Project
二、安装
先安装 APR
[root@localhost config]# tar -xvf apr-1.6.5.tar.gz
安装内容...
[root@localhost config]# cd apr-1.6.5
[root@localhost pcre-8.40]# ./configure
检查内容...
[root@localhost pcre-8.40]# make && make install
安装内容...
./configure 结果会出现 cannot remove 'libtoolT': No such file or directory 错误
则解决上面错误:
vim configure
找到关键字 $RM "$cfgfile" 将该行注释掉 再次执行检查 ./configure 命令
如果出现 no acceptable C compiler found in $PATH 类似错误,缺少GCC套件
执行命令 yum install -y gcc
再安装 APR-UTIL
查找到 apr 的安装目录,通过命令 whereis apr 来查找,查找的安装目录为: /usr/local/apr
在执行 ./configure 命令结果会报如下错误:
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
#include <expat.h>
则是缺少 expat库 执行如下命令安装:
yum install expat-devel -y
安装完整命令如下:
[root@localhost config]# tar -xvf apr-util-1.6.1.tar.gz
安装内容...
[root@localhost config]# cd apr-util-1.6.1
[root@localhost pcre-8.40]# ./configure --with-apr=/usr/local/apr
检查内容...
[root@localhost pcre-8.40]# make && make install
安装内容...
再安装 SVN
./configure 检查结果报错误如下:
==================================================================
WARNING: skipping the build of mod_dav_svn
try using --with-apxs
==================================================================
configure: checking sqlite library
checking sqlite amalgamation... no
checking sqlite amalgamation... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite library version (via pkg-config)... no
An appropriate version of sqlite could not be found. We recommmend
3.8.11.1, but require at least 3.8.2.
Please either install a newer sqlite on this system
or
get the sqlite 3.8.11.1 amalgamation from:
https://www.sqlite.org/2015/sqlite-amalgamation-3081101.zip
unpack the archive using unzip and rename the resulting
directory to:
/home/ltscui/software/svn/subversion-1.11.1/sqlite-amalgamation
configure: error: Subversion requires SQLite
解决方法:
1、先下载 sqlite-amalgamation-3260000.zip
下载地址:SQLite Download Page
下载完成后解压缩 unzip sqlite-amalgamation-3260000.zip
并将压缩出来的文件目录 移动到 /home/ltscui/software/svn/subversion-1.11.1目录中
mv -f sqlite-amalgamation-3260000 /home/ltscui/software/svn/subversion-1.11.1
并将名称修改成系统要求的名字 sqlite-amalgamation
mv sqlite-amalgamation-3260000 sqlite-amalgamation
继续执行 ./configure 再次检查
报如下错误 Subversion requires LZ4 >= r129, or use --with-lz4=internal
则按照错误提示 ./configure --with-lz4=internal 再次执行
执行结果报如下错误 configure: error: Subversion requires UTF8PROC
则按照错误提示 ./configure --with-lz4=internal --with-utf8proc=internal 再次执行
至此,没有错误了,执行命令 make && make install
完整的安装过程如下:
[root@localhost config]# tar -xvf subversion-1.11.1.tar.gz
安装内容...
[root@localhost config]# cd subversion-1.11.1
[root@localhost pcre-8.40]# ./configure
检查内容...
[root@localhost pcre-8.40]# make && make install
安装内容...
直至安装结束!
执行命令
svn --version
如果出现SVN版本 则安装成功!
通过命令 whereis svn 查找SVN的默认安装路径 结果为 : /usr/local/bin/svn
最后修改环境变量:
vim /etc/profile
在文件的最后添加如下代码:
export PATH=$PATH:/usr/local/bin/svn
不要忘记执行 source /etc/profile 让环境变量立即生效!
三、配置
1、配置repository路径 建立版本库目录
mkdir /opt/svndata
mkdir /opt/svndata/repository
2、建立svn资源库
svnadmin create /opt/svndata/repository
svn自动在该目录下自动创建必须的配置文件.
3. 修改版本库配置文件
[root@eternity repository]# cd /opt/svndata/repository/conf/
[root@eternity conf]# vim svnserve.conf
svnserve.conf配置详细说明
anon-access 控制非鉴权用户访问版本库的权限。取值范围为"write"、"read"和"none"。即"write"为可读可写,"read"为只读,"none"表示无访问权限。缺省值:read
auth-access 控制鉴权用户访问版本库的权限。取值范围为"write"、"read"和"none"。即"write"为可读可写,"read"为只读,"none"表示无访问权限。缺省值:write
password-db 指定用户名口令文件名。除非指定绝对路径,否则文件位置为相对conf目录的相对路径。缺省值:passwd
authz-db 指定权限配置文件名,通过该文件可以实现以路径为基础的访问控制。除非指定绝对路径,否则文件位置为相对conf目录的相对路径。缺省值:authz
realm 指定版本库的认证域,即在登录时提示的认证域名称。若两个版本库的认证域相同,建议使用相同的用户名口令数据文件。缺省值:一个UUID(Universal Unique IDentifier,全局唯一标示)。
如果在配置文件中指定了如下配置项:realm = test
将在svn客户端提示如下:
[root@test root]# svn list svn://192.168.3.45/test
Authentication realm: <svn://192.168.3.45:3690> test
Password for 'root':
文件里面的以上配置项都是被注释的,请先解开注释,配置结果如下:
anon-access = none # 使非授权用户无法访问
auth-access = write # 使授权用户有写权限
password-db = passwd # 指明密码文件路径
authz-db = authz # 访问控制文件
realm = repos # 认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字。
注意: 其它采用默认配置. 各语句都必须顶格写, 左侧不能留空格, 否则会出错!
4 SVN用户及用户组配置
[root@eternity repository]# cd /opt/svndata/repository/conf/
[root@eternity conf]# vim authz
[root@eternity conf]# vim passwd
authz配置结果如下:
[groups]
admin = test
[/repository]
@admin = rw
* = r
说明:
[/repository]
@admin = rw
* = r
表示 admin组下的用户对 repository 目录及其子目录都拥有读和写的权限
* = r (这个不要忘记,表示其他用户只有读的权限,如果忘记,则没有权限的用户是访问不了的!)
passwd 配置结果如下
[users]
test = test1234@qwer
四、启动SVN服务器
执行svnserve –d –r /opt/svndata/ 启动服务, 以deamon方式运行。
svnserve -d -r /opt/svndata
停止SVN服务器
ps -ef|grep svn
通过以上命令,找到SVN的进程,然后杀死!
五、访问SVN工程
咱们上述中创建了一个 /opt/svndata/repository
其中 repository是资源名称 里面有各配置文件等
端口号: 默认 3690
SVN访问地址: svn://ip地址/repository
可以自己在Windows系统中安装一个SVN的客户端, 输入以上地址,即可以正常访问了!
至此结束,谢谢!!
本人参考了如下博主的内容,在此致谢:
Linux下SVN安装配置以及使用 - ノGHJ - 博客园
闪出 ... ...