Sunday, 26 May 2019

Install postgreSQL 11 on cent OS 7.6


1] Create user postgres

[root@node1 ~]# adduser postgres
[root@node1 ~]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@node1 ~]#

2] Provide sudo access to postgres User.

3] Configure rpm repos for postgreSQL 11

[root@localhost ~]# yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Loaded plugins: langpacks, ulninfo
pgdg-redhat-repo-latest.noarch.rpm | 5.6 kB 00:00:00
Examining /var/tmp/yum-root-Qytr2V/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-4.noarch
Marking /var/tmp/yum-root-Qytr2V/pgdg-redhat-repo-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-4 will be installed
--> Finished Dependency Resolution
ol7_UEKR5/x86_64 | 1.2 kB 00:00:00
ol7_latest/x86_64 | 1.4 kB 00:00:00
ol7_latest/x86_64/updateinfo | 926 kB 00:00:00
ol7_latest/x86_64/primary | 14 MB 00:00:11
Dependencies Resolved
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
pgdg-redhat-repo noarch 42.0-4 /pgdg-redhat-repo-latest.noarch 6.8 k
Transaction Summary
===============================================================================================
Install 1 Package
Total size: 6.8 k
Installed size: 6.8 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : pgdg-redhat-repo-42.0-4.noarch 1/1
Verifying : pgdg-redhat-repo-42.0-4.noarch 1/1
Installed:
pgdg-redhat-repo.noarch 0:42.0-4
Complete!

[postgres@node1 yum.repos.d]$ cd /etc/yum.repos.d
[postgres@node1 yum.repos.d]$ pwd
/etc/yum.repos.d
[postgres@node1 yum.repos.d]$ ls -ltr pgdg-redhat-all.repo
-rw-r--r--. 1 root root 5189 Apr 17 09:42 pgdg-redhat-all.repo


4] Install postgreSQL 11 version using rpm package.

==> install postgresql client and server.

[root@node1 ~]# yum install postgresql11

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos-hcm.viettelidc.com.vn
* extras: centos-hn.viettelidc.com.vn
* updates: centos-hn.viettelidc.com.vn
Resolving Dependencies
--> Running transaction check
---> Package postgresql11.x86_64 0:11.3-1PGDG.rhel7 will be installed
--> Processing Dependency: postgresql11-libs(x86-64) = 11.3-1PGDG.rhel7 for package: postgresql11-11.3-1PGDG.rhel7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql11-11.3-1PGDG.rhel7.x86_64
--> Running transaction check
---> Package postgresql11-libs.x86_64 0:11.3-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
postgresql11 x86_64 11.3-1PGDG.rhel7 pgdg11 1.7 M
Installing for dependencies:
postgresql11-libs x86_64 11.3-1PGDG.rhel7 pgdg11 360 k
Transaction Summary
===============================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 2.0 M
Installed size: 10 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/pgdg11/packages/postgresql11-libs-11.3-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Public key for postgresql11-libs-11.3-1PGDG.rhel7.x86_64.rpm is not installed
(1/2): postgresql11-libs-11.3-1PGDG.rhel7.x86_64.rpm | 360 kB 00:00:03
(2/2): postgresql11-11.3-1PGDG.rhel7.x86_64.rpm | 1.7 MB 00:00:07
-----------------------------------------------------------------------------------------------
Total 262 kB/s | 2.0 MB 00:00:07
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsqlrpms-hackers@pgfoundry.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-4.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : postgresql11-libs-11.3-1PGDG.rhel7.x86_64 1/2
Installing : postgresql11-11.3-1PGDG.rhel7.x86_64 2/2
Verifying : postgresql11-11.3-1PGDG.rhel7.x86_64 1/2
Verifying : postgresql11-libs-11.3-1PGDG.rhel7.x86_64 2/2
Installed:
postgresql11.x86_64 0:11.3-1PGDG.rhel7
Dependency Installed:
postgresql11-libs.x86_64 0:11.3-1PGDG.rhel7
Complete!
[root@node1 ~]# yum install postgresql11-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos-hcm.viettelidc.com.vn
* extras: centos-hn.viettelidc.com.vn
* updates: centos-hn.viettelidc.com.vn
Resolving Dependencies
--> Running transaction check
---> Package postgresql11-server.x86_64 0:11.3-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
postgresql11-server x86_64 11.3-1PGDG.rhel7 pgdg11 4.7 M
Transaction Summary
===============================================================================================
Install 1 Package
Total download size: 4.7 M
Installed size: 19 M
Is this ok [y/d/N]: y
Downloading packages:
postgresql11-server-11.3-1PGDG.rhel7.x86_64.rpm | 4.7 MB 00:00:18
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : postgresql11-server-11.3-1PGDG.rhel7.x86_64 1/1
Verifying : postgresql11-server-11.3-1PGDG.rhel7.x86_64 1/1
Installed:
postgresql11-server.x86_64 0:11.3-1PGDG.rhel7
Complete!

5] Initialize the database and start database server.

[root@node1 ~]# /usr/pgsql-11/bin/postgresql-11-setup initdb

Initializing database ... OK

[root@node1 ~]# systemctl enable postgresql-11
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-11.service to /usr/lib/systemd/system/postgresql-11.service.

[root@node1 ~]# systemctl start postgresql-11


6] Connect to database

[root@node1 ~]# sudo su - postgres

[postgres@node1 ~]$ psql
psql (11.3)
Type "help" for help.
postgres=#
postgres=# select version();
version
-----------------------------------------------------------------------------------------------
----------
PostgreSQL 11.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36
), 64-bit
(1 row)
postgres=#

No comments:

Post a Comment

work on autovacuum postgreSQL parameter

 In This blog, we are discussing the auto vacuum parameter on a small scale. we will understand the below parameters and will see how to mod...