UbuntuでSubversionのサーバ

UbuntuにSubversionで書いたようにインストールまで済んでいたので、設定をしよう。

ubuntuだと/etc/apache2/mods-enabled/dav_svn.confが設定なのでここをいじると良さそう。うちは、/homeに容量の大きいパーティションに割り当ててあるので、svnのリポジトリを/homeの下に置く事にしとこう。リポジトリをいくつ作るかといったことは、まぁ、おいおい考えるとして、dav_svn.confをだいたい以下のように設定した。

<Location /svn>

  DAV svn 
  SVNParentPath /home/svn

</Location>

これで、/home/svnの下にリポジトリを作ると、そのリポジトリが外からアクセスできるようになると。ふむ。

認証の設定は、dav_svn.confのコメントやSubversion によるバージョン管理 - 第6章 サーバの設定 - httpd, Apache HTTP サーバ認証、承認、アクセス制御 - Apache HTTP サーバなんかを参考にして適当に。

あとは、

$ sudo mkdir /home/svn
$ cd /home/svn
$ sudo svnadmin create test

とする。んで、さらに、ubuntuのapacheはwww-dataというユーザで動いてるので、

$ chown -R www-data.www-data test

とすると、このtestというリポジトリにアクセスできるようになった。で、このリポジトリにファイルをインポートするには、クライアント側から、

$ svn import /path/to/your/directory  http://your.server/svn/test/nanka-namae 
   -m 'initial import'

として、このあとはcheckoutやらcommitできた!。

うちのMac OS X の darwinportsでsubversion入れた環境だと、commit時なんかに、

$ svn commit
svn: Commit failed (details follow):
svn: Could not use external editor to fetch log message; consider setting 
the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR is set, 
and no 'editor-cmd' run-time configuration option was found

と怒られる。なので、

$ export EDITOR=vi

とかしとかなきゃだめだった。