#检查是否安装了低版本的SVN
rpm -qa subversion
#卸载/删除原有安装
yum remove subversion
rm -rf /usr/local/svn
apr apr-util的作用
http://blog.sina.com.cn/s/blog_4edd2a190100una1.html
安装apr与apr-util软件
tar -xvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
tar -xvf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make && make install
tar -xvf subversion-1.9.2.tar.gz
cd subversion-1.9.2
./configure --prefix=/usr/local/svn/ --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
报错信息:
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.7.15.1, but require at least 3.7.12.
Please either install a newer sqlite on this system
or
get the sqlite 3.7.15.1 amalgamation from:
http://www.sqlite.org/sqlite-amalgamation-3071501.zip
unpack the archive using unzip and rename the resulting
directory to:
/opt/subversion-1.9.2/sqlite-amalgamation
configure: error: Subversion requires SQLite
下载安装:sqlite-amalgamation-3071501.zip
unzip sqlite-amalgamation-3071501.zip
mv sqlite-amalgamation-3071501 /opt/subversion-1.9.2/sqlite-amalgamation
./configure --prefix=/usr/local/svn/ --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
报错信息:
checking zlib.h usability... no
checking zlib.h presence... no
checking for zlib.h... no
configure: error: subversion requires zlib
安装zlib-1.2.8.tar.gz
tar -xvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib/
make && make install
执行:
./configure --prefix=/usr/local/svn/ --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-zlib=/usr/local/zlib
make && make install(时间稍长)
检查版本是否正确:
/usr/local/svn/bin/svnserve --version
添加环境变量
vim /etc/profile
export SVN_HOME=/usr/local/svn
PATH=$SVN_HOME/bin:$PATH
:wq
重新加载环境变量
source /etc/profile
创建版本库
1.建立svn版本库文件夹(可建立多个,新建库后以下各项都需重新配置。注意区别安装目录与版本库目录,以下讲的都是版本库目录)
mkdir -p /var/www/html/svn/repos1
chmod -R 755 /var/www/html/svn
2.建立svn版本库(与相应目录文件夹对应)执行以下命令后自动生成配置文件,文件夹下发现包含了conf, db,format,hooks, locks, README.txt等文件,说明一个SVN库已经建立
svnadmin create /var/www/html/svn/repos1
[root@localhost repos1]# ll
总用量 24
drwxr-xr-x. 2 root root 4096 10月 14 00:12 conf
drwxr-sr-x. 6 root root 4096 10月 14 00:12 db
-r--r--r--. 1 root root 2 10月 14 00:12 format
drwxr-xr-x. 2 root root 4096 10月 14 00:12 hooks
drwxr-xr-x. 2 root root 4096 10月 14 00:12 locks
-rw-r--r--. 1 root root 246 10月 14 00:12 README.txt
[root@localhost repos1]#
3.修改配置文件,生成密码文件,配置用户信息,可添加多个“用户=密码”(注意:配置文件的行前#和空格都必须删除,否则无法生效)
vim /var/www/html/svn/repos1/conf/passwd
[users]
rzx = 123456
test = 123456
:wq
4.配置权限认证文件
vim /var/www/html/svn/repos1/conf/authz
[groups]
# harry_and_sally = harry,sally
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
rzx = rw
test = r
* =
[/svn/repos1]
test = rw
* =
:wq
5.修改主配置文件
vim /var/www/html/svn/repos1/conf/svnserve.conf
[general]
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz
# realm = My First Repository
realm = /var/www/html/svn/repos1
:wq
6.启动svn
svnserve -d -r /var/www/html/svn/repos1
多仓库配置运行
如果一台服务器上同时启动多个版本管理,那么启动路径必须是所有项目仓库的根路径
svnserve -d -r /var/www/html/svn
7.客户端访问测试
svn checkout svn://192.168.5.101/repos1
输入用户名密码登录下载。
简写:svn co
8.停止svn服务
[root@localhost /]# ps -ef | grep svn
root 56793 1 0 12:49 ? 00:00:00 svnserve -d -r /var/www/html/svn/
[root@localhost /]#kill -9 56793