Windowsのサーバーで、Subversionのリポジトリを、Apacheを使って公開
最近、Windowsのサーバーで、Subversionのリポジトリを、Apacheを使って公開した。
やったことを、やった順に記録しておく。
その2 Subversion1.6.6をインストール
こちらから。
Setup-Subversion-1.6.6.msi
が簡単。
その3 SubversionのReadme.txtを読んで設定を行う
ReadmeはSubversionのスタートメニューから開くことができた。以下の部分を読んで設定。
For an Apache server here's the essentials: 1. Copy bin/mod_dav_svn.so and bin/mod_authz_svn.so to the Apache modules directory. 2. Add the Subversion/bin directory to the SYSTEM PATH and reboot so all the Subversion support dll's are visible to the Apache service. 3. Edit the Apache configuration file (httpd.conf) and make the following changes: 3a. Uncomment the following two lines: #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule dav_module modules/mod_dav.so 3b. Add the following two lines to the end of the LoadModule section: LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so 3c. Add the following to end of the file. Note: This Location directive is a minimal example with no authentication directives. For other options, especially authentication options, see the Subversion INSTALL file, the Subversion Book, or the TortoiseSVN Manual.DAV svn SVNPath your/repository/path
上記の2.に"reboot"とあるのを見落としていて、うまくいかず、結構悩んだ。
ここまでくればSubversionのリポジトリをWebを通して見ることができているはず。
その4 複数リポジトリ公開できるように設定変更
ここまでのやり方では設定ファイルで指定した1つのリポジトリしか公開できず、リポジトリを増やすたびにLocationを増やす必要があり面倒。SVNParentPathを使えばリポジトリが複数置いてあるフォルダを指定できるので、このフォルダにリポジトリを作成すれば公開完了になる。
Readme.txtの3c.で設定した部分を以下のように変更。
DAV svn SVNParentPath c:/svn-repos
SVNParentPathの引数には複数のリポジトリが置いてあるフォルダを指定。
その5 BASIC認証
設定を以下のように変更
DAV svn SVNParentPath c:/svn-repos Require valid-user AuthType Basic AuthName "Subversion repository" AuthUserFile c:/svn-repos/htpasswd
AuthUserFileで指定されているファイルは、Apacheのbinフォルダにある、htpasswd.exeを使用して作成。
その6 アクセス制御
authzファイルでできるようなアクセス制御をしたいので、以下のように設定を変更。
DAV svn SVNParentPath c:/svn-repos Require valid-user AuthType Basic AuthName "Subversion repository" AuthUserFile c:/svn-repos/htpasswd AuthzSVNAccessFile c:/svn-repos/authz
AuthzSVNAccessFileで指定したファイルの記述方法はauthzファイルと同じでよさそう。