I ♥ WordPress

CentOS5 で Subversion+Trac
2007/08/27 21:24 posted by kunkichi

またもや前回のエントリから時間が経ってしまったのだけど、いろいろ検証しているうちにキックスタート設定ファイルやら構築手順やらのファイル管理が必要な気がしてきた。

のちのちはアプリ開発環境も構築していきたいということもあって、ちょっと脱線して、前からやってみたかった Subversion+Trac を CentOS5 に導入してみました。

ちなみに、前提条件はこんな感じ。

  • Subversion のレポジトリは /home/develop/svn 配下にプロジェクト毎にディレクトリを分けて作成。

    例)
        /home/develop/svn/project1
        /home/develop/svn/project2
        /home/develop/svn/project3

  • Trac のプロジェクト用ディレクトリは /home/develop/trac 配下にプロジェクト毎にディレクトリを分けて作成。

    例)
        /home/develop/trac/project1
        /home/develop/trac/project2
        /home/develop/trac/project3

  • Subversion へのアクセスは HTTP経由のみ。svn はセキュリティ的にありえないし、svn+ssh は複数で使う場合にパーミッションの問題が面倒な気がしたので。HTTP なら apache ユーザの権限つけとけば済むのでシンプル。
  • Subversion へのアクセス制限はBASIC認証。またコミット時はこれがコミットしたユーザとして登録される。HTTPS はある程度環境ができてから。
  • Trac へのアクセス制限は Subversion のアクセス制限設定と同じファイルを使う。
  • OS は CentOS5 を最小構成で入れた状態。
  • 【追記】2007/9/7:SELinuxとFirewallはOFF。

では手順。

・Subversion のインストール

CentOS5 では subversion を HTTP 経由 で使うのに必要なパッケージが全部揃っているので、yumで subversion、httpd、mod_dav_svn をインストールすればオーケー。コマンド的には↓で全部必要なものが入ります。
# yum install mod_dav_svn
subversion のレポジトリを作成。プロジェクト名は”test”とします。
# mkdir -p /home/develop/svn
# svnadmin create /home/develop/svn/test

トランク、タグ、ブランチ用のディレクトリを作成。
# svn mkdir file:///home/develop/svn/test/trunk file:///home/develop/svn/test/tags file:///home/develop/svn/test/branches -m "init repository layout (trunk,tags,branches)"
apacheからファイルの読み書きが出来るようにパーミッションを変更。
# chown -R apache.apache /home/develop/svn/test
BASIC認証の設定。
# htpasswd -c /home/develop/.htpasswd kunkichi
apache の設定変更。/etc/httpd/conf.d 以下に subversion.conf が出来ているのだけど、全てコメントアウトされているので、必要な箇所のコメントアウトを外して、リポジトリ、BASIC認証用パスワードファイルのパスを変更。
# vi /etc/httpd/conf.d/subversion.conf
最終的にはこんな感じ。
<Location /svn>
   DAV svn
   SVNParentPath /home/develop/svn
 
   # Limit write permission to list of valid users.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL
 
      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile /home/develop/.htpasswd
      Require valid-user
   </LimitExcept>
</Location>

最後にapacheを再起動+自動起動設定。
# service httpd start
# chkconfig httpd on

ブラウザで確認。トランク、タグ、ブランチ用のディレクトリを作成した時にリビジョンが上がっているので”Revision 1: /”と表示されればOK。

・Tracのインストール

続いて Trac のインストール。

こちらも yum でササッと行きたいところだけど、CentOS5 の標準リポジトリに Trac は含まれていない。あとTrac が依存しているライブラリも同様。でもサードパーティーのレポジトリである DAGレポジトリ(rpmforge) でちゃんとパッケージ化されているのでこれを使えばオーケー!

、、、なんだけど、DAG の Trac パッケージは日本語化がされていない。個人的には英語でもなんら困らないし、むしろサーバのパッケージ管理を考えるとこっちの方がベターなんだけど、初のTrac ということもあるので、今回は依存ライブラリを DAG から、Trac 本体はインタアクト株式会社のウェブサイトで提供されている日本語化されているものを使う。

DAGレポジトリの追加。
# wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

DAGレポジトリは標準でOFF。必要なときのみONとする。DAGレポジトリの設定ファイルを開いて
# vi /etc/yum.repos.d/rpmforge.repo
・・・
enabled = 1
・・・
これを
・・・
enabled = 0
・・・

に変更。

