建立Linux SVN倉庫文件與安裝及配置
我以獲得無盡的Linux SVN系統(tǒng)知識的奧義,我預(yù)知你可能會(huì)在Linux SVN安裝中遇到問題FEDORA下,下面就這就來講術(shù)Linux SVN系統(tǒng)安裝。Linux SVN的安裝以及配置
step 1
安裝subversion yum install subversion
step 2
安裝apache的Linux SVN模塊yum install mod_dav_svn
step 3
建立Linux SVN倉庫文件mkdir /svn
step 4
建立Linux SVN庫并修改/svn用戶組和用戶svnadmin create /svn/repos/chown -R apache.apache /svn
step 5
編輯/svn/repos/conf/svnserve.confvi /svn/repos/conf/svnserve.conf
5-1.把#anon-access = read #auth-access = write改為anon-access = none(如果此處不設(shè)置為none的話,則連結(jié)SVN時(shí)會(huì)出現(xiàn)錯(cuò)誤“Read access denied for root of edit”)auth-access = write
5-2.把#password-db = passwd改為password-db = passwd
5-3.把#authz-db = authz改為authz-db = authz(此處設(shè)置后方可設(shè)置svn訪問讀寫權(quán)限的配置文件“/svn/repos/conf/authz”)重點(diǎn)注意:”svn: /svn/repos/conf/svnserve.conf:12: Option expected“發(fā)生時(shí),原因是:是因?yàn)閟ubversion讀取配置文件svnserve.conf時(shí),無法識別有前置空格的配置,因此前面不能有空格。
step 6
Linux SVN增加用戶密碼,并設(shè)置訪問權(quán)限
6-1.vi /svn/repos/conf/passwd如[users]#user = passwordsvnuser = svnusertest = test
6-2.vi /svn/repos/conf/authz追加下記文字[/]svnuser = rw[/]test = r
step 7
把每次提交的文件都和/var/www/html同步,那樣,就可以直接訪問了信件一個(gè)post-commit文件cp post-commit.tmpl post-commitvi /svn/repos/hooks/post-commit寫入以下內(nèi)容:#!/bin/shexport LANG=en_US.UTF-8svn update /var/www/html --username svnuser --password svnusersvn update /var/www/html --username test --password test并且,把這個(gè)文件改為777 首先,先在服務(wù)器端/var/www/html checkout以后,每次更新就能夠向/var/www/html添加了chmod 777 post-commitchown apache.apache post-commit
Step 8
運(yùn)行subversion服務(wù)(非必要)vi /etc/rc.local加入如下命令
#!/bin/sh
#
# This script. will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style. init stuff.
touch /var/lock/subsys/localsvnserve -d -r /svn/repos
step 9
設(shè)置apache的Linux SVN配置文件vi /etc/httpd/conf.d/subversion.conf<Location /repos>DAV svn SVNParentPath /svn
# # Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
# AuthType Basic
# AuthName "Authorization Realm"
# AuthUserFile /path/to/passwdfile
# Require valid-user
# </LimitExcept></Location>
把對應(yīng)的#號去掉,并修改路徑,改為如上的。
step 10
重啟服務(wù)器svnserve --daemon --root=/svn --listen-port=3690
step 11
建立project svnProjectmkdir /tmp/svnProjectmkdir /svn/repos/svnProjectsvn import /tmp/svnProject file:///svn/repos/svnProject -m "initial import"
step 12
在服務(wù)器checkout一次svn checkout svn://127.0.0.1/repos /var/www/html
step 13
OK了可以用別的機(jī)器訪問服務(wù)器,例如內(nèi)網(wǎng)IP:192.168.1.226svn://192.168.1.226/repos/svnProjecttest項(xiàng)目的地址http://192.168.1.226/svnProject以后commit到數(shù)據(jù)倉庫的代碼,和192.168.1.222服務(wù)器的/var/www/html里面的同步了另外,可以每個(gè)數(shù)據(jù)倉庫一個(gè)項(xiàng)目工程,自己進(jìn)行相關(guān)設(shè)置就是了
【編輯推薦】