第一,根據(jù)BLFS BOOK安裝好Subversion-1.1.4,配置選項(xiàng)用了
--prefix=/usr --with-apr=/usr --with-apr-util=/usr --with-apxs=/usr/sbin/apxs --with-ssl
編譯安裝很順利,但發(fā)現(xiàn)install后沒(méi)有所說(shuō)的~/.subversion/config and /etc/subversion/config
什么的
第二,配制本地訪問(wèn)的svn
完全按照BOOK來(lái)的,啟動(dòng)也是利用xinetd啟動(dòng)
1,建立svn組何用戶,建立svntest組,把svn用戶置入svstest組
groupadd -g 56 svn &&
useradd -c "SVN Owner" -d /home/svn -m -g svn -s /bin/false -u 56 svn
groupadd -g 57 svntest &&
usermod -G svntest svn
設(shè)置用svn何svnserve的時(shí)候的mask為022
mv /usr/bin/svn /usr/bin/svn.orig &&
mv /usr/bin/svnserve /usr/bin/svnserve.orig &&
cat >> /usr/bin/svn << "EOF"
#!/bin/sh
umask 002
/usr/bin/svn.orig "$@"
EOF
cat >> /usr/bin/svnserve << "EOF"
#!/bin/sh
umask 002
/usr/bin/svnserve.orig "$@"
EOF
chmod 0755 /usr/bin/svn{,serve}
2,創(chuàng)建倉(cāng)庫(kù)
install -d -m0755 /srv &&
install -d -m0755 -o svn -g svn /srv/svn/repositories &&
svnadmin create --fs-type fsfs /srv/svn/repositories/svntest
然后我在我的/usr/local下通過(guò)mkdir建立一下目錄結(jié)構(gòu)
svntest/ # The name of the repository
trunk/ # Contains the existing source tree
BOOK/
bootscripts/
edguide/
patches/
scripts/
branches/ # Needed for additional branches
tags/ # Needed for tagging release points
再初始畫(huà)導(dǎo)入
svn import -m "Ininial import." /usr/local/svntest file:///srv/svn/repositories/svntest
再把倉(cāng)庫(kù)的屬主信息改成svn:svntest的
chown -R svn:svntest /srv/svn/repositories/svntest &&
chmod -R g+w /srv/svn/repositories/svntest &&
chmod g+s /srv/svn/repositories/svntest/db &&
usermod -G svn,svntest,[insert existing groups] [username]
其中還可以添加其他沒(méi)有特權(quán)的但也想讓其分享倉(cāng)庫(kù)的用戶和組,
然后就可以通過(guò)以下命令查看svn的倉(cāng)庫(kù)了
svnlook tree /srv/svn/repositories/svntest/
3,配制服務(wù)器
先備份該倉(cāng)庫(kù)的服務(wù)器配置文件,在相應(yīng)conf目錄下
cp /srv/svn/repositories/svntest/conf/svnserve.conf /srv/svn/repositories/svntest/conf/svnserve.conf.default
再建立svnserve.conf
cat > /srv/svn/repositories/svntest/conf/svnserve.conf << "EOF"
[general]
anon-access = read
auth-access = write
EOF
4,利用xinetd啟動(dòng)svn服務(wù)器
只要在/etc/xinetd.d/下建立svn
cat >> /etc/xinetd.d/svn << "EOF"
# Begin /etc/xinetd.d/svn
service svn
{
port = 3690
socket_type = stream
protocol = tcp
wait = no
user = svn
server = /usr/bin/svnserve
server_args = -i -r /srv/svn/repositories
}
# End /etc/xinetd.d/svn
EOF
再重啟xinetd服務(wù)
/etc/rc.d/init.d/xinetd restart
另外我拷貝blfs啟動(dòng)腳本中的svn到init.d目錄下
此時(shí),隨便到哪個(gè)目錄下,運(yùn)行
svn checkout file://localhost/srv/svn/repositories/svntest
就可以完全checkout 撿出svntest了
配置能用http訪問(wèn),及與apache整合
1,檢查Httpd.conf中已經(jīng)有了
LoadModule dav_svn_module lib/apache/mod_dav_svn.so
LoadModule authz_svn_module lib/apache/mod_authz_svn.so
2,匿名訪問(wèn)的配置,同樣是在Httpd.conf中添加
<Location /svn>
DAV svn
SVNPath /srv/svn/repositories/svntest
</Location>
信息,這樣就可以通過(guò)http://192.168.0.3/svn/訪問(wèn),測(cè)試通過(guò),:)
另外當(dāng)有多個(gè)倉(cāng)庫(kù)時(shí),httpd.conf中可以通過(guò)設(shè)置 SVNParentPath 值設(shè)置
3,通過(guò)htpasswd的方式來(lái)進(jìn)行用戶訪問(wèn)的驗(yàn)證,添加兩個(gè)用戶,放在/etc/svn-auth-file 文件中
htpasswd -c /etc/svn-auth-file harry
htpasswd /etc/svn-auth-file sally
再在剛才的httpd.conf的Location信息中添加認(rèn)證信息,如下
<Location /svn>
DAV svn
SVNPath /srv/svn/repositories/svntest
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /etc/svn-auth-file
Require valid-user
</Location>
測(cè)試成功,:)
另外,我通過(guò)終端里
svn checkout http://localhost/svn
先輸入root的命令,在輸入用戶名密碼,也可以checkout,這里為什么要輸入root的密碼了?我還是很多不懂啊
http://www.360doc.com/showWeb/0/0/200256.aspx文章提到了倉(cāng)庫(kù)中conf目錄下的authz和passwd文件的詳細(xì)含義和用法,很不錯(cuò),只是我不怎么好試驗(yàn)
06-11-05:
想試驗(yàn)讓我的DAV svn通過(guò)學(xué)校的ldap服務(wù)器認(rèn)證,檢查了一下我的配置和club的配置,我的沒(méi)有Load進(jìn)來(lái)mod_auth_ldap.so,我檢查我的沒(méi)有安裝這個(gè)模塊,
通過(guò)scp從club上拷貝回來(lái),但還是不行,提示找不到libexpat.so.1,看來(lái)要讓apache支持得重新編譯apache才行。
查看了apache2.2的中文手冊(cè),原來(lái)此模塊必須在2.1后的版本才支持,我的才2.0.54,差那么一點(diǎn)點(diǎn)哦