Database JUNKY

MySQL,MariaDBを中心としたブログです

postgresqlをインストールしてみる。(CENTOS)

ちょっと、DB2から離れて、postgresqlCENTOSにインストールする方法をメモしておきます。

  1. rootにて以下のコマンドを実行 # yum -y install postgresql-server
  2. 上記にてインストールが完了したらpostgressqlを起動する # /etc/rc.d/init.d/postgresql start データベースを初期化中:                                    [  OK  ] postgresql サービスを開始中:                               [  OK  ]
  3. 自動起動設定を、"ON"にする # chkconfig postgresql on
  4. インストール時に、postgresのアカウントが自動的に作成されている。よって、パスワードだけ変更する。 # passwd postgres Changing password for user postgres. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully.
  5. postgres ユーザーに、suして、接続を試みる # su postgres bash-3.2$ psql template1 Welcome to psql 8.1.11, the PostgreSQL interactive terminal. Type:  \copyright for distribution terms        \h for help with SQL commands        \? for help with psql commands        \g or terminate with semicolon to execute query        \q to quit
  6. パスワードを、上記4と同じパスワードに設定する。(単純に忘れないため) template1=# alter user postgres with password '**********'; ALTER ROLE
  7. 以上で、一旦quitする。 template1=# \q bash-3.2$

うん、インストール楽々でした。。。