サーバは CentOS 5 ざくざくっとやり方を以下に記載。
前提条件
まずは
easy_install mercurial
でさくっと Mercurial をインストール。
その後、Mercurial 本家(http://mercurial.selenic.com)からソースコードをダウンロード
wget http://mercurial.selenic.com/release/mercurial-1.4.3.tar.gz
で、解凍。
tar xzf mercurial-1.4.3.tar.gz
解凍したらトップディレクトリに hgwebdir.cgi があるので、リポジトリの手前位にコピーする。
とりあえず、こんな感じにした。
/var/repos/ |----hgwebdir.cgi |----repositories/ |----sample/.hg/
リポジトリ作成は sample ディレクトリで「hg init」するだけ。楽勝。
-
-
- -
-
設定していくものとしては、hgwebdir.cgi と同じディレクトリに hgweb.config を作成。
[paths] sample = /var/repos/repositories/sample
シンプルに設定。次に hgwebdir.cgi の先頭近辺。
import sys sys.path.insert(0, "/usr/lib/python2.4/")
この辺のをコメント解除して、適時編集。ディレクトリパスは、とりあえず python 入ってるところ。*1
次にファイルの最後のほう
application = hgwebdir('/var/repos/hgweb.config')
こんな風に設定。
最後に、httpd.conf の適当な所で以下を記述。
ScriptAlias /hg /var/repos/hgwebdir.cgi
再起動すると、httpd.conf で設定した url でアクセスできるようになる。
たとえば、
http://www.example.net/hg
http://www.example.net/hg/sample
など。
誰でも読み書きされると困るので、htpasswd でも使ってアクセス制限を設定し、
後は以下の設定。.hg/hgrc ファイル (もしくは the /home/user/.hgrc file) に許可ユーザを設定する。
[web] allow_push = azalea [web] push_ssl = false
ssl はデフォルト必須なので、切らないと面倒。
セキュリティ考えればやったほうがいいんだろうけどね、、、、、
参考:http://mercurial.selenic.com/wiki/PublishingRepositories