LoginSignup
0
0

More than 5 years have passed since last update.

centos6.6にpostgresql9.4をインストールして、heidisqlなどのクライアントツールから接続できるようにする

Last updated at Posted at 2015-07-03

ルートになる。

sudo -i

pgdgをインストールする。

yum localinstall http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm

postgresql9.4をインストールする。

yum install postgresql94-server

サーバを起動する前に、初期化を行う。

/etc/init.d/postgresql-9.4 initdb

クライアントツール(heidisql)からpostgresに接続できるように設定を一部変更する。

vi /var/lib/pgsql/9.4/data/pg_hba.conf

として

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident

を下記の通り修正する。

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

postgressql9.4を起動する。

/etc/init.d/postgresql-9.4 start

postgresユーザに切り替わる

sudo su - postgres

psql
CREATE ROLE staff WITH LOGIN CREATEDB;
\q

createdb staff

これで一式作成完了。
sshでポート転送すれば、centos上のpostgresに、ローカルのheidiSqlよりアクセスできました。
(作業完了後にまとめて記録しているので、間違いがあったらすみません)

0
0
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
0
0