建立Linux SVN倉庫文件與安裝及配置
我以獲得無盡的Linux SVN系統知識的奧義,我預知你可能會在Linux SVN安裝中遇到問題FEDORA下,下面就這就來講術Linux SVN系統安裝。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(如果此處不設置為none的話,則連結SVN時會出現錯誤“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(此處設置后方可設置svn訪問讀寫權限的配置文件“/svn/repos/conf/authz”)重點注意:”svn: /svn/repos/conf/svnserve.conf:12: Option expected“發生時,原因是:是因為subversion讀取配置文件svnserve.conf時,無法識別有前置空格的配置,因此前面不能有空格。
step 6
Linux SVN增加用戶密碼,并設置訪問權限
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同步,那樣,就可以直接訪問了信件一個post-commit文件cp post-commit.tmpl post-commitvi /svn/repos/hooks/post-commit寫入以下內容:#!/bin/shexport LANG=en_US.UTF-8svn update /var/www/html --username svnuser --password svnusersvn update /var/www/html --username test --password test并且,把這個文件改為777 首先,先在服務器端/var/www/html checkout以后,每次更新就能夠向/var/www/html添加了chmod 777 post-commitchown apache.apache post-commit
Step 8
運行subversion服務(非必要)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
設置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>
把對應的#號去掉,并修改路徑,改為如上的。
step 10
重啟服務器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
在服務器checkout一次svn checkout svn://127.0.0.1/repos /var/www/html
step 13
OK了可以用別的機器訪問服務器,例如內網IP:192.168.1.226svn://192.168.1.226/repos/svnProjecttest項目的地址http://192.168.1.226/svnProject以后commit到數據倉庫的代碼,和192.168.1.222服務器的/var/www/html里面的同步了另外,可以每個數據倉庫一個項目工程,自己進行相關設置就是了
【編輯推薦】