Installation of postgresql 12 on CentOS Linux release 7.6.1810 (Core) :#1

Installation of postgresql 12 on CentOS Linux release 7.6.1810 (Core) :



login as: hari
hari@127.0.0.1's password:
Last login: Sat Oct 12 14:11:57 2019 from gateway
[hari@localhost ~]$
[hari@localhost ~]$
[hari@localhost ~]$
[hari@localhost ~]$ yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Loaded plugins: fastestmirror, langpacks
You need to be root to perform this command.
[hari@localhost ~]$
[hari@localhost ~]$ sudo su
[sudo] password for hari:
[root@localhost hari]#
[root@localhost hari]#
[root@localhost hari]# yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Loaded plugins: fastestmirror, langpacks

pgdg-redhat-repo-latest.noarch.rpm                                                                 | 5.8 kB  00:00:00
Examining /var/tmp/yum-root-bAAWRF/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-5.noarch
Marking /var/tmp/yum-root-bAAWRF/pgdg-redhat-repo-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-5 will be installed
--> Finished Dependency Resolution
base/7/x86_64                                                                                      | 3.6 kB  00:00:00
base/7/x86_64/group_gz                                                                             | 165 kB  00:00:00
base/7/x86_64/primary_db                                                                           | 6.0 MB  00:00:02
enterprisedb-dependencies/7/x86_64                                                                 | 2.5 kB  00:00:00
enterprisedb-dependencies/7/x86_64/primary_db                                                      |  18 kB  00:00:00
enterprisedb-tools/7/x86_64                                                                        | 2.5 kB  00:00:00
enterprisedb-tools/7/x86_64/primary_db                                                             |  75 kB  00:00:00
extras/7/x86_64                                                                                    | 2.9 kB  00:00:00
extras/7/x86_64/primary_db                                                                         | 152 kB  00:00:00
updates/7/x86_64                                                                                   | 2.9 kB  00:00:00
updates/7/x86_64/primary_db                                                                        | 1.9 MB  00:00:00

Dependencies Resolved

==========================================================================================================================
 Package                       Arch                Version             Repository                                    Size
==========================================================================================================================
Installing:
 pgdg-redhat-repo              noarch              42.0-5              /pgdg-redhat-repo-latest.noarch              7.5 k

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

Total size: 7.5 k
Installed size: 7.5 k
Is this ok [y/d/N]: Exiting on user command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx.2019-10-12.14-41.UW6y0S.yumtx
[root@localhost hari]#
[root@localhost hari]# yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm -y
Loaded plugins: fastestmirror, langpacks
pgdg-redhat-repo-latest.noarch.rpm                                                                 | 5.8 kB  00:00:00
Examining /var/tmp/yum-root-bAAWRF/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-5.noarch
Marking /var/tmp/yum-root-bAAWRF/pgdg-redhat-repo-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
 Package                       Arch                Version             Repository                                    Size
==========================================================================================================================
Installing:
 pgdg-redhat-repo              noarch              42.0-5              /pgdg-redhat-repo-latest.noarch              7.5 k

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

Total size: 7.5 k
Installed size: 7.5 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pgdg-redhat-repo-42.0-5.noarch                                                                         1/1
  Verifying  : pgdg-redhat-repo-42.0-5.noarch                                                                         1/1

Installed:
  pgdg-redhat-repo.noarch 0:42.0-5

Complete!
[root@localhost hari]#
[root@localhost hari]#
[root@localhost hari]# shutdown^C
[root@localhost hari]# ps -ef|grep post
root      1511     1  0 14:34 ?        00:00:00 /usr/libexec/postfix/master -w
postfix   1558  1511  0 14:34 ?        00:00:00 pickup -l -t unix -u
postfix   1559  1511  0 14:34 ?        00:00:00 qmgr -l -t unix -u
root      2326  2265  0 14:42 pts/0    00:00:00 grep --color=auto post
[root@localhost hari]#
[root@localhost hari]# yum install postgresql12
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: mirrors.piconets.webwerks.in
 * extras: mirrors.piconets.webwerks.in
 * updates: mirrors.piconets.webwerks.in
