原先的SVN伺服器是放在windowsPC上的,因領導要求,要在linux伺服器上架設svn,並匯入,因此做此操作。
首先,需要去官網上下載所需包,我下的是1.6.16,目前最高已到1.9,下載地址:
http://subversion.tigris.org/downloads/subversion-1.6.16.tar.gz
http://subversion.tigris.org/downloads/subversion-deps-1.6.16.tar.gz
同時,對一些附帶服務包進行檢測
rpm -q apr apr-util sqlite
如果沒有就yum下
然後安裝: ./configure --prefix=/data/svn --with-openssl=/usr/include/openssl --without-berkeley-db
編輯/etc/ld.so.conf檔案
vi /etc/ld.so.conf
添加下面一行代碼
/usr/local/lib
然後 make clean
make
make install
建立環境變數: vi /etc/profile
SVNPATH=$PATH:/data/subversion/bin
export SVNPATH
查詢是否安裝: svn --version
/data/svn/svnserve --version
接下來建立使用者及目錄
useradd -d /home/svnroot svnroot
passwd svnroot
mkdir /data/repository
chown -R svnroot.svnroot /data/repository
chmod -R 755 /data/repository
cd /data/subversion/bin
建立倉庫目錄
./svnadmin create /data/repository
會發現好幾個檔案夾即可
修改conf下的svnserve.conf,如下: anon-access = none auth-access = write
接下來就可以啟動svn了
svnserve -d -r /data/svn/
可以將其改成啟動服務:
在/etc/rc.d/init.d/目錄下建立名為svn的檔案
並設定許可權為755:chmod 755 /etc/rc.d/init.d/svn
編輯svn檔案:vi /etc/rc.d/init.d/svn #!/bin/bash SVN_HOME=/data/repository if [ ! -f / data/svn/bin/svnserve" ] then echo "svnserver startup: cannot start" exit fi case "$1" in start) echo "Starting svnserve..." /data/svn/bin/svnserve -d -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
匯入linux 之前建好的庫
svnadmin load /data/repository < /data/XXXXX.dump
以後要重啟就是得
/data/svn/bin/svnserve -d -r /data/repository/
要關閉的話
ps -ef|grep svnserve
然後kill掉