一、安裝SVN服務器,到http://subversion.apache.org/packages.html上下載windows版的SVN,並安裝,在命令行下運行svn命令,以下因此,則svn服務器安裝成功。html
C:\Documents and Settings\Administrator>svn apache
使用「svn help」獲得用法。 windows
二、建立倉庫Repository:運行命令服務器
C:\Documents and Settings\Administrator>svnadmin create G:\svn less
該命令會在G盤下自動建立一個名字爲svn的文件夾,該文件中的內容如非必要,不要手動修改,其內容是由svn自動維護的,各自得用途:
conf裏文件夾中都是這個倉庫的配置文件。
db是真正用來存儲數據版本的地方。
hooks文件夾中的內容用以定義某些動做觸發的hook腳本。
locks中的文件用於在某些分支或者文件上加鎖。
三、建立用戶:進入conf目錄(本例中是G:\svn\conf),打開svnserve.conf文件,找到以下內容:tcp
[general] ide
### These options control access to the repository for unauthenticated svn
### and authenticated users. Valid values are "write", "read", this
### and "none". The sample settings below are the defaults. spa
# anon-access = read
# auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
# password-db = passwd
將
# anon-access = read
# auth-access = write
# password-db = passwd
中的註釋去掉修改成
anon-access = read
auth-access = write
password-db = passwd
這樣就可使用passwd文件中的用戶了。
打開passwd(和svnserve.conf在同目錄下),能夠看到,建立好的兩個用戶都被註釋掉了,能夠修改者兩個用戶,也能夠新建本身的用戶,這裏我新建立了一個本身的用戶,passwd文件被修改成:
[users]
# harry = harryssecret
# sally = sallyssecret
admin=admin
四、啓動SVN服務器,運行命令svnserve -d -r G:\svn,就能夠啓動服務
C:\Documents and Settings\Administrator>svnserve -d -r G:\svn
-d表示後臺運行,-r表示以超級管理員的方式運行,G:\svn是指SVN所管理的倉庫。
五、配置SVN服務器開機啓動
打開一個DOS窗口,在任意目錄下執行下面的命令:
//在命令中的每個等號後面都要有一個空格不然命令執行失敗
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 便可