pgdg10                                                                                             | 3.6 kB  00:00:00
pgdg11                                                                                             | 3.6 kB  00:00:00
pgdg12                                                                                             | 3.6 kB  00:00:00
pgdg94                                                                                             | 3.6 kB  00:00:00
pgdg95                                                                                             | 3.6 kB  00:00:00
pgdg96                                                                                             | 3.6 kB  00:00:00
(1/12): pgdg10/7/x86_64/group_gz                                                                   |  245 B  00:00:02
(2/12): pgdg12/7/x86_64/primary_db                                                                 |  88 kB  00:00:00
(3/12): pgdg94/7/x86_64/group_gz                                                                   |  247 B  00:00:00
(4/12): pgdg94/7/x86_64/primary_db                                                                 | 357 kB  00:00:00
(5/12): pgdg95/7/x86_64/group_gz                                                                   |  249 B  00:00:00
(6/12): pgdg11/7/x86_64/group_gz                                                                   |  245 B  00:00:04
(7/12): pgdg95/7/x86_64/primary_db                                                                 | 375 kB  00:00:00
(8/12): pgdg12/7/x86_64/group_gz                                                                   |  245 B  00:00:04
(9/12): pgdg96/7/x86_64/group_gz                                                                   |  249 B  00:00:00
(10/12): pgdg96/7/x86_64/primary_db                                                                | 386 kB  00:00:00
(11/12): pgdg10/7/x86_64/primary_db                                                                | 377 kB  00:00:05
(12/12): pgdg11/7/x86_64/primary_db                                                                | 330 kB  00:00:05
Resolving Dependencies
--> Running transaction check
---> Package postgresql12.x86_64 0:12.0-1PGDG.rhel7 will be installed
--> Processing Dependency: postgresql12-libs(x86-64) = 12.0-1PGDG.rhel7 for package: postgresql12-12.0-1PGDG.rhel7.x86_64
--> Processing Dependency: python36-libs for package: postgresql12-12.0-1PGDG.rhel7.x86_64
--> Running transaction check
---> Package postgresql12-libs.x86_64 0:12.0-1PGDG.rhel7 will be installed
---> Package python3-libs.x86_64 0:3.6.8-10.el7 will be installed
--> Processing Dependency: python(abi) = 3.6 for package: python3-libs-3.6.8-10.el7.x86_64
--> Running transaction check
---> Package python3.x86_64 0:3.6.8-10.el7 will be installed
--> Processing Dependency: python3-setuptools for package: python3-3.6.8-10.el7.x86_64
--> Processing Dependency: python3-pip for package: python3-3.6.8-10.el7.x86_64
--> Running transaction check
---> Package python3-pip.noarch 0:9.0.3-5.el7 will be installed
---> Package python3-setuptools.noarch 0:39.2.0-10.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
 Package                            Arch                   Version                           Repository              Size
==========================================================================================================================
Installing:
 postgresql12                       x86_64                 12.0-1PGDG.rhel7                  pgdg12                 1.5 M
Installing for dependencies:
 postgresql12-libs                  x86_64                 12.0-1PGDG.rhel7                  pgdg12                 367 k
 python3                            x86_64                 3.6.8-10.el7                      base                    69 k
 python3-libs                       x86_64                 3.6.8-10.el7                      base                   7.0 M
 python3-pip                        noarch                 9.0.3-5.el7                       base                   1.8 M
 python3-setuptools                 noarch                 39.2.0-10.el7                     base                   629 k

Transaction Summary
==========================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 11 M
Installed size: 57 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): python3-3.6.8-10.el7.x86_64.rpm                                                             |  69 kB  00:00:01
(2/6): python3-setuptools-39.2.0-10.el7.noarch.rpm                                                 | 629 kB  00:00:00
(3/6): python3-pip-9.0.3-5.el7.noarch.rpm                                                          | 1.8 MB  00:00:02
warning: /var/cache/yum/x86_64/7/pgdg12/packages/postgresql12-libs-12.0-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Public key for postgresql12-libs-12.0-1PGDG.rhel7.x86_64.rpm is not installed
(4/6): postgresql12-libs-12.0-1PGDG.rhel7.x86_64.rpm                                               | 367 kB  00:00:04
(5/6): postgresql12-12.0-1PGDG.rhel7.x86_64.rpm                                                    | 1.5 MB  00:00:06
(6/6): python3-libs-3.6.8-10.el7.x86_64.rpm                                                        | 7.0 MB  00:00:13
--------------------------------------------------------------------------------------------------------------------------
Total                                                                                     826 kB/s |  11 MB  00:00:13
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-5.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 : python3-pip-9.0.3-5.el7.noarch                                                                         1/6
  Installing : python3-setuptools-39.2.0-10.el7.noarch                                                                2/6
  Installing : python3-3.6.8-10.el7.x86_64                                                                            3/6
  Installing : python3-libs-3.6.8-10.el7.x86_64                                                                       4/6
  Installing : postgresql12-libs-12.0-1PGDG.rhel7.x86_64                                                              5/6
  Installing : postgresql12-12.0-1PGDG.rhel7.x86_64                                                                   6/6
  Verifying  : postgresql12-12.0-1PGDG.rhel7.x86_64                                                                   1/6
  Verifying  : postgresql12-libs-12.0-1PGDG.rhel7.x86_64                                                              2/6
  Verifying  : python3-libs-3.6.8-10.el7.x86_64                                                                       3/6
  Verifying  : python3-pip-9.0.3-5.el7.noarch                                                                         4/6
  Verifying  : python3-setuptools-39.2.0-10.el7.noarch                                                                5/6
  Verifying  : python3-3.6.8-10.el7.x86_64                                                                            6/6

Installed:
  postgresql12.x86_64 0:12.0-1PGDG.rhel7

