以前公司的服務(wù)器都有專人在配置,現(xiàn)在輪到我了。。。雖然不懂LINUX,不懂APACHE MODULE, 不懂SSL。好些東西都是第一次,但不要緊,有專業(yè)的基礎(chǔ)知識(shí)壓底,再加上網(wǎng)絡(luò)這個(gè)巨大寶庫,相信能搞定。
雖然網(wǎng)絡(luò)上有相關(guān)文章,但我試了十幾篇都沒有一篇文章能夠完全配置正確。所以,不懂得原理肯定是搞不定的。能過努力我終于征服svn!以下是我配置svn的完整步驟,現(xiàn)貢獻(xiàn)出來。讓大家少走彎路吧。
OK,開始吧!呵呵呵。對(duì)了,忘說環(huán)境了。linux[centos4.2]
首先準(zhǔn)備好相關(guān)軟件包,
1.subversion-1.3.2.tar.gz /*因?yàn)槲蚁螺d的1.4里面沒找到configure文件所以這里下載1.3.2這個(gè)版本*/
2.httpd-2.0.55.tar.gz /*據(jù)說用2.2有問題,不過我沒試。我用2.0.55*/
3. db-4.4.20.tar.gz /*svn必須的數(shù)據(jù)庫*/
####################################安裝步驟 開始####################################
1.以root用戶登錄系統(tǒng),將subversion-1.3.2.tar.gz/httpd-2.0.55.tar.gz/db-4.4.20.tar.gz
復(fù)制到/usr/local/目錄下.
2.安裝Apache,安裝Berkeley DB,安裝Subversion
命令如下:
[安裝Apache]
#tar -zxvf httpd-2.0.55.tar.gz /*解壓*/
#cd httpd-2.0.54 /*進(jìn)入剛才解壓的目錄*/
#./configure --enable-dav --enable-so --enable-ssl --enable-maintainer-mode -prefix=/usr/local/apache2 --enable-mods-shared=all /*編譯配置,記住參數(shù)一個(gè)不能少.ssl是為以后用安全鏈加的module,dav模塊就不用我說了,然后是共享所有模塊*/
#make /*編譯*/
#make install /*安裝*/
[安裝Berkeley DB]
#tar -zxvf db-4.4.20.NC.tar.gz /*解壓*/
#cd db-4.4.20.NC/build_unix/ /*進(jìn)入目錄*/
#../dist/configure --prefix=/usr/local/bdb /*編譯配置,指定安裝目錄*/
#make /*編譯*/
#make install /*安裝*/
[安裝Subversion]/*下面就不用寫注釋了,相信看了上面兩段應(yīng)該看得懂了*/
#tar -zxvf subversion-1.3.2.tar.gz
#cd subversion-1.3.2
#./configure --with-berkeley-db=/usr/local/bdb --with-apxs=/usr/local/apache2/bin/apxs
#make
#make install
3.檢查Subversion是否安裝成功
#svnadmin --version /*如果成功你會(huì)看見相應(yīng)的版本號(hào),和支持的服務(wù)*/
4.創(chuàng)建軟件倉庫
#mkdir -p /opt/svn/repos /*-p 意思是如果沒有目錄則創(chuàng)建*/
#svnadmin create --fs-type fsfs /opt/svn/repos /*參數(shù) --fs-type fsfs 是指定存儲(chǔ)類型*/
5.創(chuàng)建項(xiàng)目臨時(shí)目錄,建議目錄結(jié)構(gòu)如下:
/opt/svn/tmp/project_xxx/trunk
/opt/svn/tmp/project_xxx/tags
/opt/svn/tmp/project_xxx/branches
/**********************************************************
然后將項(xiàng)目文件復(fù)制到trunk下,如果是從CVS轉(zhuǎn)移過來的項(xiàng)目,用下面命令清理目錄
#find projectname/ -name CVS -exec rm -rf {} \;
**********************************************************/
6.導(dǎo)入source
#svn import -m "initial import" /opt/svn/tmp file:///opt/svn/repos
/***********************************************************
-m 后面跟的是操作注釋 /opt/sv/tmp是項(xiàng)目文件位置 file:///opt/svn/repos是創(chuàng)建的軟件倉庫
***********************************************************/
7.檢查是否倒入成功
#svn list --verbose file:///opt/svn/repos/
/***********************************************************
如果成功你看到到你倒入的項(xiàng)目列表,按我的操作步驟應(yīng)該不會(huì)有錯(cuò)
***********************************************************/
8.給倉庫授權(quán)
#chown -R apache.apache /opt/svn/repos
#chmod 770 /opt/svn/repos
#chmod -R g+w /opt/svn/repos
9.與apache整合
用apache工具創(chuàng)建用戶文件
#htpasswd ?c /opt/svn/pwd admin ##密碼為:123456
設(shè)置密碼文件權(quán)限
#chown a+r pwd
創(chuàng)建訪問權(quán)限文件assesspolicy內(nèi)容
[groups]
developers =admin
[repos:/]
@developers = rw
ssl安全認(rèn)證:
找到openssl.cnf目錄執(zhí)行
#openssl genrsa -des3 -out my-server.key 1024
然后輸入密碼:xxxxxx
生成證書執(zhí)行:
#openssl req -new -key my-server.key -x509 -out my-server.crt -config openssl.cnf
在 Apache 的 conf 目錄下新建一個(gè) sslfile 目錄,將 my-server.key 和 my-server.crt 文件都移動(dòng)到 sslfile 目錄里面
修改apache的httpd.conf文件
User apache
group apache
打開sslmod前的#號(hào)
LoadModule ssl_module modules/mod_ssl.so
在最后加入如下內(nèi)容
SSLMutex default
SSLRandomSeed startup builtin
SSLSessionCache none
ErrorLog logs/SSL.log
LogLevel info
<VirtualHost svntest.ut.cn.ibm.com:443>
SSLEngine On
SSLCertificateFile conf/ssl/my-server.crt
SSLCertificateKeyFile conf/ssl/my-server.key
</VirtualHost>
<Location /repos>
DAV svn
SVNPath /opt/svn/repos
AuthType Basic
AuthName "svn repos"
AuthUserFile /opt/svn/pwd
AuthzSVNAccessFile /opt/svn/accesspolicy
require valid-user
SSLRequireSSL ##加了這句就只能用https模式,不能用http模式了
</Location>
OK,到些結(jié)束,啟動(dòng)apache吧,別忘了要輸入你創(chuàng)建證書時(shí)的密碼!呵呵
####################################安裝步驟 結(jié)束####################################