#freeze
''目次''
#contents
~
----

*目的 [#h95d65fe]

*参考サイト [#sa36d737]

*準備 [#q836aaaf]
-readline~
configureの途中で怒られるので下記にてインストールしておく。
 # yum install readline-devel
-PostgreSQL -- http://www.postgresql.jp/~
ソース:postgresql-9.2.2.tar.gz
*インストール [#ta6f50f8]
+''ソースの取得''
 # wget -P /usr/local/src http://ftp.postgresql.org/pub/source/v9.2.2/postgresql-9.2.2.tar.gz
~
+''ソースの解凍''
 # cd /usr/local/src
 # tar zxvf postgresql-9.2.2.tar.gz
~
+''ユーザーの作成''~
インストール作業をrootアカウントで行ってはならず、あらかじめ、PostgreSQLの管理者グループと管理者アカウントを作成し、その権限でインストールからデータベースの初期化処理までを行う。~
~
++ユーザーの作成
 # groupadd postgres
 # useradd -g postgres postgres
 # passwd postgres
++ソースディレクトリの権限設定
 # chown -R postgres:postgres /usr/local/src/postgresql-9.2.2
++インストール先のフォルダを前以って作成
 # mkdir /usr/local/postgresql-9.2.2
 # chown -R postgres:postgres /usr/local/postgresql-9.2.2
~
+''ログオンユーザー切り替え''
 # su - postgres
+''コンパイル設定''~
[[configureのヘルプ>PostgreSQL-9.2.2のconfigureヘルプ]]
 $ cd /usr/local/src/postgresql-9.2.2
 $ ./configure \
 > --prefix=/usr/local/postgresql-9.2.2 \
 > --enable-nls=ja \
 > --with-openssl
readlineが無い場合下記が表示される
 (省略)
 checking for -lreadline... no
 checking for -ledit... no
 configure: error: readline library not found
 If you have readline already installed, see config.log for details on the
 failure.  It is possible the compiler isn't looking in the proper directory.
 Use --without-readline to disable readline support.
+''インストール''
 $ make
 $ make install
 $ exit
+''シンボリックリンクの作成''
 # ln -s /usr/local/postgresql-9.2.2 /usr/local/pgsql
 # chown -R postgres:postgres /usr/local/pgsql

*環境変数の設定 [#fc6138c3]
+下記を追加する
 # su - postgres
 $ vi ~/.bash_profile
 
 PGHOME=/usr/local/pgsql
 PGDATA=$PGHOME/data
 PGLIB=$PGHOME/lib
 PATH=$PATH:$PGHOME/bin 
 export PGHOME PGDATA PGLIB
~
+変更の適用
 $ source ~/.bash_profile

*データベースの初期化 [#kb14dc98]
 $  initdb --encoding=EUC_JP --no-locale --pgdata=/usr/local/pgsql/data

*自動起動設定 [#d8652e56]
-''起動スクリプトのコピー''
 # cp /usr/local/src/postgresql-9.2.2/contrib/start-scripts/linux /etc/rc.d/init.d/pgsql

-''起動スクリプトの編集''~
[[デフォルト起動スクリプト>デフォルト起動スクリプト PostgreSQL 9.2.2]]
 # vi /etc/rc.d/init.d/pgsql
 
-''実行権限を与えて自動起動設定''
 # chmod 755 /etc/rc.d/init.d/pgsql
 # chkconfig --add pgsql
 # chkconfig pgsql on
 # chkconfig --list pgsql
 pgsql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

*他 [#r6588983]
-ライブラリのパス指定
 # vi /etc/ld.so.conf
 /usr/local/pgsql/lib      ← 追加して保存
 
 # ldconfig                ← 変更の適用

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS