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 |