Dependency Installed:
  postgresql12-libs.x86_64 0:12.0-1PGDG.rhel7                       python3.x86_64 0:3.6.8-10.el7
  python3-libs.x86_64 0:3.6.8-10.el7                                python3-pip.noarch 0:9.0.3-5.el7
  python3-setuptools.noarch 0:39.2.0-10.el7

Complete!
[root@localhost hari]#
[root@localhost hari]#
[root@localhost hari]# ps -ef|grep post
root      1511     1  0 14:34 ?        00:00:00 /usr/libexec/postfix/master -w
postfix   1558  1511  0 14:34 ?        00:00:00 pickup -l -t unix -u
postfix   1559  1511  0 14:34 ?        00:00:00 qmgr -l -t unix -u
root      2418  2265  0 14:44 pts/0    00:00:00 grep --color=auto post
[root@localhost hari]#
[root@localhost hari]#
[root@localhost hari]# systemctl start postgresql-12
Failed to start postgresql-12.service: Unit not found.
[root@localhost hari]#
[root@localhost hari]# systemctl start postgresql-12
Failed to start postgresql-12.service: Unit not found.
[root@localhost hari]#
[root@localhost hari]# cd /usr
[root@localhost usr]# ll
total 260
dr-xr-xr-x.   2 root root 49152 Oct 12 14:44 bin
drwxr-xr-x.   4 root root    31 Sep 11 10:50 edb
drwxr-xr-x.   2 root root     6 Apr 11  2018 etc
drwxr-xr-x.   2 root root     6 Apr 11  2018 games
drwxr-xr-x.  10 root root  4096 Oct 12 14:44 include
dr-xr-xr-x.  43 root root  4096 Oct 12 14:44 lib
dr-xr-xr-x. 143 root root 81920 Oct 12 14:44 lib64
drwxr-xr-x.  46 root root 12288 Sep 11 04:21 libexec
drwxr-xr-x.  12 root root   131 Sep 11 01:43 local
drwxr-xr-x.   5 root root    41 Oct 12 14:44 pgsql-12
dr-xr-xr-x.   2 root root 20480 Sep 11 04:22 sbin
drwxr-xr-x. 234 root root  8192 Sep 11 04:16 share
drwxr-xr-x.   4 root root    34 Sep 11 01:43 src
lrwxrwxrwx.   1 root root    10 Sep 11 01:43 tmp -> ../var/tmp
[root@localhost usr]# cd pgsql-12/
[root@localhost pgsql-12]# ll
total 4
drwxr-xr-x. 2 root root 4096 Oct 12 14:44 bin
drwxr-xr-x. 3 root root  276 Oct 12 14:44 lib
drwxr-xr-x. 4 root root   82 Oct 12 14:44 share
[root@localhost pgsql-12]# cd bin
[root@localhost bin]# ll
total 2684
-rwxr-xr-x. 1 root root  67360 Oct  1 15:45 clusterdb
-rwxr-xr-x. 1 root root  67352 Oct  1 15:45 createdb
-rwxr-xr-x. 1 root root  71920 Oct  1 15:45 createuser
-rwxr-xr-x. 1 root root  63064 Oct  1 15:45 dropdb
-rwxr-xr-x. 1 root root  63032 Oct  1 15:45 dropuser
-rwxr-xr-x. 1 root root  41456 Oct  1 15:45 pg_archivecleanup
-rwxr-xr-x. 1 root root 118224 Oct  1 15:45 pg_basebackup
-rwxr-xr-x. 1 root root 155520 Oct  1 15:45 pgbench
-rwxr-xr-x. 1 root root  41240 Oct  1 15:45 pg_config
-rwxr-xr-x. 1 root root 401120 Oct  1 15:45 pg_dump
-rwxr-xr-x. 1 root root  97280 Oct  1 15:45 pg_dumpall
-rwxr-xr-x. 1 root root  62968 Oct  1 15:45 pg_isready
-rwxr-xr-x. 1 root root  80344 Oct  1 15:45 pg_receivewal
-rwxr-xr-x. 1 root root 172152 Oct  1 15:45 pg_restore
-rwxr-xr-x. 1 root root 100664 Oct  1 15:45 pg_rewind
-rwxr-xr-x. 1 root root  45808 Oct  1 15:45 pg_test_fsync
-rwxr-xr-x. 1 root root  37272 Oct  1 15:45 pg_test_timing
-rwxr-xr-x. 1 root root 138488 Oct  1 15:45 pg_upgrade
-rwxr-xr-x. 1 root root  96320 Oct  1 15:45 pg_waldump
-rwxr-xr-x. 1 root root 631696 Oct  1 15:45 psql
-rwxr-xr-x. 1 root root  71600 Oct  1 15:45 reindexdb
-rwxr-xr-x. 1 root root  76032 Oct  1 15:45 vacuumdb
[root@localhost bin]# yum install postgresql12-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.piconets.webwerks.in
 * extras: mirrors.piconets.webwerks.in
 * updates: mirrors.piconets.webwerks.in
