PerlさんPerlくん
[pgSQL] postgresql8.3.1 インストール
最終更新:
atwikimyj
-
view
postgresql8.3.1 インストール
postgreSQLを使用するためのアカウントpostgresを作成しておく。
CentOS5.1標準パッケージでは8.1.11で古い。 yumからアップグレードしようかと思ったが、依存関係がクリアにならず断念。 ということでソースからとってきてインストールすることに。 postgresql.orgからダウンロード http://wwwmaster.postgresql.org/download/mirrors-ftp?file=%2Fsource%2Fv8.3.1%2Fpostgresql-8.3.1.tar.gz
libxmlのインストール。 (libxmlとはpostgresqlでxmlファイルを扱える(パースしてくれる?)モジュール) # wget ftp://gd.tuwien.ac.at:21/pub/libxml/libxml2-2.6.31.tar.gz # tar xvzf libxml2-2.6.31.tar.gz # cd libxml2-2.6.31 # ./configure --prefix=/usr/local # make # make install
postgresql 8.3.1のソースをダウンロード、インストール # wget http://ftp2.jp.postgresql.org/pub/postgresql//source/v8.3.1/postgresql-8.3.1.tar.gz # tar xvzf postgresql-8.3.1.tar.gz # cd postgresql-8.3.1 # ./configure --with-libxml
このままやると readlineというモジュールがないと言われる。なのではずす
# ./configure --with-libxml --without-readline # gmake # gmake install
本番環境でも同様にpostgres8.3.1をインストール。
使用するデータベースを作成する。
以前のf4を参考にする。 というかもうない、、。
DBのユーザ:postgres psw:同じ
データベースクラスタ(データの保存場所)の作成: 最初はpostgresのアプリケーションは自分の データを保存する場所をしらないので教えてやる必要 がある。 ※下記のフォルダがない場合は作成する必要がある。 # mkdir /usr/local/pgsql/data # chown postgres /usr/local/pgsql/data # su -- postgres postgres$ initdb -D /usr/local/pgsql/data
pgSQL8.3.1をサービス化して、OS起動時に同時起動するようにする。 pgSQLのソースにそのためのスクリプトがあるのでそれを必要な設定ファイルに コピーします。 /usr/local/src/postgresql-8.3.1/contrib/start-scripts の下のlinuxというファイルを使用する。このファイルの中身の ## EDIT FROM HEREから ## STOP EDITING HEREまでの間の内容を適宜変えて から、下記のように/etc/init.d/コピーする。
# cd /usr/local/src/postgresql-8.3.1/contrib/start-scripts # cp linux /etc/init.d/postgresql 実行可能なパーミッションに変更 # chmod 755 /etc/init.d/postgresql
そして、OS起動時に同時にpgSQLが起動するように # chkconfig --add postgresql これで完了。
サービスに登録 # chkconfig --add postgresql
サービス開始 # service postgresql start