cenOSにpostgresql9.3をインストールする
いつ必要になるかわからないのでメモ。
1 rpmファイルを取得しておいておく。
使ったのは、pgdg-centos93-9.3-1.noarch.rpm
2 rpmインストール
rpm -ivh pgdg-centos93-9.3-1.noarch.rpm
3 yumでインストールするものを探す
yum search postgresql93
検索結果が一覧で出てくる。
(前略)
postgresql93-devel.x86_64 : PostgreSQL development header files and libraries
postgresql93-docs.x86_64 : Extra documentation for PostgreSQL
postgresql93-jdbc.x86_64 : JDBC driver for PostgreSQL
(後略)
4 必要なものをインストールする。
必要なのは、無印、-devel、-server(serverが一番重い。)
yum install postgresql93
yum install postgresql93-devel
yum install postgresql93-server
psqlクライアントは無印だけで動く。
5 環境変数を設定
echo $PATH
PATH=PATH=$PATH:/usr/pgsql-9.3/bin
echo $PATH
(多分これも、/etc/profileに追加したほうがいいんだろうなあ)
==
インストールはここまでだけど、
このままスタートするとエラーになる。
/etc/init.d/postgresql-9.3 start
/var/lib/pgsql/9.3/data is missing. Use "service postgresql-9.3 initdb" to initialize the cluster first.
まずは初期化しろとのこと。
メッセージに従って、初期化コマンド実行。
/etc/init.d/postgresql-9.3 initdb
Initializing database: [ OK ]
ということで、改めてサーバ起動
[root@localhost ~]# /etc/init.d/postgresql-9.3 start
Starting postgresql-9.3 service: [ OK ]
[root@localhost ~]# /etc/init.d/postgresql-9.3 status
postgresql-9.3 (pid 4305) is running...
動いてる!