Resolving Dependencies
--> Running transaction check
---> Package postgresql12-server.x86_64 0:12.0-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
 Package                             Arch                   Version                          Repository              Size
==========================================================================================================================
Installing:
 postgresql12-server                 x86_64                 12.0-1PGDG.rhel7                 pgdg12                 4.9 M

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

Total download size: 4.9 M
Installed size: 19 M
Is this ok [y/d/N]: y
Downloading packages:
postgresql12-server-12.0-1PGDG.rhel7.x86_64.rpm                                                    | 4.9 MB  00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : postgresql12-server-12.0-1PGDG.rhel7.x86_64                                                            1/1
  Verifying  : postgresql12-server-12.0-1PGDG.rhel7.x86_64                                                            1/1

Installed:
  postgresql12-server.x86_64 0:12.0-1PGDG.rhel7

Complete!
[root@localhost bin]#
[root@localhost bin]# ll
total 10604
-rwxr-xr-x. 1 root root   67360 Oct  1 15:45 clusterdb
-rwxr-xr-x. 1 root root   67352 Oct  1 15:45 createdb
-rwxr-xr-x. 1 root root   71920 Oct  1 15:45 createuser
-rwxr-xr-x. 1 root root   63064 Oct  1 15:45 dropdb
-rwxr-xr-x. 1 root root   63032 Oct  1 15:45 dropuser
-rwxr-xr-x. 1 root root  130424 Oct  1 15:45 initdb
-rwxr-xr-x. 1 root root   41456 Oct  1 15:45 pg_archivecleanup
-rwxr-xr-x. 1 root root  118224 Oct  1 15:45 pg_basebackup
-rwxr-xr-x. 1 root root  155520 Oct  1 15:45 pgbench
-rwxr-xr-x. 1 root root   58456 Oct  1 15:45 pg_checksums
-rwxr-xr-x. 1 root root   41240 Oct  1 15:45 pg_config
-rwxr-xr-x. 1 root root   58064 Oct  1 15:45 pg_controldata
-rwxr-xr-x. 1 root root   71064 Oct  1 15:45 pg_ctl
-rwxr-xr-x. 1 root root  401120 Oct  1 15:45 pg_dump
-rwxr-xr-x. 1 root root   97280 Oct  1 15:45 pg_dumpall
-rwxr-xr-x. 1 root root   62968 Oct  1 15:45 pg_isready
-rwxr-xr-x. 1 root root   80344 Oct  1 15:45 pg_receivewal
-rwxr-xr-x. 1 root root   62632 Oct  1 15:45 pg_resetwal
-rwxr-xr-x. 1 root root  172152 Oct  1 15:45 pg_restore
-rwxr-xr-x. 1 root root  100664 Oct  1 15:45 pg_rewind
-rwxr-xr-x. 1 root root   45808 Oct  1 15:45 pg_test_fsync
-rwxr-xr-x. 1 root root   37272 Oct  1 15:45 pg_test_timing
-rwxr-xr-x. 1 root root  138488 Oct  1 15:45 pg_upgrade
-rwxr-xr-x. 1 root root   96320 Oct  1 15:45 pg_waldump
-rwxr-xr-x. 1 root root 7698424 Oct  1 15:45 postgres
-rwxr-xr-x. 1 root root    2175 Oct  1 15:45 postgresql-12-check-db-dir
-rwxr-xr-x. 1 root root    9418 Oct  1 15:45 postgresql-12-setup
lrwxrwxrwx. 1 root root       8 Oct 12 14:46 postmaster -> postgres
-rwxr-xr-x. 1 root root  631696 Oct  1 15:45 psql
-rwxr-xr-x. 1 root root   71600 Oct  1 15:45 reindexdb
-rwxr-xr-x. 1 root root   76032 Oct  1 15:45 vacuumdb
[root@localhost bin]# ps -ef|grep post
root      1511     1  0 14:34 ?        00:00:00 /usr/libexec/postfix/master -w
postfix   1558  1511  0 14:34 ?        00:00:00 pickup -l -t unix -u
postfix   1559  1511  0 14:34 ?        00:00:00 qmgr -l -t unix -u
root      2516  2265  0 14:47 pts/0    00:00:00 grep --color=auto post
[root@localhost bin]#
[root@localhost bin]#
[root@localhost bin]# df
Filesystem              1K-blocks    Used Available Use% Mounted on
/dev/mapper/centos-root  47588656 4971568  42617088  11% /
devtmpfs                  1569404       0   1569404   0% /dev
tmpfs                     1586260       0   1586260   0% /dev/shm
tmpfs                     1586260    9404   1576856   1% /run
tmpfs                     1586260       0   1586260   0% /sys/fs/cgroup
/dev/sda1                 1038336  236620    801716  23% /boot
tmpfs                      317256      12    317244   1% /run/user/42
tmpfs                      317256       0    317256   0% /run/user/1000
[root@localhost bin]# pwd
/usr/pgsql-12/bin
[root@localhost bin]# cd ..
[root@localhost pgsql-12]# ll
total 12
drwxr-xr-x. 2 root root 4096 Oct 12 14:46 bin
drwxr-xr-x. 3 root root 4096 Oct 12 14:46 lib
drwxr-xr-x. 7 root root 4096 Oct 12 14:46 share
[root@localhost pgsql-12]# mkdir data
[root@localhost pgsql-12]# id postgres
uid=26(postgres) gid=26(postgres) groups=26(postgres)
[root@localhost pgsql-12]# chown postgres:postgres data
[root@localhost pgsql-12]# su - postgres
-bash-4.2$ pwd
/var/lib/pgsql
-bash-4.2$ cd /usr/pgsql-12/bin
-bash-4.2$ ./initdb -D /usr/pgsql-12/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_IN.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /usr/pgsql-12/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Kolkata
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    ./pg_ctl -D /usr/pgsql-12/data -l logfile start

