■FEDORA COREにPostgresqlをインストールする
#yum –y install postgresql-server
#yum clean packages
インストールはこれだけでオーケー。このあとがかなり大変。
# /etc/rc.d/init.d/postgresql start ← データベース起動
# /etc/rc.d/init.d/postgresql restart ← 再起動する場合
# chkconfig postgresql on ← 自動起動の設定
# chkconfig --list postgresql
postgresql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ランレベルで2~5のonを確認する
■データベースの管理ユーザ(postgres)パスワード設定
※管理ユーザ(postgres)はPostgreSQLのインストールにより作成されるので、LINUXからは作成の必要なし。
Linux上のpostgresユーザにパスワードを設定
# passwd postgres ← postgresユーザにパスワード設定
Changing password for user postgres.
New password: ← パスワード入力
Retype new password: ← パスワード確認
passwd: all authentication tokens updated successfully.
PostgreSQL上のpostgresユーザにパスワードを設定
# su - postgres ← postgresユーザになる
-bash-3.00$ psql template1 ← psqlコマンドでPostgreSQLに接続
Welcome to psql 7.4.11, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
template1=# alter user postgres with password 'パスワード'; ← PostgreSQL上のpostgresユーザにパスワード設定
ALTER USER ← パスワード変更オーケー
template1=# \q ← psqlコマンド終了
※独自のユーザーを作成するというあたりに戸惑いますが、それさえ理解すれば大丈夫。