SVN服务器有2种运行方式:
一、独立服务器 (例如:svn://xxx.com/xxx);
二、借助apache (例如:http://svn.xxx.com/xxx);
为了避免依赖apache,我选择第一种方式:独立的svn服务器。
SVN存储版本数据也有2种方式:
一、bdb;
二、fsfs。
因为bdb方式在服务器中断时,有可能锁住数据,因此仍是fsfs方式更安全一点,我也选择这种方式。
具体部署:
1.下载subversion安装包 html
[root@server ~]# cd /usr/local/src |
[root@server subversion-1.6.6]# find / -name opensslv.h [root@server subversion-1.6.6]# |
[root@server subversion-1.6.6]# yum install openssl [root@server subversion-1.6.6]# yum install openssl-devel |
[root@server subversion-1.6.6]# find / -name opensslv.h /usr/include/openssl/opensslv.h [root@server subversion-1.6.6]# ./configure --prefix=/usr/local/svn --with-openssl=/usr/include/openssl --without-berkeley-db |
configure: WARNING: unrecognized options: --with-openssl configure: Configuring Subversion 1.6.6 configure: creating config.nice checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/usr/local/src/subversion-1.6.6': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. |
[root@server subversion-1.6.6]# yum -y install gcc [root@server subversion-1.6.6]# ./configure --prefix=/usr/local/svn --with-openssl=/usr/include/openssl --without-berkeley-db |
configure: WARNING: we have configured without BDB filesystem support You don't seem to have Berkeley DB version 4.0.14 or newer installed and linked to APR-UTIL. We have created Makefiles which will build without the Berkeley DB back-end; your repositories will use FSFS as the default back-end. You can find the latest version of Berkeley DB here: http://www.sleepycat.com/download/index.shtml |
error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory |
/usr/local/lib |
/sbin/ldconfig |
注:ld.so.conf和ldconfig用于维护系统动态连接库。
安装
后端
[root@server subversion-1.6.6]# make && make install |
安装完成,执行如下命令测试:
centos
[root@server subversion-1.6.6]# /usr/local/svn/bin/svnserve --version 版权全部 (C) 2000-2009 CollabNet。 下列版本库后端(FS) 模块可用: 服务器 * fs_fs : 模块与文本文件(FSFS)版本库一块儿工做。svn |
为了方便下操做,下面将SVN的BIN添加到PATH,编辑/etc/profile,添加:
测试
PATH=/usr/local/svn/bin:$PATH |
source /etc/profile |
[root@server ~]# mkdir -p /home/svndata/repos #创建版本库 |
[general] anon-access = none auth-access = write password-db = /usr/local/svn/conf/passwd.conf authz-db = /usr/local/svn/conf/authz.conf realm = repos |
mkdir conf |
[root@server ~]# useradd wll |
[users] wll = 123456 |
[groups] 注意: |
[root@server ~]# useradd svn [root@server ~]# passwd svn |
[root@server ~]# chown -R svn:svn /home/svndata |
[root@server ~]# su - svn -c "svnserve -d --listen-port 9999 -r /home/svndata" 其中: |
/usr/local/svn/bin/svnserve -d --listen-port 9999 -r /home/svndata |
killall svnserve |
#!/bin/bash # build this file in /etc/rc.d/init.d/svn # chmod 755 /etc/rc.d/init.d/svn # centos下能够用以下命令管理svn: service svn start(restart/stop) SVN_HOME=/home/svndata if [ ! -f "/usr/local/svn/bin/svnserve" ] then echo "svnserver startup: cannot start" exit fi case "$1" in start) echo "Starting svnserve..." /usr/local/svn/bin/svnserve -d --listen-port 9999 -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 |
svn://192.168.1.87:9999/repos |