PostgreSQL 9.4.1 インストール
PostgreSQLインストールメモ(バージョン 9.4.1)
最新バージョンの9.4.1をインストールする。
環境 バージョン
CentOS 7.0
# cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core)
1.環境準備
1.1.make
# gmake -version GNU Make 3.82
1.2.gcc
# gcc -v gcc バージョン 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC)
1.3. Readline
# yum install readline パッケージ readline-6.2-9.el7.x86_64 はインストール済みか最新バージョンです 何もしません # yum install readline-devel パッケージ readline-devel-6.2-9.el7.x86_64 はインストール済みか最新バージョンで す 何もしません
1.4. zlib
# yum install zlib パッケージ zlib-1.2.7-13.el7.x86_64 はインストール済みか最新バージョンです 何もしません # yum install zlib-devel パッケージ zlib-devel-1.2.7-13.el7.x86_64 はインストール済みか最新バージョンです 何もしません
2.PostgreSQLインストール
2.1.postgresユーザ作成
# useradd postgres
2.2.ソースの入手と解凍
# cd /usr/local/src/ # wget https://ftp.postgresql.org/pub/source/v9.4.1/postgresql-9.4.1.tar.gz # tar xvzf postgresql-9.4.1.tar.gz # chown -R postgres:postgres postgresql-9.4.1
2.3.コンパイル
# su - postgres $ $ cd /usr/local/src/postgresql-9.4.1/ $ ./configure $ gmake world ※ (省略) PostgreSQL, contrib, and documentation successfully made. Ready to install.
※ドキュメント(HTMLやman)や追加モジュール(contrib)を含め、構築可能なもの全てを構築したい場合、上記の様にworldを付与して実行
2.4.リグレーションテスト
$ gmake check (省略) ======================= All 145 tests passed. ======================= (省略)
2.5.インストール
$ su # gmake install-world (省略) PostgreSQL, contrib, and documentation installation complete.
2.6.インストールディレクトリの所有者変更
# cd /usr/local/ # chown -R postgres:postgres pgsql/
2.7.postgresユーザの環境変数設定
# su - postgres $ vi .bash_profile (下記を設定) # PostgreSQL PATH export POSTGRES_HOME=/usr/local/pgsql export PGDATA=/home/postgres/data export PATH=$PATH:$POSTGRES_HOME/bin export PGLIB=/usr/local/pgsql/lib export MANPATH="$MANPATH":$POSTGRES_HOME/man
2.7.postgresユーザの環境変数設定読み込み
$ source .bash_profile
2.8.データベースクラスタの作成
$ initdb -E UTF8 --no-locale
2.9.ログディレクトリの作成
$ mkdir -p /home/postgres/data/pg_log
2.10.ログ出力設定
# ログのみ出力(その他の設定は省略)
$ vi /home/postgres/data/postgresql.conf #logging_collector = off # Enable capturing of stderr and csvlog logging_collector = on
2.10.PostgreSQL起動
$ pg_ctl start server starting -bash-4.2$ LOG: redirecting log output to logging collector process HINT: Future log output will appear in directory "pg_log".
これでPostgreSQL9.4の新機能を試すことができる。
以上