-bash-4.2$ pwd
/usr/pgsql-12/bin
-bash-4.2$ cd ../data
-bash-4.2$ cd -
/usr/pgsql-12/bin
-bash-4.2$ ./pg_ctl -D /usr/pgsql-12/data -l logfile start  ^C
-bash-4.2$ ps -ef|grep data
root       445     2  0 14:33 ?        00:00:00 [xfs-data/dm-0]
root       661     2  0 14:33 ?        00:00:00 [xfs-data/sda1]
root      1302  1174  0 14:34 tty1     00:00:01 /usr/bin/X :0 -background none -noreset -audit 4 -verbose -auth /run/gdm/auth-for-gdm-n1FBr2/database -seat seat0 -nolisten tcp vt1
postgres  2623  2533  0 14:49 pts/0    00:00:00 grep --color=auto data
-bash-4.2$ ps -ef|grep post
root      1511     1  0 14:34 ?        00:00:00 /usr/libexec/postfix/master -w
postfix   1558  1511  0 14:34 ?        00:00:00 pickup -l -t unix -u
postfix   1559  1511  0 14:34 ?        00:00:00 qmgr -l -t unix -u
root      2532  2265  0 14:48 pts/0    00:00:00 su - postgres
postgres  2533  2532  0 14:48 pts/0    00:00:00 -bash
postgres  2639  2533  0 14:50 pts/0    00:00:00 ps -ef
postgres  2640  2533  0 14:50 pts/0    00:00:00 grep --color=auto post
-bash-4.2$
-bash-4.2$ ./pg_ctl -D /usr/pgsql-12/data -l logfile start
waiting for server to start..../bin/sh: logfile: Permission denied
 stopped waiting
