1. せっかくなのでPostgreSQLを最新版に
次の手順にしたがってyumでインストールできるようにする:
http://yum.pgsqlrpms.org/howtoyum.php
/etc/yum.repos.d/CentOS-Base.repo を編集、次の行を [base] と [update] のセクションに追加
exclude=postgresql*
http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-5.noarch.rpm をダウンロードしてインストール
yum install ...で、 postgresql, postgresql-server, postgresql-contrib, pgadmin3 あたりをインストールする
postgresqlのサーバを起動、通常起動に設定( service start postgresql; chkconfig postgresql on )
pgAdmin III 用の管理用パッケージを読み込ませる
su -c "psql -U postgres -d postgres -f /usr/share/pgsql/contrib/adminpack.sql" postgres
2. php も 5.1 から 5.2 にアップグレード
CentOS5.2用のphp-5.2.6が次に用意されている:
http://www.jasonlitka.com/yum-repository/
/etc/yum.repos.d/utterramblings.repo を次の内容で用意する
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
すでにphp-5.1.2がインストールされている場合は、
yum update php* -y でまとめてアップデートする
足りないパッケージがあれば、インストールする
yum install php-mcrypt php-mbstring php-pgsql
3. Webインターフェースのpostgresql管理ツールもインストール
念のためpostgresql管理ツールもインストールしておく
yum install phpPgAdmin
/etc/phpPgAdmin/config.inc.php を編集して、localhost からアクセスできるように
※ pg_hba.conf も編集する必要あり、詳細省略
管理ツール用のDBを登録
su -c "psql template1 < /usr/share/phpPgAdmin/sql/reports-pgsql.sql" postgres
4. drupal のインストール
必要な phpモジュールなどをインストール
yum install gd php-gd
drupal自体をインストールする場所は、/drupal /var/www/drupal とする。
以下の内容で、/etc/httpd/conf.d/drupal.conf を作成
<Directory "/var/www/drupal">
AllowOverride All
Order allow,deny
Allow from all
Deny from .google.com
</Directory>
Alias /drupal /var/www/drupal
clean-url(SEOのために ?を使わないですべて / で区切る) を使いたい場合は、
/var/www/drupal/.htaccess を編集して次の行を有効にしておく
RewriteBase /drupal
drupal の日本語パッケージをインストールする。日本語パッケージは drupal.jp でメンテされていて、次の場所からダウンロードできる
http://downloads.sourceforge.net/drupal-jp/
drupal用のデータベースとアクセスするためのpostgresqlアカウントを作成する
su -c "createuser -DRSP apache" postgres
su -c "createdb -E UTF8 -O apache drupal" postgres
Webサーバをリスタート
service httpd restart
インストールしたdrupal(たとえば http://localhost/drupal)にアクセスし、初期設定をする
初期設定が完了したら、/var/www/drupal/install.php を削除する
5. textsearch_ja が必要とする mecab と辞書をインストール
mecab と mecab用IPA辞書のRPMが toritonn プロジェクトによって用意されている
http://sourceforge.jp/projects/tritonn/releases/
mecab-0.97-tritonn.1.0.12.x86_64.rpm
mecab-ipadic-2.7.0.20070801-tritonn.1.0.12.x86_64.rpm
これらをダウンロードして、rpm -ivh でインストールする
6. textsearch_ja postgresqlモジュールのインストール
rpmパッケージが見つからなかったので、ソースからのインストールとなる
postgresql-devel と gcc が必要になるので、yum install する
tsearch2 はpostgresqlのストアドプロシージャ言語 plpgsql を使用するので、該当データベースで利用可能にしておく。
psql -h localhost -U apache drupal
drupal=> create language plpgsql;
http://pgfoundry.org/projects/textsearch-ja/ から、 textsearch_ja-8.4 をダウンロードし、
次の手順でコンパイルしてインストール
tar xvfz textsearch_ja-8.4.0.tar.gz
cd textsearch_ja
make USE_PGXS=1
sudo make install USE_PGXS=1
drupal用のDBにTSearch2とtextsearch_jaのストアドプロシジャをロードする
su -c "psql -f /usr/share/pgsql/contrib/tsearch2.sql drupal" postgres
su -c "psql -f /usr/share/pgsql/contrib/textsearch_ja.sql drupal" postgres
/var/pgsql/data/postgresql.conf.org を修正し、検索に日本語カタログを使うようにしておく
default_text_search_config = 'pg_catalog.japanese'
postgresql をリスタート
service postgresql restart
7. drupal-tsearchモジュールのインストール
http://a98.jugem.jp/?eid=360 を参照のこと、上述の設定でパッチは不要となる
インデクスの再作成で気をつけるべき点は、TSearch 管理インターフェースで、
http://localhost/drupal/admin/settings/tsearch
再作成を実行しても、すべてのインデクスが削除されるだけで、
実際に再作成されるのはcron の実行が必要となることだ
http://localhost//drupal/admin/reports/status/run-cron
ちなみに、Plamo Linux では、このあたりの設定をまとめてパッケージ化してある。Webブラウザからアクセスして、drupalの初期設定からはじめればよい。
http://plamo-linux.jp/
comments