Centos下SVN安裝以及同步到web目錄

來源:互聯網
上載者:User

標籤:centos svn 同步

  • 一、安裝

Yum –y install subversion

建立版本庫目錄

Mkdir –p /mnt/svn

建立svn庫

Svnadmin create /mnt/svn/delieato

啟動svn:

Svnserve –d –r /mnt/svn

 

  • 二、配置庫

針對每一個庫,其conf目錄下有三個設定檔(authz、passwd、svnserve.conf)

1、  authz,設定使用者組和使用者權限

[group]

smsyun = ddl,shl //建立一個smsyun的組,並制定兩個使用者ddl和shl

[/]   //訂製目錄下的許可權 /代表目錄下的所有資源

@smsyun=rw   //smsyun使用者組許可權為讀寫

*=r           //其他使用者只有讀許可權

2、  passwd

[users]

Dd1=123  //使用者名稱=密碼

Dd2=123

3、  svnserve.conf,把以下四行前面的#去掉

# anon-access = read   //去掉#並將read改為none,不允許匿名使用者存取
# auth-access = write    //通過驗證的使用者可以讀寫
# password-db = passwd //使用者儲存檔案
# realm = smsyun      //倉庫名稱

注意:修改的檔案前面不能有空格,否則啟動svn server出錯

4、  設開機自動啟動

Vi /etc/rc.local

在touch /var/lock/subsys/local下面添加一行

Svnserve –d –r /usr/local/svnRepo/first

  • 三、同步到web目錄

1、設定web目錄為 /var/yii

2、Checkout一份到web目錄

Svn co svn://localhost/smsyun /var/yii

3、建立同步指令碼

在/mnt/delieato/hooks目錄下建立post-commit檔案

在檔案中添加:

#!/bin/sh

REPOS="$1"

REV="$2"

exportLANG=en_US.UTF-8

SVN=/usr/bin/svn

WEB=/var/yii

$SVN update $WEB --username dd1 --password 123--no-auth-cache

然後給post-commit指令碼執行許可權

Chmod +x post-commit

最後操作是關閉服務然後再開啟

關閉:killall svnserve

開啟:svnserve –d –r /mnt/delieato/svn


Centos下SVN安裝以及同步到web目錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.