Instalação PostgreSQL 10 em CentOS 7

Esta instalação é feita com o repositório do PostgreSQL, que é a forma mais prática de instalação hoje. Na página https://yum.postgresql.org/ podem ser encontrados os arquivos de repositório para várias as principais distribuições Linux, e para várias versões do PostgreSQL.

[ricardo@nerv11 ~]$ sudo yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
[sudo] password for ricardo:
Loaded plugins: fastestmirror
pgdg-centos10-10-2.noarch.rpm                                                                                                                    | 4.6 kB  00:00:00
Examining /var/tmp/yum-root-JHWeSk/pgdg-centos10-10-2.noarch.rpm: pgdg-centos10-10-2.noarch
Marking /var/tmp/yum-root-JHWeSk/pgdg-centos10-10-2.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-centos10.noarch 0:10-2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                  Arch                              Version                         Repository                                             Size
========================================================================================================================================================================
Installing:
 pgdg-centos10                            noarch                            10-2                            /pgdg-centos10-10-2.noarch                            2.7 k

Transaction Summary
========================================================================================================================================================================
Install  1 Package

Total size: 2.7 k
Installed size: 2.7 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pgdg-centos10-10-2.noarch                                                                                                                            1/1
  Verifying  : pgdg-centos10-10-2.noarch                                                                                                                            1/1

Installed:
  pgdg-centos10.noarch 0:10-2

Complete!
[ricardo@nerv11 ~]$ sudo yum -y install postgresql10 postgresql10-devel postgresql10-contrib postgresql10-libs postgresql10-test postgresql10-server postgresql10-docs
[sudo] password for ricardo:
Loaded plugins: fastestmirror
base                                                                                                                                             | 3.6 kB  00:00:00
epel/x86_64/metalink                                                                                                                             | 2.9 kB  00:00:00
epel                                                                                                                                             | 4.7 kB  00:00:00
extras                                                                                                                                           | 3.4 kB  00:00:00
pgdg10                                                                                                                                           | 4.1 kB  00:00:00
updates                                                                                                                                          | 3.4 kB  00:00:00
(1/4): pgdg10/7/x86_64/group_gz                                                                                                                  |  245 B  00:00:02
(2/4): pgdg10/7/x86_64/primary_db                                                                                                                | 153 kB  00:00:05
(3/4): epel/x86_64/updateinfo                                                                                                                    | 878 kB  00:00:07
(4/4): epel/x86_64/primary_db                                                                                                                    | 6.2 MB  00:00:22
Loading mirror speeds from cached hostfile
 * base: centos.brnet.net.br
 * epel: mirror.upb.edu.co
 * extras: centos.brnet.net.br
 * updates: centos.brnet.net.br
Resolving Dependencies
--> Running transaction check
---> Package postgresql10.x86_64 0:10.1-1PGDG.rhel7 will be installed
--> Processing Dependency: libicu for package: postgresql10-10.1-1PGDG.rhel7.x86_64
---> Package postgresql10-contrib.x86_64 0:10.1-1PGDG.rhel7 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: postgresql10-contrib-10.1-1PGDG.rhel7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: postgresql10-contrib-10.1-1PGDG.rhel7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: postgresql10-contrib-10.1-1PGDG.rhel7.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: postgresql10-contrib-10.1-1PGDG.rhel7.x86_64
---> Package postgresql10-devel.x86_64 0:10.1-1PGDG.rhel7 will be installed
--> Processing Dependency: libicu-devel for package: postgresql10-devel-10.1-1PGDG.rhel7.x86_64
---> Package postgresql10-docs.x86_64 0:10.1-1PGDG.rhel7 will be installed
---> Package postgresql10-libs.x86_64 0:10.1-1PGDG.rhel7 will be installed
---> Package postgresql10-server.x86_64 0:10.1-1PGDG.rhel7 will be installed
---> Package postgresql10-test.x86_64 0:10.1-1PGDG.rhel7 will be installed
--> Running transaction check
---> Package libicu.x86_64 0:50.1.2-15.el7 will be installed
---> Package libicu-devel.x86_64 0:50.1.2-15.el7 will be installed
---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                         Arch                              Version                                      Repository                         Size
========================================================================================================================================================================
Installing:
 postgresql10                                    x86_64                            10.1-1PGDG.rhel7                             pgdg10                            1.5 M
 postgresql10-contrib                            x86_64                            10.1-1PGDG.rhel7                             pgdg10                            587 k
 postgresql10-devel                              x86_64                            10.1-1PGDG.rhel7                             pgdg10                            2.0 M
 postgresql10-docs                               x86_64                            10.1-1PGDG.rhel7                             pgdg10                             14 M
 postgresql10-libs                               x86_64                            10.1-1PGDG.rhel7                             pgdg10                            347 k
 postgresql10-server                             x86_64                            10.1-1PGDG.rhel7                             pgdg10                            4.3 M
 postgresql10-test                               x86_64                            10.1-1PGDG.rhel7                             pgdg10                            1.6 M
