目次



目的

参考サイト

準備

インストール

  1. ソースの取得
    # wget -P /usr/local/src http://ftp.postgresql.org/pub/source/v9.2.2/postgresql-9.2.2.tar.gz

  2. ソースの解凍
    # cd /usr/local/src
    # tar zxvf postgresql-9.2.2.tar.gz

  3. ユーザーの作成
    インストール作業をrootアカウントで行ってはならず、あらかじめ、PostgreSQLの管理者グループと管理者アカウントを作成し、その権限でインストールからデータベースの初期化処理までを行う。

    1. ユーザーの作成
      # groupadd postgres
      # useradd -g postgres postgres
      # passwd postgres
    2. ソースディレクトリの権限設定
      # chown -R postgres:postgres /usr/local/src/postgresql-9.2.2
    3. インストール先のフォルダを前以って作成
      # mkdir /usr/local/postgresql-9.2.2
      # chown -R postgres:postgres /usr/local/postgresql-9.2.2

  4. ログオンユーザー切り替え
    # su - postgres
  5. コンパイル設定
    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.
  6. インストール
    $ make
    $ make install
    $ exit
  7. シンボリックリンクの作成
    # ln -s /usr/local/postgresql-9.2.2 /usr/local/pgsql
    # chown -R postgres:postgres /usr/local/pgsql

環境変数の設定

  1. 下記を追加する
    # su - postgres
    $ vi ~/.bash_profile
    
    PGHOME=/usr/local/pgsql
    PGDATA=$PGHOME/data
    PGLIB=$PGHOME/lib
    PATH=$PATH:$PGHOME/bin 
    export PGHOME PGDATA PGLIB

  2. 変更の適用
    $ source ~/.bash_profile

データベースの初期化

$  initdb --encoding=EUC_JP --no-locale --pgdata=/usr/local/pgsql/data

自動起動設定


トップ   編集 凍結解除 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-05-10 (水) 20:53:53