# wget http://yum.postgresql.org/9.1/redhat/rhel-5-i386/pgdg-centos91-9.1-4.noarch.rpm # rpm -ivh pgdg-centos91-9.1-4.noarch.rpm念のためyumのリストにあるか確認
# yum list | grep postgresqlんで、インストール
# yum install postgresql91-server.x86_64今のうちにシステム起動時に自動起動するように設定。
確認、設定、確認。OK。
# chkconfig --list | grep postgres # chkconfig postgresql-9.1 on # chkconfig --list | grep postgres postgresql-9.1 0:off 1:off 2:on 3:on 4:on 5:on 6:offデータベースを初期化。ここでデフォルトのエンコーディングを指定した方が無難。
あとlocaleもこの段階では指定しない方がいいと思われ。
service postgresql-9.1 initdb --no-locale -E UTF8サービスを起動。ここまでで一応インストール完了。
# service postgresql-9.1.2 startDB作成ユーザを追加します。必須ではないのですが作った方が管理はしやすいです。
# useradd dozaemonpostgresの管理者権限にsuして、postgres側にユーザを追加します。
# su - postres $ createuser dozaemon今作成したdozaemonで初期データベースを作成します。
$ exit # su - dozaemon $ createdb dozaemondb作成したデータベースを確認するよ。
$ psql -l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+---------+-------+----------------------- dozaemon | dozaemon | UTF8 | C | C | postgres | postgres | UTF8 | C | C | template0 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres (4 rows)でけた!
もしinitdbからやり直したい場合は、データベースデータを丸ごと消してしまえばいいっす。
自分の環境では /var/lib/pgsql/9.1/data/のdataフォルダ毎消しちゃいました。
#自己責任でお願いします。
0 件のコメント:
コメントを投稿