数据库
首页 > 数据库> > 【PostgreSQL】部署(YUM)

【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)


标签:en,PostgreSQL,postgres,wallet01,部署,YUM,postgresql,9.6,root
来源: https://blog.51cto.com/13598811/2371534