0% found this document useful (0 votes)
2 views

postgres_installation

Uploaded by

kapil Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

postgres_installation

Uploaded by

kapil Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

[root@kk1 opt]# rpm -ivh postgresql12-libs-12.14-1PGDG.rhel8.x86_64.

rpm

warning: postgresql12-libs-12.14-1PGDG.rhel8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID


442df0f8: NOKEY

Verifying... ################################# [100%]

Preparing... ################################# [100%]

Updating / installing...

1:postgresql12-libs-12.14-1PGDG.rhe################################# [100%]

[root@kk1 opt]# rpm -ivh postgresql12-12.14-1PGDG.rhel8.x86_64.rpm

warning: postgresql12-12.14-1PGDG.rhel8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID


442df0f8: NOKEY

Verifying... ################################# [100%]

Preparing... ################################# [100%]

Updating / installing...

1:postgresql12-12.14-1PGDG.rhel8 ################################# [100%]

[root@kk1 opt]# rpm -ivh postgresql12-server-12.14-1PGDG.rhel8.x86_64.rpm

warning: postgresql12-server-12.14-1PGDG.rhel8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID


442df0f8: NOKEY

Verifying... ################################# [100%]

Preparing... ################################# [100%]

Updating / installing...

1:postgresql12-server-12.14-1PGDG.r################################# [100%]

[/usr/lib/tmpfiles.d/mdadm.conf:1] Line references path below legacy directory /var/run/, updating


/var/run/mdadm → /run/mdadm; please update the tmpfiles.d/ drop-in file accordingly.

[/usr/lib/tmpfiles.d/radvd.conf:1] Line references path below legacy directory /var/run/, updating


/var/run/radvd → /run/radvd; please update the tmpfiles.d/ drop-in file accordingly.

[/usr/lib/tmpfiles.d/subscription-manager.conf:1] Line references path below legacy directory /var/run/,


updating /var/run/rhsm → /run/rhsm; please update the tmpfiles.d/ drop-in file accordingly.

[root@kk1 opt]# rpm -ivh postgresql12-contrib-12.14-1PGDG.rhel8.x86_64.rpm

warning: postgresql12-contrib-12.14-1PGDG.rhel8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID


442df0f8: NOKEY

Verifying... ################################# [100%]


Preparing... ################################# [100%]

Updating / installing...

1:postgresql12-contrib-12.14-1PGDG.################################# [100%]

[root@kk1 opt]# mkdir -p /opt1/data

[root@kk1 opt]# mkdir -p /opt1/archive

[root@kk1 opt]# passwd postgres

Changing password for user postgres.

New password:

BAD PASSWORD: The password contains the user name in some form

Retype new password:

passwd: all authentication tokens updated successfully.

[root@kk1 opt]# chown -R postgres.postgres /opt1/

[root@kk1 opt]# chmod -R 750 /opt1

[root@kk1 opt]# cd /var

[root@kk1 var]# ls

account adm cache crash db empty ftp games gopher kerberos lib local lock log mail nis opt
preserve run spool tmp yp

[root@kk1 var]# cd /usr/

[root@kk1 usr]# ls

bin games include lib lib64 libexec local pgsql-12 sbin share src tmp

[root@kk1 usr]# cd pgsql-12/

[root@kk1 pgsql-12]# ls

bin doc lib share

[root@kk1 pgsql-12]# cd bin/

[root@kk1 bin]# ls

clusterdb dropuser pg_basebackup pg_controldata pg_isready pg_restore pg_test_timing


postgresql-12-check-db-dir reindexdb

createdb initdb pgbench pg_ctl pg_receivewal pg_rewind pg_upgrade


postgresql-12-setup vacuumdb
createuser oid2name pg_checksums pg_dump pg_recvlogical pg_standby pg_waldump
postmaster vacuumlo

dropdb pg_archivecleanup pg_config pg_dumpall pg_resetwal pg_test_fsync postgres

[root@kk1 bin]# ./initdb -D /opt1/data/

initdb: error: cannot be run as root

Please log in (using, e.g., "su") as the (unprivileged) user that will

own the server process.

[root@kk1 bin]# su - postgres

[postgres@kk1 ~]$ cd /usr/pgsql-12/bin/

[postgres@kk1 bin]$ ./initdb -D /opt1/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_US.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 /opt1/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 ... America/New_York

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 /opt1/data/ -l logfile start

[postgres@kk1 bin]$ su - root

[root@kk1 system]# vi postgresql-12.service

[root@kk1 system]# systemctl status postgresql-12.service

● postgresql-12.service - PostgreSQL 12 database server

Loaded: loaded (/usr/lib/systemd/system/postgresql-12.service; disabled; vendor preset: disabled)

Active: inactive (dead)

Docs: https://www.postgresql.org/docs/12/static/

[root@kk1 system]# systemctl start postgresql-12.service

[root@kk1 system]# systemctl status postgresql-12.service

● postgresql-12.service - PostgreSQL 12 database server

Loaded: loaded (/usr/lib/systemd/system/postgresql-12.service; disabled; vendor preset: disabled)

Active: active (running) since Thu 2023-03-30 11:28:01 EDT; 6s ago

Docs: https://www.postgresql.org/docs/12/static/

Process: 8884 ExecStartPre=/usr/pgsql-12/bin/postgresql-12-check-db-dir ${PGDATA} (code=exited,


status=0/SUCCESS)

Main PID: 8889 (postmaster)

Tasks: 8 (limit: 26213)

Memory: 17.0M

CGroup: /system.slice/postgresql-12.service

├─8889 /usr/pgsql-12/bin/postmaster -D /opt1/data/


├─8891 postgres: logger

├─8893 postgres: checkpointer

├─8894 postgres: background writer

├─8895 postgres: walwriter

├─8896 postgres: autovacuum launcher

├─8897 postgres: stats collector

└─8898 postgres: logical replication launcher

Mar 30 11:28:01 kk1.focus.com systemd[1]: Starting PostgreSQL 12 database server...

Mar 30 11:28:01 kk1.focus.com postmaster[8889]: 2023-03-30 11:28:01.888 EDT [8889] LOG: starting
PostgreSQL 12.14 on x86_64-pc-linux-gnu, compiled by gcc (GC>

Mar 30 11:28:01 kk1.focus.com postmaster[8889]: 2023-03-30 11:28:01.893 EDT [8889] LOG: listening
on IPv6 address "::1", port 5432

Mar 30 11:28:01 kk1.focus.com postmaster[8889]: 2023-03-30 11:28:01.893 EDT [8889] LOG: listening
on IPv4 address "127.0.0.1", port 5432

Mar 30 11:28:01 kk1.focus.com postmaster[8889]: 2023-03-30 11:28:01.902 EDT [8889] LOG: listening
on Unix socket "/var/run/postgresql/.s.PGSQL.5432"

Mar 30 11:28:01 kk1.focus.com postmaster[8889]: 2023-03-30 11:28:01.913 EDT [8889] LOG: listening
on Unix socket "/tmp/.s.PGSQL.5432"

Mar 30 11:28:01 kk1.focus.com postmaster[8889]: 2023-03-30 11:28:01.946 EDT [8889] LOG:


redirecting log output to logging collector process

Mar 30 11:28:01 kk1.focus.com postmaster[8889]: 2023-03-30 11:28:01.946 EDT [8889] HINT: Future
log output will appear in directory "log".

Mar 30 11:28:01 kk1.focus.com systemd[1]: Started PostgreSQL 12 database server.

[root@kk1 system]# pwd

/usr/lib/systemd/system

[root@kk1 system]#

You might also like