linux下配置raid+svn

來源:互聯網
上載者:User

一、raid
二、svn
  1.subversion-1.6.12.tar.gz 
  2.httpd-2.2.16.tar.gz     
  3. db-5.0.26.NC        /*svn必須的資料庫*/
  ####################################安裝步驟 開始####################################
  1.以root使用者登入系統,將以上軟體複製到/usr/local/目錄下.
  2.安裝Apache,安裝Berkeley DB,安裝Subversion
  命令如下:
  [安裝Apache]
  #tar -zxvf httpd-2.0.55.tar.gz    /*解壓*/
  #cd httpd-2.0.54                  /*進入剛才解壓的目錄*/
  #./configure  --enable-dav --enable-so  --enable-ssl --enable-maintainer-mode -prefix=/usr/local/apache2  --enable-mods-shared=all /*編譯配置,記住參數一個不能少.ssl是

  為以後用安全鏈加的module,dav模組就不用我說了,然後是共用所有模組*/
  #make                             /*編譯*/
  #make install                     /*安裝*/
  [安裝Berkeley DB]
  #tar -zxvf db-4.4.20.NC.tar.gz   /*解壓*/
  #cd db-4.4.20.NC/build_unix/     /*進入目錄*/
  #../dist/configure --prefix=/usr/local/bdb  /*編譯配置,指定安裝目錄*/
  #make                            /*編譯*/
  #make install                    /*安裝*/

  這裡要安裝gcc和openssh以及openssh-devel
  [安裝Subversion]/*下面就不用寫注釋了,相信看了上面兩段應該看得懂了*/
  #tar -zxvf subversion-1.3.2.tar.gz 
  #cd subversion-1.3.2
  #./configure --with-berkeley-db=/usr/local/bdb --with-apxs=/usr/local/apache2/bin/apxs
  #make
  #make install
  3.檢查Subversion是否安裝成功
  #svnadmin --version            /*如果成功你會看見相應的版本號碼,和支援的服務*/
  4.建立軟體倉庫
  #mkdir -p /svn/repos       /*-p 意思是如果沒有目錄則建立*/
  #svnadmin create --fs-type fsfs /svn/repos      /*參數 --fs-type fsfs  是指定儲存類型*/

  svn儲存版本資料也有2種方式:BDB和FSFS。因為BDB方式在伺服器中斷時,有可能鎖住資料(我在搞ldap時就深受其害,沒法根治),所以還是FSFS方式更安全一點。

  5.建立項目臨時目錄,建議目錄結構如下:
  /svn/tmp/project_xxx/trunk
  /svn/tmp/project_xxx/tags
  /svn/tmp/project_xxx/branches
  /**********************************************************
  然後將專案檔複製到trunk下,如果是從CVS轉移過來的項目,用下面命令清理目錄
  #find projectname/ -name CVS -exec rm -rf {} \;
  **********************************************************/
  6.匯入source
  #svn import -m "initial import" /opt/svn/tmp file:///opt/svn/repos
  /***********************************************************
  -m 後面跟的是操作注釋 /opt/sv/tmp是專案檔位置 file:///opt/svn/repos是建立的軟體倉庫
  ***********************************************************/
  7.檢查是否倒入成功
  #svn list --verbose file:///opt/svn/repos/
  /***********************************************************
  如果成功你看到到你倒入的項目列表,按我的操作步驟應該不會有錯
  ***********************************************************/

  8.給倉庫授權
  #chown -R apache.apache /svn/repos
  #chmod 770 /svn/repos               
  #chmod -R g+w /svn/repos

  9.與apache整合
  用apache工具建立使用者檔案
  #htpasswd -c /svn/passwd admin    ##密碼為:123456
  設定密碼檔案許可權
  #chown a+r passwd

  10.修改設定檔/home/svnrepo/conf/svnserve.conf

  #去掉#[general]前面的#號
  [general]
  #匿名訪問的許可權,可以是read,write,none,預設為read
  anon-access = none
  #認證使用者的許可權,可以是read,write,none,預設為write
  auth-access = write
  #密碼資料庫的路徑,去掉前面的#
  password-db = passwd

  注意:所有的行都必須頂格,否則報錯。
  建議:為了防止不必要的錯誤,建議你直接用我上面的內容覆蓋掉檔案原來的內容

  修改設定檔passwd

  代碼
  [users]
  abc = abc

  注意,一定要去掉[users]前面的#,否則svn只能以匿名使用者登入,用戶端不會出現登入視窗,除非你的anon不為none,否則將返回一個錯誤。
  這裡的密碼都是沒有加密的,我按照一些教程所說的用htpasswd產生的密碼無法使用。

  配置SVN xinetd啟動方式:

  在/etc/xinetd.d/下面建立svn檔案
  service svn
  {
    disable = no
    port = 3690
    socket_type = stream
    protocol = tcp
    wait = no
    user = svn
    server = /usr/bin/svnserve
    server_args = -i -r /home/svn

  }

  重啟xinetd   /etc/init.d/xinetd restart

  停止SVN伺服器:killall svnserve

  啟動SVN伺服器

  對於單個代碼倉庫

  啟動命令  svnserve -d -r /home/svn --listen-host 192.168.1.16

  其中-d表示在後台運行,-r指定伺服器的根目錄,這樣訪問伺服器時就可以直接用svn://伺服器ip來訪問了。如果伺服器有多ip的話--listen-host來指定監聽的ip地址.

  我們可以在svn用戶端中通過svn://192.168.1.16來訪問svn伺服器

  對於多個代碼倉庫,我們在啟動時也可以用-r選項來指定伺服器根目錄,但訪問時需要寫上每個倉庫相對於svn根目錄的相對路徑.

  比 如,我們有兩個代碼倉庫/home/repo1 和/home/repo2,我們用svnserve -d -r /home--listen-host 192.168.1.16來啟動,那麼在用戶端訪問時可以用svn://192.168.1.16/repo1和svn: 

  //192.168.1.16/repo2來分別訪問兩個項目

  開放伺服器連接埠

  svn預設連接埠是3690,你需要在防火牆上開放這個連接埠。

  /sbin/iptables -A INPUT -i eth0 -p tcp --dport 3690 -j ACCEPT

  /sbin/service iptables save

  你也可以通過svnserve的--listen-port選項來指定一個已經開放的其他連接埠,不過這樣的話用戶端使用也必須家上連接埠,如svn://192.168.1.200:9999/.

  啟動subversion服務,並設定版本庫位置

  # svnserve --daemon --root=/svn/repos --listen-port=3690(為主)

  註:不推薦使用root使用者啟動服務,預設連接埠號碼為3690

  11.# yum list mod_dav_svn

  註:可以發現與mod_dav_svn相關的包mod_dav_svn.i386,安裝mod_dav_svn.i386

  # yum install mod_dav_svn.i386

  註:安裝完成後可以發現在/etc/httpd/conf.d檔案夾下,自動產生了subversion.conf檔案,而且自動添加了如下兩行:

  LoadModule dav_svn_module modules/mod_dav_svn.so

  LoadModule authz_svn_module modules/mod_authz_svn.so

  將......之間的內容改為如下內容:

  DAV svn

  SVNPath #SVNPATH/repos/project1

  12.使用svn用戶端匯入項目

  推薦使用用戶端 http://tortoisesvn.tigris.org/

  eclipse外掛程式 http://subclipse.tigris.org/

