PostgreSQL-8.3.3インストール
事前調査
CentOS-5.2インストール時に一緒にインストールできるPostgreSQLのバージョンを調べてみた(CD-ROMの中に入っているPostgreSQLのRPMを見てみただけ)。
[worker@CentOS-5.2 ~]$ ls -l /mnt/CentOS/*postgresql* : -rw-rw-r-- 2 worker worker 2990376 1月 13 2008 /mnt/CentOS/postgresql-8.1.11-1.el5_1.1.i386.rpm : [worker@CentOS-5.2 ~]$
8.1.1かぁ。最新版を試したいのだ。yumだと?(でもyumレポジトリ?の設定は何もしてないからデフォルトまんまなんだけど…)
[worker@CentOS-5.2 ~]$ yum list postgresql Available Packages postgresql.i386 8.1.11-1.el5_1.1 base [worker@CentOS-5.2 ~]$
ふむふむ。。。今回もソースからコンパイルしよう。
# 本来ならばRPMで全てを管理した方が良いのかもしれない。
# あれはソースからいれて、こっちはRPMで入れて…って管理としてはよろしくないよね。
# でも今回はあくまで検証環境だからあまり気にしない。
ダウンロード
ソースをダウンロードする。
[worker@CentOS-5.2 ~]$ wget ftp://ftp.sra.co.jp/pub/cmd/postgres/8.3.3/postgresql-8.3.3.tar.gz --02:12:38-- ftp://ftp.sra.co.jp/pub/cmd/postgres/8.3.3/postgresql-8.3.3.tar.gz => `postgresql-8.3.3.tar.gz' ftp.sra.co.jp をDNSに問いあわせています... 202.32.10.2 ftp.sra.co.jp|202.32.10.2|:21 に接続しています... 接続しました。 anonymous としてログインしています... ログインしました! ==> SYST ... 完了しました。 ==> PWD ... 完了しました。 ==> TYPE I ... 完了しました。 ==> CWD /pub/cmd/postgres/8.3.3 ... 完了しました。 ==> SIZE postgresql-8.3.3.tar.gz ... 17500570 ==> PASV ... 完了しました。 ==> RETR postgresql-8.3.3.tar.gz ... 完了しました。 長さ: 17500570 (17M) 100%[========================================>] 17,500,570 48.9K/s in 5m 45s 02:18:27 (49.6 KB/s) - `postgresql-8.3.3.tar.gz' を保存しました [17500570] [worker@CentOS-5.2 ~]$
ユーザ作成
PostgreSQLのマニュアルによるとPostgreSQLは独自の管理ユーザで起動すべしと書いてある。よって今回は新たにユーザを作成する。
[worker@CentOS-5.2 ~]$ su - パスワード: ********** [root@CentOS-5.2 ~]# useradd postgres
デフォルトままでpostgresユーザを作成。今回はパスワードは付けないでおく。なぜならばデータベースを起動・管理するだけのユーザなので直接postgresユーザで検証環境にログインする必要はないから。設定変更等々でファイルの編集にもpostgresユーザは必要だけれども、実稼働しているサービス環境ならいざ知らず(管理は他の人が行う事が多いだろうから)、自分しかログインしない環境においては必要ないだろう…との判断。そんな事言ったらそもそもpostgresユーザなんて必要ないんじゃね?というのは置いておく。
バイナリ展開
前回と同様に /usr/local/src 配下にソースは置いておく。作業はすべてそこで。
[root@CentOS-5.2 ~]# cd /usr/local/src/ [root@CentOS-5.2 src]# tar zxvf ~worker/postgresql-8.3.3.tar.gz : postgresql-8.3.3/config/tcl.m4 [root@CentOS-5.2 src]# chown -R postgres:postgres postgresql-8.3.3/ drwxrwxrwx 6 postgres postgres 4096 6月 9 09:58 postgresql-8.3.3/ [root@CentOS-5.2 src]#
configure
オプションは今回もprefix以外はデフォルトままで実行する。
[root@CentOS-5.2 src]# su - postgres [postgres@CentOS-5.2 ~]$ cd /usr/local/src/postgresql-8.3.3/ [postgres@CentOS-5.2 postgresql-8.3.3]$ ./configure --prefix=/usr/local/postgresql-8.3.3 checking build system type... i686-pc-linux-gnu : config.status: linking ./src/makefiles/Makefile.linux to src/Makefile.port [postgres@CentOS-5.2 postgresql-8.3.3]$ echo $? 0 [postgres@CentOS-5.2 postgresql-8.3.3]$
コンパイル
[postgres@CentOS-5.2 postgresql-8.3.3]$ make : All of PostgreSQL successfully made. Ready to install. [postgres@CentOS-5.2 postgresql-8.3.3]$ echo $? 0 [postgres@CentOS-5.2 postgresql-8.3.3]$
コンパイルチェック
[postgres@CentOS-5.2 postgresql-8.3.3]$ make check make -C doc all : ======================= All 114 tests passed. ======================= : make[1]: ディレクトリ `/usr/local/src/postgresql-8.3.3/src/test' から出ます [postgres@CentOS-5.2 postgresql-8.3.3]$ echo $? 0 [postgres@CentOS-5.2 postgresql-8.3.3]$
インストール
[postgres@CentOS-5.2 postgresql-8.3.3]$ su - パスワード: ********** [root@CentOS-5.2 ~]# cd /usr/local/src/postgresql-8.3.3/ [root@CentOS-5.2 postgresql-8.3.3]# make install : PostgreSQL installation complete. [root@CentOS-5.2 postgresql-8.3.3]# echo $? 0 [root@CentOS-5.2 postgresql-8.3.3]#
インストール完了♪
動作確認は・・・データベースの初期化とかあるから別のエントリで。