国产亚洲av在线,国产高清,欧美激情,国产精品久久久久7777,国产精品人成在线观看,国产精品永久免费视频

IT之道-艾銻知道

您當(dāng)前位置: 主頁(yè) > 資訊動(dòng)態(tài) > 艾銻分享 >

服務(wù)器維護(hù)Linux下Apache完美集成SVN(Yum安裝版)


2020-05-22 20:30 作者:admin
服務(wù)器維護(hù)Linux下Apache完美集成SVN(Yum安裝版)
 
如何做好服務(wù)器維護(hù)?北京艾銻無(wú)限科技與你談?wù)処T人員必須知道的服務(wù)器維護(hù)信息
 
服務(wù)器維護(hù)小知識(shí)svn(subversion)是目前最流行的開源版本控制工具。使用apache集成svn比svn服務(wù)獨(dú)立運(yùn)行好處多多,最大的優(yōu)點(diǎn)是使svn使用http80端口檢出,防火墻可以少開放一個(gè)端口,減少服務(wù)器安全風(fēng)險(xiǎn)和降低維護(hù)成本。下面在CentOS6.0系統(tǒng)下通過(guò)yum安裝的方式,介紹在linux下apache完美集成svn。
服務(wù)器維護(hù)小知識(shí)一、規(guī)劃目錄: 網(wǎng)站地址    
網(wǎng)站根目錄   /storage/web/aiezu  
SVN地址    
SVN數(shù)據(jù)倉(cāng)庫(kù)目錄   /storage/svn/aiezu  
服務(wù)器維護(hù)小知識(shí)二、安裝apache:
安裝apache包:
yum -y install httpd #必須
yum -y install mysql mysql-server php php-mbstring php-gd #可選安裝
創(chuàng)建站點(diǎn)根目錄:
mkdir -p /storage/web/aiezu
建立基于域名的虛擬主機(jī),vim /etc/httpd/conf.d/www.aiezu.com.conf添加以下內(nèi)容:
NameVirtualHost *:80
<Directory "/storage/web/aiezu">
    Options -Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<VirtualHost *:80>
    ServerAdmin admin@aiezu.com
    DocumentRoot /storage/web/aiezu
    ServerName
    ErrorLog logs/www.aiezu.com-error_log
    CustomLog logs/www.aiezu.com-access_log common
</VirtualHost>
啟動(dòng)apache和mysql服務(wù):
service mysqld start
service httpd start
服務(wù)器維護(hù)小知識(shí)三、安裝和配置apache SVN模塊:
安裝apache服務(wù)SVN模塊mod_dav_svn:
yum -y install mod_dav_svn
#會(huì)自動(dòng)安裝mod_dav_svn及其依賴包:mod_dav_svn-1.6.11-9,neon-0.29.3-2,pakchois-0.4-3.2,subversion-1.6.11-9
建立svn數(shù)據(jù)倉(cāng)庫(kù):
mkdir -p /storage/svn/aiezu
svnadmin create /storage/svn/aiezu
建立svn帳號(hào)并設(shè)置密碼:
htpasswd -c /storage/svn/aiezu/conf/passwd svnuser
分配svn帳號(hào)權(quán)限:
[aiezu:/]
svnuser = rw #設(shè)置aiezu數(shù)據(jù)倉(cāng)庫(kù)svnuser用戶有讀寫權(quán)限
配置svn數(shù)據(jù)倉(cāng)庫(kù)文件系統(tǒng)權(quán)限:
chown -R apache.apache /storage/svn/aiezu
chcon -R -t httpd_sys_content_t /storage/svn/aiezu #selinux權(quán)限
配置svn數(shù)據(jù)倉(cāng)庫(kù)checkout地址:
vim /etc/httpd/conf.d/subversion.conf,添加如下內(nèi)容:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
    DAV svn
    SVNListParentPath on
    SVNParentPath /storage/svn
    AuthType Basic
    AuthName "Authorization"
    AuthUserFile /storage/svn/aiezu/conf/passwd
    AuthzSVNAccessFile /storage/svn/aiezu/conf/authz
    Require valid-user
</Location>
重新加載apache配置:
service httpd reload
四、配置svn post-commit鉤子:
當(dāng)我們希望在像svn數(shù)據(jù)倉(cāng)庫(kù)提交新版本時(shí),自動(dòng)將更新同步到我們的網(wǎng)站,這時(shí)我們可以使用svn鉤子,svn鉤子必須放在svn數(shù)據(jù)倉(cāng)庫(kù)的hooks目錄下,這里我們要添加是svn commit(svn提交)鉤子post-commit:
vim /storage/svn/aiezu/hooks/post-commit,添加如下內(nèi)容:
#!/bin/bash
export LANG="zh_CN.UTF-8"
export LANG="zh_CN.UTF-8"
export LC_CTYPE="zh_CN.UTF-8"
svn update /storage/web/aiezu/ --username=svnuser --password=svnpass --non-interactive
授予可執(zhí)行權(quán)限:
chmod a+x /storage/svn/aiezu/hooks/post-commit
檢出版本庫(kù):
svn checkout /storage/web/aiezu/
服務(wù)器維護(hù)小知識(shí)五、常見錯(cuò)誤及其解答:
1、svn checkout(svn檢出)時(shí)錯(cuò)誤一:
The URI does not contain the name of a repository. [403, #190001]
解答:這是由于subversion.conf文件中SVNParentPath路徑設(shè)置不正確引起的,SVNParentPath路徑必須為svnadmin create生成數(shù)據(jù)倉(cāng)庫(kù)路勁的父目錄,如上面建立數(shù)據(jù)倉(cāng)庫(kù)的命令為svnadmin create /storage/svn/aiezu,則SVNParentPath為/storage/svn。
2、svn checkout時(shí)錯(cuò)誤二:
Unable to connect to a repository at URL 'http://www.aiezu.com/svn'
Access to 'http://www.aiezu.com/svn' forbidden
解答:svn數(shù)據(jù)倉(cāng)庫(kù)的SVN URL地址不正確,當(dāng)subversion.conf中設(shè)置SVNListParentPath on時(shí),SVN URL地址為SVNParentPath下的具體數(shù)據(jù)倉(cāng)庫(kù),而不是SVNParentPath指定的目錄。
3、svn checkout時(shí)錯(cuò)誤三:
Unable to connect to a repository at URL '
Could not open the requested SVN filesystem
解答:svn數(shù)據(jù)倉(cāng)庫(kù)的SVN URL地址不正確,在SVNParentPath下找不到SVN URL指定的數(shù)據(jù)倉(cāng)庫(kù)。
4、svn提交(svn commit)時(shí)出現(xiàn)如下錯(cuò)誤:
post-commit hook failed (exit code 1) with output:
svn: Can't open file '/storage/web/aiezu/.svn/lock': Permission denied
解答:這是svn提交調(diào)用的post-commit鉤子沒有權(quán)限寫/storage/web/aiezu/.svn目錄引起的。apache集成的svn是使用apache用戶調(diào)用post-commit鉤子的,所以必須保證apache用戶對(duì).svn有寫權(quán)限, 執(zhí)行chown -R apache.apache /storage/web/aiezu就可以了。
 
以上內(nèi)容為艾銻無(wú)限為大家提供的服務(wù)器維護(hù)小知識(shí),更多內(nèi)容請(qǐng)關(guān)注:www.bjitwx.com。

相關(guān)文章

IT外包服務(wù)
二維碼 關(guān)閉