windows下架設SVN服務器並設置開機啟動


1、安裝SVN服務器,到http://subversion.apache.org/packages.html上下載windows版的SVN,並安裝,在命令行下運行svn命令,如下所以,則svn服務器安裝成功。

  1. C:\Documents and Settings\Administrator>svn   
  2. 使用“svn help”得到用法。  

           

2、創建倉庫Repository:運行命令

  1. C:\Documents and Settings\Administrator>svnadmin create G:\svn  

 

  該命令會在G盤下自動創建一個名字為svn的文件夾,該文件中的內容如非必要,不要手動修改,其內容是由svn自動維護的,各自得用途: 

  conf里文件夾中都是這個倉庫的配置文件。 

  db是真正用來存儲數據版本的地方。 

  hooks文件夾中的內容用以定義某些動作觸發的hook腳本。 

  locks中的文件用於在某些分支或者文件上加鎖。    

3、創建用戶:進入conf目錄(本例中是G:\svn\conf),打開svnserve.conf文件,找到如下內容:

  1. [general]   
  2. ### These options control access to the repository for unauthenticated   
  3. ### and authenticated users.  Valid values are "write""read",   
  4. ### and "none".  The sample settings below are the defaults.   
  5. # anon-access = read   
  6. # auth-access = write   
  7. ### The password-db option controls the location of the password   
  8. ### database file.  Unless you specify a path starting with a /,   
  9. ### the file's location is relative to the directory containing   
  10. ### this configuration file.   
  11. ### If SASL is enabled (see below), this file will NOT be used.   
  12. ### Uncomment the line below to use the default password file.   
  13. # password-db = passwd  

   將

 
  1. # anon-access = read   
  2. # auth-access = write   
 
  1. # password-db = passwd  

  中的注釋去掉修改為

 

  1. anon-access = read   
  2. auth-access = write   
  1. password-db = passwd  

 

 這樣就可以使用passwd文件中的用戶了。

  打開passwd(和svnserve.conf在同目錄下),可以看到,創建好的兩個用戶都被注釋掉了,可以修改者兩個用戶,也可以新建自己的用戶,這里我新創建了一個自己的用戶,passwd文件被修改為:

  1. [users]  
  2. # harry = harryssecret  
  3. # sally = sallyssecret  
  4. admin=admin  

4、啟動SVN服務器,運行命令svnserve -d -r G:\svn,就可以啟動服務

  1. C:\Documents and Settings\Administrator>svnserve -d -r G:\svn  

   -d表示后台運行,-r表示以超級管理員的方式運行,G:\svn是指SVN所管理的倉庫。

5、配置SVN服務器開機啟動

  打開一個DOS窗口,在任意目錄下執行下面的命令:

 

  1. //在命令中的每一個等號后面都要有一個空格否則命令執行失敗  
  2. sc create svnserve binPath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root d:\svnstore" displayname= "SVN Serve" depend= Tcpip start= auto  

    

  其中,sc是windows自帶的服務配置程序,參數binPath表示svnserve可執行文件的安裝路徑,由於路徑中的"Program Files"帶有空格,因此整個路徑需要用雙引號引起來。而雙引號本身是個特殊字符,需要進行轉移,因此在路徑前后的兩個雙引號都需要寫成\"

  --service參數表示以windows服務的形式運行,--root指明svn repository的位置,service參數與root參數都作為binPath的一部分,因此與svnserve.exe的路徑一起被包含在一對雙引號當中,而這對雙引號不需要進行轉義。

displayname表示在windows服務列表中顯示的名字, depend =Tcpip 表示svnserve服務的運行需要tcpip服務,start=auto表示開機后自動運行。

  安裝服務后,svnserve要等下次開機時才會自動運行。

  若要卸載svn服務,則執行 sc delete svnserve 即可

這樣SVN的配置就完成了,到http://tortoisesvn.net/downloads.html下載一個SVN客戶端,就可以使用了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM