PostgreSQL 公式サイト から PostgreSQL のソースファイルをダウンロードしてインストールを行います。
PostgreSQL のインストールや PostgreSQL の実行には管理者権限を持たない一般ユーザーを使用する必要があるため、インストール前に PostgreSQL 専用ユーザーを作成します。
PostgreSQL のインストールと実行には Readline と Ncurses と zlib が必要です。
PostgreSQL 管理ユーザーの作成
PostgreSQL のインストールと実行は root 以外のユーザーで行う必要があります。
以下のように実行して PostgreSQL 専用の管理ユーザーを作成します。
# groupadd postgres
# useradd -g postgres postgres
# passwd postgres

# useradd -g postgres postgres

# passwd postgres

Changing password for user postgres.
New UNIX password: **********
新しく設定するパスワードを入力
Retype new UNIX password: **********
確認のためにもう一度パスワードを入力
passwd: all authentication tokens updated successfully.
New UNIX password: **********

Retype new UNIX password: **********

passwd: all authentication tokens updated successfully.
PostgreSQL のダウンロードとインストール
PostgreSQL のインストールと実行には Readline と Ncurses と zlib が必要です。
ソースファイルを使ったインストール方法は Readline のインストール と Ncurses のインストール と zlib のインストール を参照してください。
yum を使って Readline と Ncurses と zlib をインストールする場合は以下のように実行します。
# yum -y install readline-devel ncurses-devel zlib-devel

PostgreSQL のソースファイルを PostgreSQL 公式サイト からダウンロードして PostgreSQL 管理者権限を使ってコンパイル、インストールを行います。
# wget -P /usr/local/src ftp://ftp.jp.postgresql.org/source/v7.3.16/postgresql-7.3.16.tar.gz
# mkdir /usr/local/postgresql-7.3.16
# chown postgres:postgres /usr/local/postgresql-7.3.16
# cd /usr/local/src
# tar xzf postgresql-7.3.16.tar.gz
# chown -R postgres:postgres /usr/local/src/postgresql-7.3.16
# su - postgres
$ cd /usr/local/src/postgresql-7.3.16
$ ./configure --prefix=/usr/local/postgresql-7.3.16
$ make
$ make install
$ exit

# mkdir /usr/local/postgresql-7.3.16

# chown postgres:postgres /usr/local/postgresql-7.3.16

# cd /usr/local/src

# tar xzf postgresql-7.3.16.tar.gz

# chown -R postgres:postgres /usr/local/src/postgresql-7.3.16

# su - postgres

$ cd /usr/local/src/postgresql-7.3.16

$ ./configure --prefix=/usr/local/postgresql-7.3.16

$ make

$ make install

$ exit

— configure オプションの解説
- インストール先のディレクトリを設定します。
- –prefix=/usr/local/postgresql-7.3.16
PostgreSQL のディレクトリを /usr/local/pgsql としてアクセスできるようにシンボリックリンクを作成します。
# ln -sfn /usr/local/postgresql-7.3.16 /usr/local/pgsql