pg_ctl: could not start server
Examine the log output.
-bash-4.2$ pwd
/usr/pgsql-12/bin
-bash-4.2$ ll
total 10604
-rwxr-xr-x. 1 root root   67360 Oct  1 15:45 clusterdb
-rwxr-xr-x. 1 root root   67352 Oct  1 15:45 createdb
-rwxr-xr-x. 1 root root   71920 Oct  1 15:45 createuser
-rwxr-xr-x. 1 root root   63064 Oct  1 15:45 dropdb
-rwxr-xr-x. 1 root root   63032 Oct  1 15:45 dropuser
-rwxr-xr-x. 1 root root  130424 Oct  1 15:45 initdb
-rwxr-xr-x. 1 root root   41456 Oct  1 15:45 pg_archivecleanup
-rwxr-xr-x. 1 root root  118224 Oct  1 15:45 pg_basebackup
-rwxr-xr-x. 1 root root  155520 Oct  1 15:45 pgbench
-rwxr-xr-x. 1 root root   58456 Oct  1 15:45 pg_checksums
-rwxr-xr-x. 1 root root   41240 Oct  1 15:45 pg_config
-rwxr-xr-x. 1 root root   58064 Oct  1 15:45 pg_controldata
-rwxr-xr-x. 1 root root   71064 Oct  1 15:45 pg_ctl
-rwxr-xr-x. 1 root root  401120 Oct  1 15:45 pg_dump
-rwxr-xr-x. 1 root root   97280 Oct  1 15:45 pg_dumpall
-rwxr-xr-x. 1 root root   62968 Oct  1 15:45 pg_isready
-rwxr-xr-x. 1 root root   80344 Oct  1 15:45 pg_receivewal
-rwxr-xr-x. 1 root root   62632 Oct  1 15:45 pg_resetwal
-rwxr-xr-x. 1 root root  172152 Oct  1 15:45 pg_restore
-rwxr-xr-x. 1 root root  100664 Oct  1 15:45 pg_rewind
-rwxr-xr-x. 1 root root   45808 Oct  1 15:45 pg_test_fsync
-rwxr-xr-x. 1 root root   37272 Oct  1 15:45 pg_test_timing
-rwxr-xr-x. 1 root root  138488 Oct  1 15:45 pg_upgrade
-rwxr-xr-x. 1 root root   96320 Oct  1 15:45 pg_waldump
-rwxr-xr-x. 1 root root 7698424 Oct  1 15:45 postgres
-rwxr-xr-x. 1 root root    2175 Oct  1 15:45 postgresql-12-check-db-dir
-rwxr-xr-x. 1 root root    9418 Oct  1 15:45 postgresql-12-setup
lrwxrwxrwx. 1 root root       8 Oct 12 14:46 postmaster -> postgres
-rwxr-xr-x. 1 root root  631696 Oct  1 15:45 psql
-rwxr-xr-x. 1 root root   71600 Oct  1 15:45 reindexdb
-rwxr-xr-x. 1 root root   76032 Oct  1 15:45 vacuumdb
-bash-4.2$ cd ../data
-bash-4.2$ ll
total 52
drwx------. 5 postgres postgres    41 Oct 12 14:49 base
drwx------. 2 postgres postgres  4096 Oct 12 14:49 global
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_commit_ts
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_dynshmem
-rw-------. 1 postgres postgres  4513 Oct 12 14:49 pg_hba.conf
-rw-------. 1 postgres postgres  1636 Oct 12 14:49 pg_ident.conf
drwx------. 4 postgres postgres    68 Oct 12 14:49 pg_logical
drwx------. 4 postgres postgres    36 Oct 12 14:49 pg_multixact
drwx------. 2 postgres postgres    18 Oct 12 14:49 pg_notify
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_replslot
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_serial
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_snapshots
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_stat
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_stat_tmp
drwx------. 2 postgres postgres    18 Oct 12 14:49 pg_subtrans
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_tblspc
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_twophase
-rw-------. 1 postgres postgres     3 Oct 12 14:49 PG_VERSION
drwx------. 3 postgres postgres    60 Oct 12 14:49 pg_wal
drwx------. 2 postgres postgres    18 Oct 12 14:49 pg_xact
-rw-------. 1 postgres postgres    88 Oct 12 14:49 postgresql.auto.conf
-rw-------. 1 postgres postgres 26630 Oct 12 14:49 postgresql.conf
-bash-4.2$ logout
[root@localhost pgsql-12]# ./pg_ctl -D /usr/pgsql-12/data -l logfile start
bash: ./pg_ctl: No such file or directory
[root@localhost pgsql-12]# cd bin
[root@localhost bin]# ./pg_ctl -D /usr/pgsql-12/data -l logfile start
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.
[root@localhost bin]# su - postgres
Last login: Sat Oct 12 14:48:45 IST 2019 on pts/0
-bash-4.2$
-bash-4.2$ ./pg_ctl -D /usr/pgsql-12/data -l /usr/pgsql-12/data/logfile start
-bash: ./pg_ctl: No such file or directory
-bash-4.2$ pwd
/var/lib/pgsql
-bash-4.2$ cd /usr/pgsql-12/bin
-bash-4.2$ ./pg_ctl -D /usr/pgsql-12/data -l /usr/pgsql-12/data/logfile start
waiting for server to start.... done
server started
-bash-4.2$
-bash-4.2$
-bash-4.2$
-bash-4.2$
-bash-4.2$
-bash-4.2$
-bash-4.2$ ps -ef|grep post
root      1511     1  0 14:34 ?        00:00:00 /usr/libexec/postfix/master -w
postfix   1558  1511  0 14:34 ?        00:00:00 pickup -l -t unix -u
postfix   1559  1511  0 14:34 ?        00:00:00 qmgr -l -t unix -u
root      2664  2265  0 14:51 pts/0    00:00:00 su - postgres
postgres  2665  2664  0 14:51 pts/0    00:00:00 -bash
postgres  2733     1  1 14:52 ?        00:00:00 /usr/pgsql-12/bin/postgres -D /usr/pgsql-12/data
postgres  2734  2733  0 14:52 ?        00:00:00 postgres: logger
postgres  2736  2733  0 14:52 ?        00:00:00 postgres: checkpointer
postgres  2737  2733  0 14:52 ?        00:00:00 postgres: background writer
postgres  2738  2733  0 14:52 ?        00:00:00 postgres: walwriter
postgres  2739  2733  0 14:52 ?        00:00:00 postgres: autovacuum launcher
postgres  2740  2733  0 14:52 ?        00:00:00 postgres: stats collector
postgres  2741  2733  0 14:52 ?        00:00:00 postgres: logical replication launcher
postgres  2742  2665  0 14:52 pts/0    00:00:00 ps -ef
postgres  2743  2665  0 14:52 pts/0    00:00:00 grep --color=auto post
-bash-4.2$
-bash-4.2$
-bash-4.2$
-bash-4.2$ cd /usr/pgsql-12/data
-bash-4.2$ ll
total 68
drwx------. 5 postgres postgres    41 Oct 12 14:49 base
-rw-------. 1 postgres postgres    30 Oct 12 14:52 current_logfiles
drwx------. 2 postgres postgres  4096 Oct 12 14:49 global
drwx------. 2 postgres postgres    32 Oct 12 14:52 log
-rw-------. 1 postgres postgres   702 Oct 12 14:52 logfile
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_commit_ts
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_dynshmem
-rw-------. 1 postgres postgres  4513 Oct 12 14:49 pg_hba.conf
-rw-------. 1 postgres postgres  1636 Oct 12 14:49 pg_ident.conf
drwx------. 4 postgres postgres    68 Oct 12 14:49 pg_logical
drwx------. 4 postgres postgres    36 Oct 12 14:49 pg_multixact
drwx------. 2 postgres postgres    18 Oct 12 14:52 pg_notify
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_replslot
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_serial
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_snapshots
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_stat
drwx------. 2 postgres postgres    25 Oct 12 14:53 pg_stat_tmp
drwx------. 2 postgres postgres    18 Oct 12 14:49 pg_subtrans
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_tblspc
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_twophase
-rw-------. 1 postgres postgres     3 Oct 12 14:49 PG_VERSION
drwx------. 3 postgres postgres    60 Oct 12 14:49 pg_wal
drwx------. 2 postgres postgres    18 Oct 12 14:49 pg_xact
-rw-------. 1 postgres postgres    88 Oct 12 14:49 postgresql.auto.conf
-rw-------. 1 postgres postgres 26630 Oct 12 14:49 postgresql.conf
-rw-------. 1 postgres postgres    53 Oct 12 14:52 postmaster.opts
-rw-------. 1 postgres postgres    99 Oct 12 14:52 postmaster.pid
-bash-4.2$ cd log
-bash-4.2$ ll
total 4
-rw-------. 1 postgres postgres 186 Oct 12 14:52 postgresql-Sat.log
-bash-4.2$ cat postgresql-Sat.log
2019-10-12 14:52:25.172 IST [2735] LOG:  database system was shut down at 2019-10-12 14:49:16 IST
2019-10-12 14:52:25.184 IST [2733] LOG:  database system is ready to accept connections
-bash-4.2$
-bash-4.2$ cd ..
-bash-4.2$ ll
total 68
drwx------. 5 postgres postgres    41 Oct 12 14:49 base
-rw-------. 1 postgres postgres    30 Oct 12 14:52 current_logfiles
drwx------. 2 postgres postgres  4096 Oct 12 14:49 global
drwx------. 2 postgres postgres    32 Oct 12 14:52 log
-rw-------. 1 postgres postgres   702 Oct 12 14:52 logfile
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_commit_ts
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_dynshmem
-rw-------. 1 postgres postgres  4513 Oct 12 14:49 pg_hba.conf
-rw-------. 1 postgres postgres  1636 Oct 12 14:49 pg_ident.conf
drwx------. 4 postgres postgres    68 Oct 12 14:49 pg_logical
drwx------. 4 postgres postgres    36 Oct 12 14:49 pg_multixact
drwx------. 2 postgres postgres    18 Oct 12 14:52 pg_notify
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_replslot
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_serial
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_snapshots
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_stat
drwx------. 2 postgres postgres    25 Oct 12 14:53 pg_stat_tmp
drwx------. 2 postgres postgres    18 Oct 12 14:49 pg_subtrans
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_tblspc
drwx------. 2 postgres postgres     6 Oct 12 14:49 pg_twophase
-rw-------. 1 postgres postgres     3 Oct 12 14:49 PG_VERSION
drwx------. 3 postgres postgres    60 Oct 12 14:49 pg_wal
drwx------. 2 postgres postgres    18 Oct 12 14:49 pg_xact
-rw-------. 1 postgres postgres    88 Oct 12 14:49 postgresql.auto.conf
-rw-------. 1 postgres postgres 26630 Oct 12 14:49 postgresql.conf
-rw-------. 1 postgres postgres    53 Oct 12 14:52 postmaster.opts
-rw-------. 1 postgres postgres    99 Oct 12 14:52 postmaster.pid
-bash-4.2$
-bash-4.2$
-bash-4.2$ cat logfile
2019-10-12 14:52:25.100 IST [2733] LOG:  starting PostgreSQL 12.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit
2019-10-12 14:52:25.105 IST [2733] LOG:  listening on IPv6 address "::1", port 5432
2019-10-12 14:52:25.105 IST [2733] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2019-10-12 14:52:25.110 IST [2733] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-10-12 14:52:25.122 IST [2733] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-10-12 14:52:25.163 IST [2733] LOG:  redirecting log output to logging collector process
2019-10-12 14:52:25.163 IST [2733] HINT:  Future log output will appear in directory "log".
-bash-4.2$
-bash-4.2$ cat current_logfiles
stderr log/postgresql-Sat.log
-bash-4.2$ pwd
/usr/pgsql-12/data
-bash-4.2$ cd ../bin
-bash-4.2$ ./psql -p 5432
psql (12.0)
Type "help" for help.

