站長資訊網
        最全最豐富的資訊網站

        centos上搭建SVN并將項目同步到PHP項目的系統根目錄的方法詳解

        下面由Centos入門教程欄目給大家介紹centos上搭建SVN并將項目同步到PHP項目的系統根目錄的方法,希望對需要的朋友有所幫助!

        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/

        查看/data/svn/project 文件夾可以發現有conf, db,format,hooks, locks, README.txt等文件,說明一個SVN庫已經建立。

        5、配置權限

           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 ```

        6、編輯密碼文件,添加用戶test 密碼123456:

        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

        7、編輯權限文件,添加用戶test權限

        vim authz [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe [/] test = rw

        8、配置防火墻

        vi /etc/sysconfig/iptables

        加入:

        ``` -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp -dport 3690 -j ACCEPT ```

        重啟防火墻:service iptables restart

        9、啟動SVN:svnserve -d -r /data/svn/

        查看端口狀態:netstat -ln | grep 3690

        二、給svn添加鉤子同步文件到PHP測試環境 (這里PHP項目目錄為/var/www/html/project/)

        1、進入版本庫下的hooks目錄

        cd /data/svn/project/hooks/

        2、將post-commit.tmpl 復制為 post-commit

        cp post-commit.tmpl post-commit

        3、給post-commit可執行權限

        chmod 0777 post-commit

        4、編輯post-commit,注釋掉#mailer.py……這一行,添加下面四行,編碼問題,如果錯誤的話可能導致無法同步 成功,可選的有en_US.UTF-8、zh_CN.UTF-8、zh_CN.GB2312,可以一個個試。

        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"

        5、在提交之前,進行一次checkout代碼到指定目錄

        svn checkout svn://localhost/project /var/www/html/project/

        注:如果一直出錯:“由于連接方在一段時間后沒有正確答復或連接的主機沒有反應,連接嘗試失敗”;可能是網絡端口開放設置問題,因為端口問題導致無法成功checkout項目,可以進入阿里云看看看看有沒有允許3690的端口,如果沒有3690的端口就添加一條安全組規則。

        贊(0)
        分享到: 更多 (0)
        網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號
        主站蜘蛛池模板: 国产精品久久影院| 99精品在线免费| 亚洲精品黄色视频在线观看免费资源 | 精品伦精品一区二区三区视频| 国产精品嫩草影院一二三区| 麻豆国产精品VA在线观看不卡| 中文字幕一区二区三区日韩精品| 精品无码国产一区二区三区51安| 国产精品麻豆高清在线观看| 国产午夜精品一区二区三区小说| 在线观看自拍少妇精品| 999精品视频| 国内精品久久久久久麻豆| 亚洲AV无码久久精品成人| 99精品视频在线观看| 国产乱人伦精品一区二区在线观看| 亚洲综合国产精品第一页 | 最新国产精品拍自在线观看| 久久成人国产精品| jizz国产精品| 亚洲精品国精品久久99热一| 久久国产成人精品麻豆| 久久99精品国产麻豆不卡| 欧美精品v国产精品v日韩精品| 热久久国产精品| 中文字幕乱码中文乱码51精品| 高清免费久久午夜精品| 精品精品国产国产| 国产乱子伦精品无码码专区| 国产精品高清在线观看| 小辣椒福利视频精品导航| 亚洲精品欧美日韩| 一本一本久久A久久综合精品 | 国产精品热久久无码av| 久久精品亚洲精品国产色婷| 国产综合精品蜜芽| 国产精品久线在线观看| 久久九九久精品国产免费直播| 国产精品久久久亚洲| 四虎成人精品国产永久免费无码| 国产精品久久网|