Tracが依存しているライブラリをDAGからインストール
# yum --enablerepo=rpmforge install -y python-clearsilver
ついでにmod_pythonもインストールしておく。こっちは標準レポジトリから。
# yum install -y mod_python

日本語化Tracのインストール
# wget http://www.i-act.co.jp/project/products/downloads/trac-0.10.4-ja-1.zip
# unzip trac-0.10.4-ja-1.zip
# cd trac-0.10.4-ja-1
# python setup.py install

Tracプロジェクト用ディレクトリの作成
# mkdir /home/develop/trac
Tracプロジェクトの作成。こちらも subversion のプロジェクト名と同じように”test”とします。
# trac-admin /home/develop/trac/test initenv
trac-admin 〜 initenv するといろいろ聞かれるので以下のように回答していきます。

まずプロジェクト名。”test”と入力。
Project Name [My Project]> test
Tracのデータベース接続詞を設定。今回はお手軽に デフォルトのsqlite を使うのでそのままENTER。
Database connection string [sqlite:db/trac.db]>
レポジトリのタイプを指定。subversion がデフォルトなのでそのままENTER。
Repository type [svn]>
subversionのレポジトリパスを指定します。
Path to repository [/path/to/repos]> /home/develop/svn/test
Tracのテンプレートパスを指定。とりあえずデフォルトで。そのままENTER。
Templates directory [/usr/share/trac/templates]>

完了したら動作確認。Trac付属の簡易HTTPサーバを起動。
# tracd --port 8000 /home/develop/trac/test
ブラウザで http://サーバのIP:8000/プロジェクト名 にアクセスして画面が表示されればとりあえずOK。

Tracd で動作確認が出来たら Ctrl+C で止めて今度はapacheで動作するように設定。まずパーミッションを変更。
# chown -R apache:apache /home/develop/trac/test
次にtrac用のapache設定ファイルを作成。
# vi /etc/httpd/conf.d/trac.conf
内容はこんな感じ。
<Location /trac>
   SetHandler mod_python
   PythonDebug On
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnvParentDir /home/develop/trac
   PythonOption TracUriRoot /trac
</Location>
 
<LocationMatch "/trac/.*/login">
   AuthType Basic
   AuthName "trac"
   AuthUserFile "/home/develop/.htpasswd"
   Require valid-user
</LocationMatch>

設定が終わったらapacheを再起動して設定を反映。
# service httpd restart
ブラウザで http://サーバのIPアドレス/trac/test にアクセスして確認してみます。
Trac
こんな画面が表示されたらこれで一応完了です。

あと、やりたいこととして

  • HTTPSでのアクセス。
  • Subversion のコミットとTracのチケットの連携。
  • Subversion でコミットが行われたり、Trac でチケットが登録された時にメールで通知。

とかあるんだけどこれは後々。

【追記:2007/9/8】

このエントリを参照していただいたサイトで以下のエントリがありました。

■[CentOS]CentOS5でsubversionを入れる時に詰まったことのメモ

  CentOS5 で Subversion+Trac | cafe chantant blog

VMware Serverを導入したので、CentOS5を入れていろいろと試そうということで上記のページを参考にSubversionのインストールしました。

