目次



目的

参考サイト

準備

インストール

  1. ソースの取得
    # wget -P /usr/local/src http://www.ring.gr.jp/pub/misc/db/postgresql/source/v8.3.7/postgresql-8.3.7.tar.gz

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

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

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

  4. ログオンユーザー切り替え
    # su - postgres
  5. コンパイル設定
    configureのヘルプ
    $ cd /usr/local/src/postgresql-8.3.7
    $ ./configure \
    > --prefix=/usr/local/postgresql-8.3.7 \
    > --enable-nls=ja \
    > --with-openssl \
    > --without-docdir
    1. 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-8.3.7 /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:$HOME/bin:$PGHOME/bin 
    export PGHOME PGDATA PGLIB PATH

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

データベースの初期化

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

自動起動設定

Trac用の設定

PostgreSQLコマンドヘルプ

  1. ユーザーの作成
    # su - postgres
    $ createuser -S -D -R tracuser

  2. Tracプロジェクト用DBの作成
    $ createdb -O tracuser trac_hoge-project --encoding=utf8

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