前幾天寫了linux版的,受廣大論友的邀請,特寫此windows的版本,希望大家能夠共同為此論壇作出貢獻,也希望越來越多的人能夠更加方便地使用SVN。
OS: Windows XP SP2
1) 安裝Apache Server
2) 安裝SVN
3) 配置郵件通知以及修改log權限
1. 安裝apache2.0.59,從這里可以下載到
http://apache.justdn.org/httpd/binaries/win32/apache_2.2.3-win32-x86-no_ssl.msi安裝過程中設置以下參數:
Network Domain: localhost
Server name: localhost
Administrator's Emai Address:
windymax@126.com安裝到默認路徑為C:\Program Files\Apache Group\Apache2
2. 安裝subversion1.4.0,從這里下載
http://www.iusesvn.com/bbs/download/svn-win32-1.4.0.zip安裝到默認路徑為C:\Program Files\Subversion
默認安裝后,在apache的配置文件中會自動加入以下兩行。
LoadModule dav_svn_module "C:/Program Files/Subversion/bin/mod_dav_svn.so"
LoadModule authz_svn_module "C:/Program Files/Subversion/bin/mod_authz_svn.so"
把這行的注釋去掉
LoadModule dav_fs_module modules/mod_dav_fs.so
拷貝C:\Program Files\Subversion\bin下的libdb44.dll到這個目錄下C:\Program Files\Apache Group\Apache2\bin
打開apache的配置文件在末尾處加入以下參數:
<Location /svn>
DAV svn
SVNPath d:\svndata\test
AuthType Basic
AuthName "Windy SVN"
AuthUserFile d:\svndata\test\passwd
Require valid-user
</Location>
保存。(在這里權限文件我不多講了,大家多做實驗就明白了)
建立倉庫
打開CMD命令行界面,"開始" -> "運行" -> "cmd" -> "回車"
C:\Documents and Settings\windy> d: //進入D盤(因為我們要在D盤下創建倉庫)
D:\> md svndata //創建一個名叫svndata的目錄
D:\> c: //進入C盤
C:\Documents and Settings\windy> cd\ //退到C盤根目錄
C:\Documents and Settings\windy> cd C:\Program Files\Subversion\bin //進入subversion/bin目錄
C:\Program Files\Subversion\bin> svnadmin create d:\svndata\test //用svnadmin命令創建名為test的倉庫(這條命令成功后,在test下會出現很多文件夾和文件)
C:\Program Files\Subversion\bin> cd C:\Program Files\Apache Group\Apache2\bin //進入apache\bin目錄
C:\Program Files\Apache Group\Apache2\bin> htpasswd -cm d:\svndata\test\passwd user1 //用htpasswd命令創建第一個用戶(user1),同時生成密碼認證文件,c參數為create,m參數為MD5加密方式
New password: ******
Re-type new password: ******
Adding password for user user1 //加入用戶成功
C:\Program Files\Apache Group\Apache2\bin> htpasswd -m d:\svndata\test\passwd user2 //用htpasswd命令創建第二個用戶(user2),注意如果在這時加入c參數會覆蓋掉之前創建的用戶及文件。
New password: ******
Re-type new password: ******
Adding password for user user2 //加入用戶成功
重新啟動apache,進行測試。
用IE打開
http://localhost/svn,這時應該可以看到
Revision 0: /
--------------------------------------------------------------------------------
Powered by Subversion version 1.4.0 (r21228). //說明我們已經配置成功了
3. 配置郵件通知以及修改log權限
下載所需要的軟件包
--在這里下載
http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.819-MSWin32-x86-267479.msi到D盤根目錄下。
--下載
http://download.microsoft.com/download/vc15/patch/1.52/w95/en-us/nmake15.exe到D盤根目錄下。
--下載
http://search.cpan.org/CPAN/authors/id/K/KW/KWILLIAMS/Module-Build-0.2805.tar.gz到D盤根目錄下,將Module-Build-0.2805.tar.gz解壓到D盤。
--下載
http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/Authen-SASL-2.10.tar.gz到D盤根目錄下,將Authen-SASL-2.10.tar.gz解壓到D盤。
--下載
http://search.cpan.org/CPAN/authors/id/A/AP/APLEINER/Net-SMTP_auth-0.08.tar.gz到D盤根目錄下,將Net-SMTP_auth-0.08.tar.gz解壓到D盤。
--下載
http://search.cpan.org/CPAN/authors/id/D/DW/DWHEELER/SVN-Notify-2.64.tar.gz到D盤根目錄下,將SVN-Notify-2.64.tar.gz解壓到D盤。
開始安裝Perl以及模塊
--安裝Active Perl,一路默認安裝,默認路徑為C:\Perl
--測試perl是否正常工作(這步很關鍵)
打開CMD命令行界面,"開始" -> "運行" -> "cmd" -> "回車"
C:\Documents and Settings\windy> perl //如果沒有報錯,說明已經正常工作,因為安裝perl時,安裝程序會自動設置好環境perl(如果在系統環境變量中沒有自動添加,需手動添加perl變量環境),具體做法是:
"回到桌面" -> "鼠標右鍵我的電腦" -> "屬性" -> "高級" -> "環境變量" -> "系統變量中Path最前面中添加C:\Perl\bin\;" ->"完成"。 //測試,如果報錯,請重新啟動電腦后進行測試。
--將nmake15.exe改名為nmake.exe后拷貝到c:\windows\system32目錄下。
--測試nmake是否是否正常工作(這步很關鍵)
打開CMD命令行界面,"開始" -> "運行" -> "cmd" -> "回車"
C:\Documents and Settings\windy> nmake
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved. //說明nmake已經正常工作
--安裝Module-Build模塊
打開CMD命令行界面,"開始" -> "運行" -> "cmd" -> "回車"
C:\Documents and Settings\windy> d:
D:\> cd Module-Build-0.2805
D:\Module-Build-0.2805> perl Build.PL //收集系統環境變量
D:\Module-Build-0.2805> Build //進行編譯
D:\Module-Build-0.2805> Build test //測試
D:\Module-Build-0.2805> Build install //編譯后安裝
--安裝Perl模塊Authen::SASL,進入Authen-SASL-2.10目錄,首先開打Makefile.PL
打開CMD命令行界面,"開始" -> "運行" -> "cmd" -> "回車"
C:\Documents and Settings\windy> d:
D:\> cd Authen-SASL-2.10
D:\Authen-SASL-2.10> perl Makefile.PL //收集系統環境變量
出現選擇安裝提示,y和n先后安裝一次
D:\Authen-SASL-2.10> nmake //進行編譯
D:\Authen-SASL-2.10> nmake test //進行測試
D:\Authen-SASL-2.10> nmake install //編譯后安裝
--安裝Perl模塊Net::SMTP_auth
打開CMD命令行界面,"開始" -> "運行" -> "cmd" -> "回車"
C:\Documents and Settings\windy> d:
D:\> cd Net-SMTP_auth-0.08
D:\Net-SMTP_auth-0.08> perl Makefile.PL //收集系統環境變量
D:\Net-SMTP_auth-0.08> nmake //進行編譯
D:\Net-SMTP_auth-0.08> nmake test //測試
D:\Net-SMTP_auth-0.08> nmake install //編譯后安裝
--安裝Perl模塊SVN::Notify
打開CMD命令行界面,"開始" -> "運行" -> "cmd" -> "回車"
C:\Documents and Settings\windy> d:
D:\> cd SVN-Notify-2.64
D:\SVN-Notify-2.64> perl Build.PL //收集系統環境變量
D:\SVN-Notify-2.64> Build //進行編譯
D:\SVN-Notify-2.64> Build test //測試
D:\SVN-Notify-2.64> Build installl //編譯后安裝
--安裝完畢。
設置郵件通知
--拷貝post-commit.tmpl為post-commit.bat
--刪除末尾參數,增加下面參數:
set REPOS=%1
set REV=%2
SET PATH=C:\PERL\BIN;
SET OS=Windows_NT
SET SystemRoot=C:\WINDOWS
svnnotify --repos-path %REPOS% -r %REV% --to
windy@126.com --smtp smtp.126.com -H HTML::ColorDiff -d --subject-prefix [Windy SVN]
//--to要跟你要發送給誰的郵件地址,--smtp后跟你自已的郵件服務器地址,比如mail.126.com
設置log可以修改
--拷貝pre-revprop-change.tmpl為pre-revprop-change.bat
--刪除末尾參數,增加下面參數:
REM SVN pre-revprop-change hook allows edit of logmessages from TSVN
setlocal
set REPOS=%1
set REV=%2
set USER=%3
set PROPNAME=%4
set ACTION=%5
if not "%ACTION%"=="M" goto refuse
if not "%PROPNAME%"=="svn:log" goto refuse
goto OK
:refuse
echo Cann't set %PROPNAME%/%ACTION%, only svn:log is allowed 1>&2
endlocal
exit 1
:OK
endlocal
exit 0
完成所有設置,開始測試。
posted on 2007-05-18 10:01
周銳 閱讀(1121)
評論(0) 編輯 收藏 所屬分類:
Apache 、
配置管理