postgres=#
postgres=# select pg_stat_activity;
ERROR:  column "pg_stat_activity" does not exist
LINE 1: select pg_stat_activity;
               ^
postgres=# select * from pg_stat_activity;
 datid | datname  | pid  | usesysid | usename  | application_name | client_addr | client_hostname | client_port |
 backend_start           |            xact_start            |           query_start            |           state_change
        | wait_event_type |     wait_event      | state  | backend_xid | backend_xmin |              query              |
        backend_type
-------+----------+------+----------+----------+------------------+-------------+-----------------+-------------+---------
-------------------------+----------------------------------+----------------------------------+--------------------------
--------+-----------------+---------------------+--------+-------------+--------------+---------------------------------+-
-----------------------------
       |          | 2741 |       10 | postgres |                  |             |                 |             | 2019-10-
12 14:52:25.184835+05:30 |                                  |                                  |
        | Activity        | LogicalLauncherMain |        |             |              |                                 |
logical replication launcher
       |          | 2739 |          |          |                  |             |                 |             | 2019-10-
12 14:52:25.190522+05:30 |                                  |                                  |
        | Activity        | AutoVacuumMain      |        |             |              |                                 |
autovacuum launcher
 14187 | postgres | 2781 |       10 | postgres | psql             |             |                 |          -1 | 2019-10-
