ホーム > ブログ > タグ : CentOS

yumでイントールすると依存ライブラリを気にせずに済むので簡単です。

1. yumにリポジトリを追加

/etc/yum.repos.d配下にdag.repoなど適当な名前でファイルを作成、以下を記述。
[dag]
name=Dag RPM Repository for Redhat EL4
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

2. インストール

# yum install trac

完了です。

せっかくなので、tracのプロジェクトも作成してみます。

1. tracプロジェクトの作成

hogeというプロジェクトを作成するとします。
# trac-admin /path/to/trac/hoge initenv

以下、指示にしたがって進めます。
# プロジェクト名を入力
Project Name [My Project]>

# 未入力でエンター
Database connection string [sqlite:db/trac.db]>

# 未入力でエンター
Repository type [svn]>

# svnリポジトリの場所を入力
Path to repository [/path/to/repos]>

# 未入力でエンター
Templates directory [/usr/share/trac/templates]>

2. 作成されたプロジェクトをapacheの所有に変更

# chown -R apache:apache /path/to/trac/hoge

3. 認証用のファイルを作成

# trac-admin /path/to/trac/hoge permission add user1 TRAC_ADMIN
※権限にはいくつか種類がありますので、詳しくはこちらを。
Trac Permissions

続いて、認証用ファイルを作成、ユーザー「user1」を追加。
htpasswd -c /path/to/trac/.htpasswd user1
※同じ認証用ファイルにユーザを追加する場合、-cオプションは不要です。

4. apacheの設定

tracインストールの際、
/etc/httpd/conf.d配下に「trac.conf」が作成されているので修正します。

以下は、VirtualHost使用時の例です。
<VirtualHost *:80>
   DocumentRoot /path/to/trac
   ServerName www.example.orz
  <Location /trac>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnvParentDir /path/to/trac
    PythonOption TracUriRoot /trac
  </Location>
  <LocationMatch "/trac/[^/]+/login">
    AuthType Basic
    AuthName "Trac"
    AuthUserFile /path/to/trac/.htpasswd
    Require valid-user
  </LocationMatch>
</VirtualHost>

apacheを再起動します。

これで以下のURLでそれぞれアクセスできます。
・http://www.example.orz/trac <- プロジェクト一覧
・http://www.example.orz/trac/hoge <- hogeプロジェクト

実行環境
CentOS 5.3
Trac 0.11.5

2010年はRubyの仕事がしたいので、環境を整えました。

以下は、CentOS(release 5.3)にRubyとRuby on Railsをインストールする方法です。

関連するライブラリをインストール

# yum install zlib-devel
# yum install openssl-devel
# yum install mysql-devel

Rubyをソースからインストール

# cd /usr/local/src
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz
# tar xfz ruby-1.8.7-p174.tar.gz
# cd ruby-1.8.7-p174
# ./configure
# make
# make install

RubyGemsをインストール

# wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
# tar xfz rubygems-1.3.5.tgz 
# cd rubygems-1.3.5
# ruby setup.rb

RubyGemsを使ってRailsをインストール

#gem install rails --include-dependencies

以上です。

たくさんアプリケーションを開発していきましょう。

CentOSの文字コードを設定する方法です。

/etc/sysconfig/i18nファイルのLANGの値で設定します。
以下は、システムの文字コードをUTF-8に設定する例。

LANG="ja_JP.UTF-8"