インストールを終えてブラウザから動作の確認をしたのですが、「Could not open the requested SVN filesystem」と表示され、うまくいっていませんでした。(public static void main

テスト環境だったのでSELinuxとかFirewallはOFFにしてたのですが記述してなかったので追記しました。

コメント&トラックバック

トラックバックURL

[…] CentOS5 で Subversion+Trac ■[サーバ][linux][svn] […]

2011/7/12 火曜日11:59:00 posted by VPS作業メモ[4]-SVN+trac « cross HVN

My partner and I stumbled over here by a different web page and thought I might as well check things out. I like what I see so now i am following you. Look forward to going over your web page yet again.

2011/9/28 水曜日15:43:16 posted by candi stripe

I found this is an useful and funny posting, so I think it is very useful and knowledgeable. Appreciate for the efforts you have made in writing this write-up. I am hoping the various excellent work from you next time as well. Really your creative writing ability has urged me.

2011/9/30 金曜日17:19:06 posted by cheap Supra 2011

I dicovered this is an informative and interesting write-up, so I think it is very helpful and knowledgeable. Many thanks for the efforts you have made in writing this script. I am hoping the analogous excellent work from you in the future as well. practically your creative writing ability has urged me.

2011/9/30 金曜日17:19:08 posted by cheap Supra 2011

You completed some fine points there. I did a search on the matter and found a good number of persons will agree with your blog.

2011/9/30 金曜日17:22:47 posted by kiev escorts

I generally consent with your points. We all benefit from this fantastic post. This web-site is best. I have acquired lots of things from here. Many thanks.

2011/9/30 金曜日17:36:43 posted by cheap Supra 2011

I generally consent with your opinions. We all benefit from this good write-up. This internet site is excellent. I have figured out a lot of things from here. Thanks.

2011/9/30 金曜日17:55:01 posted by cheap Supra 2011

Many thanks for assisting to study this judgment, I feel strongly about issues and I am willing to learn a quantity of things on this thing. Probably, as you get knowledge, would you take to heart updating your site with a few more info? It’s very good for me.

2011/9/30 金曜日19:13:40 posted by cheap Supra 2011

In fact, the issues is actually the sweetest on this benificial post. I coordinate with your sum and will eagerly await your approaching updates. Saying thanks will not just be sufficient, for the great clarity in your publication.

2011/9/30 金曜日19:15:38 posted by cheap Supra 2011

Thank you for being the coach on this theme. I actually enjoyed your present article very much and a lot of all enjoyed reading how you really handled the areas I regarded as controversial. You happen to be always rather kind towards readers much like me along with aid me inside my existence. Thank you.

2011/10/1 土曜日1:44:28 posted by Jon Coxwell

Hi, n I didn’t need to go that far, I simply defined the function as a variable and passed it to the toggle constructor:

2011/10/18 火曜日21:27:20 posted by Darrick Cohenour

You speak with so many elements, so much essence, even though I become aware that you have definitely hit the nail on the head. Well done! I will straightly grip your rss feed to stay abreast of every updates. Real work and much success in your business efforts!

2011/10/26 水曜日14:08:14 posted by UGG Classic Tall Boots

I just found this approach superior internet site and desired to portray my admire using this statement.

2011/10/28 金曜日22:38:13 posted by Ronald Lestourgeon

Exactly what a lovely website and I really like the way you respond your particular blog posts.

2011/10/30 日曜日22:18:22 posted by we

I amaddicted toreading it.I need toread up onthis issue… Iappreciate yourtime and effortto invest morein your weblog, since itis obviously agreat place, I canfind a lot ofuseful details..

2011/10/31 月曜日12:57:00 posted by Roofers

I ‘d believe that many of us readers are really fortunate to dwell in a remarkable network with so many wonderful professionals with valuable opinions.

2011/11/10 木曜日20:49:12 posted by couple necklance

Very instructive and wonderful complex body part of written content , now that’s user genial (:.

2011/11/22 火曜日8:08:48 posted by Transformers The Games

strongzz Reading this information So i’m happy to convey that I have a very good uncanny feeling I discovered just what I needed. I most certainly will make certain to don’t forget this web site and give it a glance regularly.

2011/11/29 火曜日19:19:46 posted by cheap uggs new mexico

I truly enjoy the blog post.Thanks Again. Really Cool.

2011/12/5 月曜日16:46:21 posted by Violet Candy Shot

You will discover certainly a lot more details to look out for, but many thanks for sharing this data.

2011/12/13 火曜日3:33:54 posted by cuisinart mcp117-16br

And you also et a tally with Forums?

2012/1/6 金曜日19:11:00 posted by takhyKhynh1ra1hy

website and instantly developed a terrible feeling I never expressed respect to the site owner for those strategies. All the people had been absolutely passionate to read all of them and have in effect extremely been loving them. I appreciate you for genuinely well thoughtful as well as for getting this kind of fabulous resources most people are really wanting to understand about. Our sincere regret for not saying thanks to earlie

2012/1/9 月曜日18:24:17 posted by christmas recipes

Certainly completely with all your conclusions and feel that you’ve made some excellent points. Also, I like layout , design of one’s site plus the

2012/1/29 日曜日15:29:05 posted by business franchises for sale

Your webpage won’t display properly on my iphone 3gs - you may want to try and fix that

2012/2/3 金曜日2:50:47 posted by Maryellen Booras

Hello, i think that i saw you visited my blog so i came to “return the favor”.I am attempting to find things to enhance my website!I suppose its ok to use some of your ideas!!

2012/2/5 日曜日10:17:26 posted by 3 free credit reports

Perfect submit ! I want to find out after you update your site, how can i sign up to your site?.The software made it easier for us a considerable amount. I used to be little bit aware about this although this post provided distinct practice

2012/2/7 火曜日18:03:44 posted by 1amhyzhyhvxtvn





このページの先頭へ