12 14:55:28.985965+05:30 | 2019-10-12 14:57:23.188224+05:30 | 2019-10-12 14:57:23.188224+05:30 | 2019-10-12 14:57:23.18822
7+05:30 |                 |                     | active |             |          486 | select * from pg_stat_activity; |
client backend
       |          | 2737 |          |          |                  |             |                 |             | 2019-10-
12 14:52:25.187364+05:30 |                                  |                                  |
        | Activity        | BgWriterHibernate   |        |             |              |                                 |
background writer
       |          | 2736 |          |          |                  |             |                 |             | 2019-10-
12 14:52:25.193461+05:30 |                                  |                                  |
        | Activity        | CheckpointerMain    |        |             |              |                                 |
checkpointer
       |          | 2738 |          |          |                  |             |                 |             | 2019-10-
12 14:52:25.188694+05:30 |                                  |                                  |
        | Activity        | WalWriterMain       |        |             |              |                                 |
walwriter
(6 rows)

postgres=#
postgres=#
postgres=# select * from pg_stat_activity;
 datid | datname  | pid  | usesysid | usename  | application_name | client_addr | client_hostname | client_port |
 backend_start           |           xact_start            |           query_start           |           state_change
      | wait_event_type |     wait_event      | state  | backend_xid | backend_xmin |              query              |
      backend_type
-------+----------+------+----------+----------+------------------+-------------+-----------------+-------------+---------
-------------------------+---------------------------------+---------------------------------+----------------------------
------+-----------------+---------------------+--------+-------------+--------------+---------------------------------+---
---------------------------
       |          | 2741 |       10 | postgres |                  |             |                 |             | 2019-10-
12 14:52:25.184835+05:30 |                                 |                                 |
      | Activity        | LogicalLauncherMain |        |             |              |                                 | lo
gical replication launcher
       |          | 2739 |          |          |                  |             |                 |             | 2019-10-
12 14:52:25.190522+05:30 |                                 |                                 |
      | Activity        | AutoVacuumMain      |        |             |              |                                 | au
tovacuum launcher
 14187 | postgres | 2781 |       10 | postgres | psql             |             |                 |          -1 | 2019-10-
12 14:55:28.985965+05:30 | 2019-10-12 14:58:10.44318+05:30 | 2019-10-12 14:58:10.44318+05:30 | 2019-10-12 14:58:10.443182+
05:30 |                 |                     | active |             |          486 | select * from pg_stat_activity; | cl
ient backend
       |          | 2737 |          |          |                  |             |                 |             | 2019-10-
12 14:52:25.187364+05:30 |                                 |                                 |
      | Activity        | BgWriterHibernate   |        |             |              |                                 | ba
ckground writer
       |          | 2736 |          |          |                  |             |                 |             | 2019-10-
12 14:52:25.193461+05:30 |                                 |                                 |
      | Activity        | CheckpointerMain    |        |             |              |                                 | ch
eckpointer
       |          | 2738 |          |          |                  |             |                 |             | 2019-10-
12 14:52:25.188694+05:30 |                                 |                                 |
      | Activity        | WalWriterMain       |        |             |              |                                 | wa
lwriter
(6 rows)

postgres=#
postgres=#
postgres=# \q
-bash-4.2$
-bash-4.2$

If you think its useful, Kindly like and share.

-----------------------------------------Jai-Hind-----------------------------------------------------------

Comments

Popular posts from this blog

ELECTRONIC BLOOD

Installation of edb-bart-2.2.0-1 on Centos/Linux. #2