LoginSignup
2
2

More than 5 years have passed since last update.

yumでpostgresqlを設置する。

Last updated at Posted at 2016-02-09

この記事を見る方へ

  • この記事は備忘録で整理したものをmarkdownで再編集したものです。
  • 以前整理したものなので、バージョンが最新ではない可能性があります。

設置環境

  • vagrant上のcentos 6.4(6.xバージョンの場合は多分大丈夫。)
  • postgresql 9.3(新しいバージョンを設置する場合は最新rpmを使う。)

postgresqlのyumリポジトリを追加

    sudo rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
    Retrieving http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
    warning: /var/tmp/rpm-tmp.Wv4n6p: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
    Preparing...                ########################################### [100%]
      1:pgdg-centos93          ########################################### [100%]

    sudo yum update

yumでpostgresqlを設置する。

  • yumで提供されるパッケージを確認して次のものを設置する。
    yum list | grep -i --color postgresql

    postgresql93-server.x86_64                9.3.2-1PGDG.rhel6             @pgdg93 

    sudo yum install postgresql93-server.x86_64

データベースを初期化する。

  • initdbを実行する。
    [vagrant@pg2 ~]$ sudo service postgresql-9.3 initdb
    Initializing database:                                     [  OK  ]

サーバを起動する。

  • serviceでデーモンを起動する。
    [vagrant@pg2 ~]$ sudo service postgresql-9.3 start
    Starting postgresql-9.3 service:                           [  OK  ]

自動で起動されるように設定する。

    [vagrant@pg2 ~]$ sudo chkconfig postgresql-9.3 on
    [vagrant@pg2 ~]$ chkconfig --list
    crond            0:off  1:off  2:on  3:on  4:on  5:on  6:off
    ip6tables        0:off  1:off  2:on  3:on  4:on  5:on  6:off
    iptables         0:off  1:off  2:on  3:on  4:on  5:on  6:off
    multipathd       0:off  1:off  2:off  3:off  4:off  5:off  6:off
    netconsole       0:off  1:off  2:off  3:off  4:off  5:off  6:off
    netfs            0:off  1:off  2:off  3:on  4:on  5:on  6:off
    network          0:off  1:off  2:on  3:on  4:on  5:on  6:off
    nfs              0:off  1:off  2:off  3:off  4:off  5:off  6:off
    nfslock          0:off  1:off  2:off  3:on  4:on  5:on  6:off
    nginx            0:off  1:off  2:on  3:on  4:on  5:on  6:off
    postfix          0:off  1:off  2:off  3:off  4:off  5:off  6:off
    postgresql-9.3   0:off  1:off  2:on  3:on  4:on  5:on  6:off
    rdisc            0:off  1:off  2:off  3:off  4:off  5:off  6:off
    restorecond      0:off  1:off  2:off  3:off  4:off  5:off  6:off
    rpcbind          0:off  1:off  2:on  3:on  4:on  5:on  6:off
    rpcgssd          0:off  1:off  2:off  3:on  4:on  5:on  6:off
    rpcsvcgssd       0:off  1:off  2:off  3:off  4:off  5:off  6:off
    rsyslog          0:off  1:off  2:on  3:on  4:on  5:on  6:off
    saslauthd        0:off  1:off  2:off  3:off  4:off  5:off  6:off
    sshd             0:off  1:off  2:on  3:on  4:on  5:on  6:off
    svnserve         0:off  1:off  2:off  3:off  4:off  5:off  6:off
    udev-post        0:off  1:on  2:on  3:on  4:on  5:on  6:off
    vboxadd          0:off  1:off  2:on  3:on  4:on  5:on  6:off
    vboxadd-service  0:off  1:off  2:on  3:on  4:on  5:on  6:off
    vboxadd-x11      0:off  1:off  2:off  3:off  4:off  5:off  6:off
    [vagrant@pg2 ~]$ 

sudo権限付与

    gpasswd -a postgres wheel
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2