9.與apache整合
  用apache工具建立使用者檔案
  #htpasswd ?c /opt/svn/pwd admin    ##密碼為:123456
  設定密碼檔案許可權
  #chown a+r pwd
  建立存取權限檔案assesspolicy內容
  [groups]
  developers =admin
  [repos:/]
  @developers = rw

 

  ssl安全認證:
  找到openssl.cnf目錄執行
  #openssl genrsa -des3 -out my-server.key 1024
  然後輸入密碼:xxxxxx
  產生認證執行:
  #openssl req -new -key my-server.key -x509 -out my-server.crt -config openssl.cnf
  
  在 Apache 的 conf 目錄下建立一個 sslfile 目錄,將 my-server.key 和 my-server.crt 檔案都移動到 sslfile 目錄裡面

  修改apache的httpd.conf檔案
  User apache
  group apache

  開啟sslmod前的#號
  LoadModule ssl_module modules/mod_ssl.so
  
  在最後加入如下內容
  SSLMutex default
  SSLRandomSeed startup builtin
  SSLSessionCache none
  ErrorLog logs/SSL.log
  LogLevel info
  <VirtualHost svntest.ut.cn.ibm.com:443>
  SSLEngine On
  SSLCertificateFile conf/ssl/my-server.crt
  SSLCertificateKeyFile conf/ssl/my-server.key
  </VirtualHost>

  <Location /repos>
    DAV svn
    SVNPath /opt/svn/repos
    AuthType Basic
    AuthName "svn repos"
    AuthUserFile /opt/svn/pwd
    AuthzSVNAccessFile /opt/svn/accesspolicy
    require valid-user
    SSLRequireSSL   ##加了這句就只能用https模式,不能用http模式了
  </Location>

  OK,到些結束,啟動apache吧,別忘了要輸入你建立認證時的密碼!

 

9.與apache整合
  用apache工具建立使用者檔案
  #htpasswd ?c /opt/svn/pwd admin    ##密碼為:123456
  設定密碼檔案許可權
  #chown a+r pwd
  建立存取權限檔案assesspolicy內容
  [groups]
  developers =admin
  [repos:/]
  @developers = rw

 

  ssl安全認證:
  找到openssl.cnf目錄執行
  #openssl genrsa -des3 -out my-server.key 1024
  然後輸入密碼:xxxxxx
  產生認證執行:
  #openssl req -new -key my-server.key -x509 -out my-server.crt -config openssl.cnf
  
  在 Apache 的 conf 目錄下建立一個 sslfile 目錄,將 my-server.key 和 my-server.crt 檔案都移動到 sslfile 目錄裡面

  修改apache的httpd.conf檔案
  User apache
  group apache

  開啟sslmod前的#號
  LoadModule ssl_module modules/mod_ssl.so
  
  在最後加入如下內容
  SSLMutex default
  SSLRandomSeed startup builtin
  SSLSessionCache none
  ErrorLog logs/SSL.log
  LogLevel info
  <VirtualHost svntest.ut.cn.ibm.com:443>
  SSLEngine On
  SSLCertificateFile conf/ssl/my-server.crt
  SSLCertificateKeyFile conf/ssl/my-server.key
  </VirtualHost>

  <Location /repos>
    DAV svn
    SVNPath /opt/svn/repos
    AuthType Basic
    AuthName "svn repos"
    AuthUserFile /opt/svn/pwd
    AuthzSVNAccessFile /opt/svn/accesspolicy
    require valid-user
    SSLRequireSSL   ##加了這句就只能用https模式,不能用http模式了
  </Location>

  OK,到些結束,啟動apache吧,別忘了要輸入你建立認證時的密碼!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.