CentOS 5.5下搭建部署独立SVN服务器全程详解
SVN服務器有2種運行方式:
1、獨立服務器 (例如:svn://xxx.com/xxx);
2、借助apache?? (例如:http://svn.xxx.com/xxx);
為了不依賴apache,我選擇第一種方式:獨立的svn服務器。
SVN存儲版本數據也有2種方式:
1、bdb;
2、fsfs。
由于bdb方式在服務器中斷時,有可能鎖住數據,所以還是fsfs方式更安全一點,我也選擇這種方式。
具體部署:
1.下載subversion安裝包
| [root@server ~]# cd /usr/local/src |
首先檢測系統有沒有安裝SSL:
| [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 |
1)、編輯/etc/ld.so.conf文件,添加下面一行:
| /usr/local/lib |
| /sbin/ldconfig |
注:ld.so.conf和ldconfig用于維護系統動態鏈接庫。
安裝
| [root@server subversion-1.6.6]#?make && make install |
安裝完成,執行以下命令測試:
| [root@server subversion-1.6.6]#?/usr/local/svn/bin/svnserve --version 版權所有 (C) 2000-2009 CollabNet。 下列版本庫后端(FS) 模塊可用: * fs_fs : 模塊與文本文件(FSFS)版本庫一起工作。 |
為了方便下操作,下面將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? |
在/usr/local/svn/下面新建conf目錄,并在/usr/local/svn/conf內新建passwd.conf和authz.conf文件:
| 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" 其中: |
編輯/etc/rc.d/rc.local文件,加入如下啟動命令:
| /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? |
安裝TortoiseSVN,重啟系統。啟動TortoiseSVN并在地址欄中輸入
| svn://192.168.1.87:9999/repos |
總結
以上是生活随笔為你收集整理的CentOS 5.5下搭建部署独立SVN服务器全程详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 二维数组删除_「leetcode」数组:
- 下一篇: 常见设计规范与 Sketch 源文件下载