Installing for dependencies:
 libicu                                          x86_64                            50.1.2-15.el7                                base                              6.9 M
 libicu-devel                                    x86_64                            50.1.2-15.el7                                base                              702 k
 libxslt                                         x86_64                            1.1.28-5.el7                                 base                              242 k

Transaction Summary
========================================================================================================================================================================
Install  7 Packages (+3 Dependent packages)

Total download size: 32 M
Installed size: 119 M
Downloading packages:
(1/10): libicu-devel-50.1.2-15.el7.x86_64.rpm                                                                                                    | 702 kB  00:00:02
(2/10): libxslt-1.1.28-5.el7.x86_64.rpm                                                                                                          | 242 kB  00:00:02
(3/10): libicu-50.1.2-15.el7.x86_64.rpm                                                                                                          | 6.9 MB  00:00:04
(4/10): postgresql10-contrib-10.1-1PGDG.rhel7.x86_64.rpm                                                                                         | 587 kB  00:00:05
(5/10): postgresql10-10.1-1PGDG.rhel7.x86_64.rpm                                                                                                 | 1.5 MB  00:00:23
(6/10): postgresql10-devel-10.1-1PGDG.rhel7.x86_64.rpm                                                                                           | 2.0 MB  00:00:44
(7/10): postgresql10-libs-10.1-1PGDG.rhel7.x86_64.rpm                                                                                            | 347 kB  00:00:05
(8/10): postgresql10-server-10.1-1PGDG.rhel7.x86_64.rpm                                                                                          | 4.3 MB  00:01:30
(9/10): postgresql10-test-10.1-1PGDG.rhel7.x86_64.rpm                                                                                            | 1.6 MB  00:00:44
(10/10): postgresql10-docs-10.1-1PGDG.rhel7.x86_64.rpm                                                                                           |  14 MB  00:04:43
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   106 kB/s |  32 MB  00:05:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : postgresql10-libs-10.1-1PGDG.rhel7.x86_64                                                                                                           1/10
  Installing : libicu-50.1.2-15.el7.x86_64                                                                                                                         2/10
  Installing : postgresql10-10.1-1PGDG.rhel7.x86_64                                                                                                                3/10
  Installing : postgresql10-server-10.1-1PGDG.rhel7.x86_64                                                                                                         4/10
  Installing : libicu-devel-50.1.2-15.el7.x86_64                                                                                                                   5/10
  Installing : postgresql10-devel-10.1-1PGDG.rhel7.x86_64                                                                                                          6/10
  Installing : libxslt-1.1.28-5.el7.x86_64                                                                                                                         7/10
  Installing : postgresql10-contrib-10.1-1PGDG.rhel7.x86_64                                                                                                        8/10
  Installing : postgresql10-test-10.1-1PGDG.rhel7.x86_64                                                                                                           9/10
  Installing : postgresql10-docs-10.1-1PGDG.rhel7.x86_64                                                                                                          10/10
  Verifying  : postgresql10-server-10.1-1PGDG.rhel7.x86_64                                                                                                         1/10
  Verifying  : postgresql10-libs-10.1-1PGDG.rhel7.x86_64                                                                                                           2/10
  Verifying  : postgresql10-devel-10.1-1PGDG.rhel7.x86_64                                                                                                          3/10
  Verifying  : postgresql10-contrib-10.1-1PGDG.rhel7.x86_64                                                                                                        4/10
  Verifying  : postgresql10-docs-10.1-1PGDG.rhel7.x86_64                                                                                                           5/10
  Verifying  : libicu-devel-50.1.2-15.el7.x86_64                                                                                                                   6/10
  Verifying  : libicu-50.1.2-15.el7.x86_64                                                                                                                         7/10
  Verifying  : libxslt-1.1.28-5.el7.x86_64                                                                                                                         8/10
  Verifying  : postgresql10-test-10.1-1PGDG.rhel7.x86_64                                                                                                           9/10
  Verifying  : postgresql10-10.1-1PGDG.rhel7.x86_64                                                                                                               10/10

