微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

【PostgreSQL】部署YUM

[root@wallet01 ~]# wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm --no-check-certificate
[root@wallet01 ~]# rpm -ivh pgdg-centos96-9.6-3.noarch.rpm

[root@wallet01 ~]# useradd postgres
[root@king01 ~]# id postgres
uid=501(postgres) gid=501(postgres) groups=501(postgres)

[root@wallet01 ~]# yum install -y postgresql96-server.x86_64 postgresql96-contrib.x86_64
[root@wallet01 ~]# service postgresql-9.6 initdb
Initializing database:                                     [  OK  ]

[root@wallet01 ~]# vi /var/lib/pgsql/9.6/data/postgresql.conf
listen_addresses = '0.0.0.0'
port = 5432 

shared_buffers = 128MB
work_mem = 4MB 

[root@wallet01 ~]# service postgresql-9.6 start
Starting postgresql-9.6 service:                           [  OK  ]

[root@wallet01 ~]# service postgresql-9.6 status
postgresql-9.6 (pid  2146) is running...

[root@wallet01 ~]# netstat -tunlp | grep postmaster
tcp        0      0 0.0.0.0:5432        0.0.0.0:*        LISTEN      2414/postmaster

[root@wallet01 ~]# vi /etc/profile
PATH=$PATH:/usr/pgsql-9.6/bin

[postgres@wallet01 ~]$ psql
psql (9.6.12)
Type "help" for help.
postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(3 rows)


版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