『ソースアーカイブからのインストールの例』

初出:Software Design 2002年11月号
	大特集「究めるPlamo Linux クライアント編 
	3章○自分だけのPlamoを楽しむ〜MyPlamo作成術」
ここでは、ソースアーカイブからのインストールの手順をPostgreSQL のインストールを例に説明します。
 まず、PostgreSQLの管理ユーザとグループを作成します。ここでは、仮に
postgres:pgsql とします。そして、そのホームディレクトリを /opt/pgsql
とします。

# groupadd pgsql
# useradd -g pgsql -d /opt/pgsql -m -c "Postgres Admin." -s /bin/tcsh postgres
# chown -R postgres.pgsql /opt/pgsql

  共有ライブラリをロードし易くするために、 /etc/ld.so.conf に
/opt/pgsql/lib を追加しておきます。作業ディレクトリで、postgres にスイッ
チユーザして、アーカイブサイトから PostgreSQL 最新版のソースアーカイブ
を取得します。

# cd /tmp
# su postgres
% wget ftp://ftp.postgresql.jp/pub/sources/postgresql-7.2.2.tar.gz

日本語のメッセージファイルのパッチがあるのでそれも取得しておきます。

% wget ftp://ftp.net-newbie.com/pub/postgres/postgresql-7.2.2.nlspatch.gz

日本ポストグレスユーザー会の和訳文書分科会に日本語マニュアルもあるので
これも取得しておきます。

% wget http://www.postgresql.jp/document/pg721doc/man.tar.gz

PosegreSQLのソースを展開し、日本語メッセージのパッチを当てます。

% tar xvfz postgresql-7.2.2.tar.gz
% cd postgresql-7.2.2
% zcat ../postgresql-7.2.2.nlspatch.gz | patch -p1

構成を行ない、コンパイルしてインストールします。

% ./configure  --prefix=/opt/pgsql \
        --enable-multibyte=EUC_JP --enable-nls \
        --enable-syslog --with-tcl \
        --with-tclconfig=/usr/lib \
        --with-tkconfig=/usr/lib \
        --with-krb4=/usr/athena --with-openssl=/usr \
        --with-perl --with-python --with-odbc --with-java

(注意、日本語を使うために必要なオプションは --enable-multibyte=EUC_JP
と --enable-nls であり、そのほかのオプションについては、必要に応じて付
けるようにして下さい。)

% make
% make install

日本語のオンラインマニュアルをインストールします。

% tar xvfz man.tar.gz -C /opt/pgsql/man
% mv /opt/pgsql/man/man  /opt/pgsql/man/ja_JP.eucJP

マニュアルのセクション番号を変更します。

% mv /opt/pgsql/man/ja_JP.eucJP/manl /opt/pgsql/man/ja_JP.eucJP/man7
% foreach l ( /opt/pgsql/man/ja_JP.eucJP/man7/*.l )
?   mv $l $l:r.7
? end

	Bash の場合:
	$ for l in /opt/pgsql/man/ja_JP.eucJP/man7/*.l
	>   do  mv $l ${l%%.l}.7
	> done


データベースの初期化をします。

% initdb -L /opt/pgsql/share -D /opt/pgsql/data

初期ユーザと管理ユーザを登録します。

% createuser www <<EOS1
n
n
EOS1
% createdb www
% createuser wadm<<EOS2
y
y
EOS2

  あとは、 /opt/pgsql/data の pg_hba.conf や postgresql.conf,
postmaster.opts などの設定を行ない、SSL の設定などを行ないますが、ここ
では割愛させていただきます。


(c) 2002-2003 juk at yokohama email ne jp