LoginSignup
3
7

More than 1 year has passed since last update.

SVNサーバ構築

Last updated at Posted at 2022-03-06

SVNサーバをWindows10で構築(2022)。

久々にこのような作業をするので手順をまとめた。

  • 使ったのは Wandisco SVN
  • とりあえずローカルでhttp:// アクセスできるところまで。

Wandisco SVN ダウンロード

1_Installer.jpg

インストールの実行

インストーラ起動。
2_InstallExe.jpg

まずはサーバー設定をデフォルト(localhost)で進める。
リポジトリを収めるフォルダパスを赤枠部分に設定。
Host Portは現在使われていないか"netstat"コマンドで確認しておく(使われていたら別ポート)。

CMD
C:\Users\poo>netstat -nao

3_InstallSetting.jpg

クライアントツールとしてtortoisesvnをインストール

他の参考サイト参照ください。
ダウンロード先

t_svn.jpg

サーバ設定

C:\Program Files (x86)\WANdisco\Subversion\Apache2\conf
に設定ファイルがある。

  • Appachサーバ用:httpd.conf
  • SVN用:subversion.conf (httpd.confから参照される)

それぞれ設定を行う(以下に手順を追って説明)。

Web(appach)サーバ設定:httpd.conf

最初は自身のPCがサーバーなので以下設定のまま(運用時は変更)。

httpd.conf
 #
 # ServerName gives the name and port that the server uses to identify itself.
 # This can often be determined automatically, but we recommend you specify
 # it explicitly to prevent problems during startup.
 #
 # If your host doesn't have a registered DNS name, enter its IP address here.
 #
 ServerName localhost

SVN設定:subversion.conf

  • ユーザ認証は後回しでまずはリポジトリの設定。
    subversion.confのSVNParentPathの "¥"は使えないので"/"に変更する
subversion.conf
 #
 # WANdisco Subversion Configuration
 # http://www.wandisco.com
 #
 # For more information on HTTPD configuration options for Subversion
 ~~ 省略 ~~
 <VirtualHost *:80>
  KeepAlive On
  <Location /svn>
   DAV svn
   SVNParentPath "C:/Repo"
   #AuthType Basic
 ~~ 省略 ~~
 </VirtualHost>

  • リポジトリを作成
    コマンドプロンプトで svnadminでリポジトリを作成する。
CMD
 C:\Users\Poo>svnadmin create c:\Repo\hoge
 C:\Users\Poo>

Tortris SVN リポジトリブラウザで確認する。
3_Rep.jpg
ここまででWebサーバとしてリポジトリ作成ができた。
フォルダも追加。
4_Trunk.jpg

SVN ユーザ管理

  • subversion.confを以下のようにコメントアウトを外してAuthUserFile,AuthzSVNAccessFile,に対象を追記。
subversion.conf
Define SVNROOT "C:/Repo"

<Location /svn>
DAV svn
SVNParentPath "${SVNROOT}"
AuthType Basic
AuthName "Subversion Repo"
# If you didn't specify a password file during installation the
# next line needs to be configured for user authentication.
AuthUserFile "${SVNROOT}/users"
AuthzSVNAccessFile "${SVNROOT}/authzsvn.conf"
Require valid-user
SVNAutoversioning on
</Location>
  • AuthUserFile(ユーザとパスワードの設定ファイル) の作成。
    ユーザ名+パスワードのファイル(htpasswdコマンドで作成する)。

コマンドプロンプトからhtpasswdコマンドでユーザファイルを作成。

例) ユーザー、"one","two"を登録。

CMD
C:\Users\poo>htpasswd -c -m users one
New password:
Re-type new password:
Adding password for user one

C:\Users\poo>htpasswd -m users two
New password:
Re-type new password:
Adding password for user two

C:\Users\poo>

usersの内容

one:$apr1$w0VsJ4ti$SL3HpOz/GT2MQg0Vplh6V1
two:$apr1$4fe7ozxQ$FOaNYaR2FMV8gD7ng56Bt1
  • AuthzSVNAccessFile(ユーザ毎のアクセス権限設定ファイル)の作成。

authzsvn.conf
[groups]
#開発者
developers = one
#管理者
manager = one
[/]
#すべての人が読み込み可能
* = r

これらをリポジトリルート C:\Repo 以下に配置。

動作確認

リポジトリブラウザでアクセス。
5_Asscess.jpg

ログイン画面でログイン。
6_login.jpg

作成したリポジトリに無事アクセスできた。
7_OK.jpg

その他

サーババージョン確認。

CMD
C:\Users\poo>svnadmin --version
svnadmin, version 1.14.1 (r1886195)
   compiled Mar 16 2021, 17:13:43 on x86/x86_64-microsoft-windows10.0.19041

引っ越し

3
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
7