==> Below are the steps to install postgreSQL server.
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] Check postgreSQL package install or not.
[root@node1 ~]# rpm -qa | grep postgresql
[root@node1 ~]#
4] Install postgresql
package.
[root@node1 ~]# yum install postgresql-server
Loaded plugins: langpacks, ulninfo
ol7_UEKR5
| 1.2 kB 00:00:00
ol7_latest
| 1.4 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package postgresql-server.x86_64 0:9.2.24-1.el7_5
will be installed
--> Processing Dependency: postgresql-libs(x86-64) =
9.2.24-1.el7_5 for package: postgresql-server-9.2.24-1.el7_5.x86_64
--> Processing Dependency: postgresql(x86-64) =
9.2.24-1.el7_5 for package: postgresql-server-9.2.24-1.el7_5.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for
package: postgresql-server-9.2.24-1.el7_5.x86_64
--> Running transaction check
---> Package postgresql.x86_64 0:9.2.24-1.el7_5 will be
installed
---> Package postgresql-libs.x86_64 0:9.2.24-1.el7_5 will
be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
postgresql-server x86_64
9.2.24-1.el7_5
ol7_latest 3.8 M
Installing for dependencies:
postgresql x86_64 9.2.24-1.el7_5 ol7_latest 3.0 M
postgresql-libs x86_64 9.2.24-1.el7_5 ol7_latest 233 k
Transaction Summary
===============================================================================================
Install 1 Package (+2
Dependent packages)
Total download size: 7.1 M
Installed size: 33 M
Is this ok [y/d/N]: Y
Downloading packages:
warning:
/var/cache/yum/x86_64/7Server/ol7_latest/packages/postgresql-libs-9.2.24-1.el7_5.x86_64.rpm:
Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Public key for postgresql-libs-9.2.24-1.el7_5.x86_64.rpm is
not installed
(1/3): postgresql-libs-9.2.24-1.el7_5.x86_64.rpm | 233 kB 00:00:00
(2/3): postgresql-9.2.24-1.el7_5.x86_64.rpm | 3.0 MB 00:00:05
(3/3): postgresql-server-9.2.24-1.el7_5.x86_64.rpm | 3.8 MB 00:00:05
-----------------------------------------------------------------------------------------------
Total
1.1 MB/s | 7.1 MB 00:00:06
Retrieving key from
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Importing GPG key 0xEC551F03:
Userid : "Oracle OSS group (Open Source
Software group) <build@oss.oracle.com>"
Fingerprint: 4214
4123 fecf c55b 9086 313d 72f9 7b74 ec55 1f03
Package :
7:oraclelinux-release-7.6-1.0.15.el7.x86_64 (@anaconda/7.6)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Is this ok [y/N]: Y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing :
postgresql-libs-9.2.24-1.el7_5.x86_64 1/3
Installing :
postgresql-9.2.24-1.el7_5.x86_64 2/3
Installing :
postgresql-server-9.2.24-1.el7_5.x86_64 3/3
Verifying :
postgresql-server-9.2.24-1.el7_5.x86_64 1/3
Verifying : postgresql-libs-9.2.24-1.el7_5.x86_64 2/3
Verifying : postgresql-9.2.24-1.el7_5.x86_64 3/3
Installed:
postgresql-server.x86_64
0:9.2.24-1.el7_5
Dependency Installed:
postgresql.x86_64
0:9.2.24-1.el7_5 postgresql-libs.x86_64
0:9.2.24-1.el7_5
Complete!
5] Start and add
postgreSQL service.
[root@node1 ~]# postgresql-setup initdb
Initializing database ... OK
[root@node1 ~]# systemctl enable postgresql.service
Created symlink from
/etc/systemd/system/multi-user.target.wants/postgresql.service to /usr/lib/systemd/system/postgresql.service.
[root@node1 ~]# systemctl start postgresql.service
[root@node1 ~]#
6] Connect to
postgresql database.
[root@node1 ~]# sudo su - postgres
[postgres@node1 ~]$ psql
psql (9.2.24)
Type "help" for help.
postgres=#
postgres=# SELECT version();
version
-----------------------------------------------------------------------------------------------
--------------------
PostgreSQL 9.2.24 on
x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.
8.5-28.0.1), 64-bit
(1 row)
postgres=#
thank you so much
ReplyDelete