下面由Centos入門教學欄位介紹centos上建立SVN並將專案同步到PHP專案的系統根目錄的方法,希望對需要的朋友有所幫助!
一、SVN安裝
這裡採用yum安裝方式:
1、rpm -qa subversion / /檢查是否安裝了低版本的SVN
2、yum remove subversion //如果儲存舊版本,卸載舊版SVN
3、開始安裝yum -y install subversion
##安裝好後查看版本svnserve --version 4、建立版本倉庫:mkdir -p /data/svn/project svnadmin create /data/svn/project/
cd /data/svn/project/conf/ //进入配置目录 vim svnserve.conf //编辑配置文件,加入下面五行内容 ``` [general] ### The anon-access and auth-access options control access to the`` ### repository for unauthenticated (a.k.a. anonymous) users and ### authenticated users, respectively. ### Valid values are "write", "read", and "none". ### Setting the value to "none" prohibits both reading and writing; ### "read" allows read-only access, and "write" allows complete ### read/write access to the repository. ### The sample settings below are the defaults and specify that anonymous ### users have read-only access to the repository, while authenticated ### users have read and write access to the repository. # anon-access = read # auth-access = write anon-access = none auth-access = write password-db = passwd authz-db = authz realm = /data/svn/project ```
vim passwd ### This file is an example password file for svnserve. ### Its format is similar to that of svnserve.conf. As shown in the ### example below it contains one section labelled [users]. ### The name and password for each user follow, one account per line. [users] # harry = harryssecret # sally = sallyssecret test = 123456
vim authz [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe [/] test = rw
vi /etc/sysconfig/iptables
``` -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp -dport 3690 -j ACCEPT ```
二、為svn新增鉤子同步檔案到PHP測試環境(這裡PHP專案目錄為/ var/www/html/project/)
1、進入版本庫下的hooks目錄cd /data/svn/project/hooks/
cp post-commit.tmpl post-commit
chmod 0777 post-commit
vi post-commit #mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf export.GB2312 SVN=/usr/bin/svn STATIC_DIR=/var/www/html/project/ ${SVN} update ${STATIC_DIR} --username "test" --password "123456"
svn checkout svn://localhost/project /var/www/html/project/
以上是centos上建置SVN並將專案同步到PHP專案的系統根目錄的方法詳解的詳細內容。更多資訊請關注PHP中文網其他相關文章!