Installed:
  postgresql10.x86_64 0:10.1-1PGDG.rhel7                postgresql10-contrib.x86_64 0:10.1-1PGDG.rhel7           postgresql10-devel.x86_64 0:10.1-1PGDG.rhel7
  postgresql10-docs.x86_64 0:10.1-1PGDG.rhel7           postgresql10-libs.x86_64 0:10.1-1PGDG.rhel7              postgresql10-server.x86_64 0:10.1-1PGDG.rhel7
  postgresql10-test.x86_64 0:10.1-1PGDG.rhel7

Dependency Installed:
  libicu.x86_64 0:50.1.2-15.el7                        libicu-devel.x86_64 0:50.1.2-15.el7                        libxslt.x86_64 0:1.1.28-5.el7

Complete!
[ricardo@nerv11 ~]$ sudo systemctl enable postgresql-10
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-10.service to /usr/lib/systemd/system/postgresql-10.service.
[ricardo@nerv11 ~]$ sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
Initializing database ... OK

[ricardo@nerv11 ~]$ sudo systemctl start postgresql-10
[ricardo@nerv11 ~]$ sudo systemctl status postgresql-10
● postgresql-10.service - PostgreSQL 10 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2018-01-29 16:02:24 -02; 10s ago
     Docs: https://www.postgresql.org/docs/10/static/
  Process: 17382 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 17389 (postmaster)
   CGroup: /system.slice/postgresql-10.service
           ├─17389 /usr/pgsql-10/bin/postmaster -D /var/lib/pgsql/10/data/
           ├─17390 postgres: logger process
           ├─17392 postgres: checkpointer process
           ├─17393 postgres: writer process
           ├─17394 postgres: wal writer process
           ├─17395 postgres: autovacuum launcher process
           ├─17396 postgres: stats collector process
           └─17397 postgres: bgworker: logical replication launcher

Jan 29 16:02:23 nerv11.localdomain systemd[1]: Starting PostgreSQL 10 database server...
Jan 29 16:02:24 nerv11.localdomain postmaster[17389]: 2018-01-29 16:02:24.418 -02 [17389] LOG:  listening on IPv6 address "::1", port 5432
Jan 29 16:02:24 nerv11.localdomain postmaster[17389]: 2018-01-29 16:02:24.418 -02 [17389] LOG:  listening on IPv4 address "127.0.0.1", port 5432
Jan 29 16:02:24 nerv11.localdomain postmaster[17389]: 2018-01-29 16:02:24.464 -02 [17389] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Jan 29 16:02:24 nerv11.localdomain postmaster[17389]: 2018-01-29 16:02:24.552 -02 [17389] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
Jan 29 16:02:24 nerv11.localdomain postmaster[17389]: 2018-01-29 16:02:24.649 -02 [17389] LOG:  redirecting log output to logging collector process
Jan 29 16:02:24 nerv11.localdomain postmaster[17389]: 2018-01-29 16:02:24.649 -02 [17389] HINT:  Future log output will appear in directory "log".
Jan 29 16:02:24 nerv11.localdomain systemd[1]: Started PostgreSQL 10 database server.
[ricardo@nerv11 ~]$ sudo su - postgres
-bash-4.2$ psql
psql (10.1)
Type "help" for help.

postgres=# \q
-bash-4.2$

6 comments

    1. Desculpe, não tenho. 🙁
      E o nome correto é “PostgreSQL”, e não “postgree”. Não verdade nunca entendi este “e” a mais no final, que vejo tanto, mesmo nãos sendo o correto. É como escrever Oraclee.

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

This site uses Akismet to reduce spam. Learn how your comment data is processed.