#檢查是否安裝了低版本的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