PostgreSQL 10.3 installation steps:
In this tutorial i will explain how to install postgreSQL 10 on Red Hat Enterprise Linux Server release 7.3 Beta (Maipo) and How to make network configuration and how to do linux partition for DATA , ARCHIVE, BACKUP.
In this tutorial i will explain how to install postgreSQL 10 on Red Hat Enterprise Linux Server release 7.3 Beta (Maipo) and How to make network configuration and how to do linux partition for DATA , ARCHIVE, BACKUP.
Step 1. Download the rpm from below links
https://yum.postgresql.org/10/redhat/rhel-7-x86_64/repoview/
(OR)
http://www.agussyarif.com/2017/11/oracle-and-postgresql-dba-related.html
(OR)
https://yum.postgresql.org/rpmchart.php
https://yum.postgresql.org/10/redhat/rhel-7-x86_64/repoview/
(OR)
http://www.agussyarif.com/2017/11/oracle-and-postgresql-dba-related.html
(OR)
https://yum.postgresql.org/rpmchart.php
Step 2. Install the below mandatory rpm’s .
1.postgresql10-libs – The shared libraries required for any PostgreSQL clients
2.postgresql10 – PostgreSQL client programs and libraries
3.postgresql10-server – The programs needed to create and run a PostgreSQL server
4.postgresql10-contrib – Contributed source and binaries distributed with PostgreSQL
1.postgresql10-libs – The shared libraries required for any PostgreSQL clients
2.postgresql10 – PostgreSQL client programs and libraries
3.postgresql10-server – The programs needed to create and run a PostgreSQL server
4.postgresql10-contrib – Contributed source and binaries distributed with PostgreSQL
rpm -ivh postgresql1010-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-contrib-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-contrib-debuginfo-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-debuginfo-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-debugsource-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-devel-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-devel-debuginfo-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-docs-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-libs-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-libs-debuginfo-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-pglogical-2.2.2-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-pglogical-debuginfo-2.2.2-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-pglogical-debugsource-2.2.2-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-plperl-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-plperl-debuginfo-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-plpython-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-plpython-debuginfo-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-pltcl-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-pltcl-debuginfo-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-server-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-server-debuginfo-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-test-10.10-1.x86_64.rpm --nodepsrpm -ivh postgresql1010-test-debuginfo-10.10-1.x86_64.rpm --nodeps
Step 3. Intialize the postgres cluster .
[root@master bin]# pwd/usr/pgsql-10/bin[root@master bin]# ls -lrt postgresql-10-setup-rwxr-xr-x. 1 root root 8582 Feb 27 05:16 postgresql-10-setup
Then initialize the database:
[root@master bin]# /usr/pgsql-10/bin/postgresql-10-setup initdbInitializing database ... OK
Note:PostgreSQL data is typically found /var/lib/pgsql/10/data/ directory.
Verify the data directory:
[root@master bin]# /var/lib/pgsql/10/data/base/ pg_commit_ts/ pg_multixact/ pg_serial/pg_stat_tmp/ pg_twophase/global/ pg_dynshmem/ pg_notify/pg_snapshots/ pg_subtrans/ pg_wal/log/ pg_logical/ pg_replslot/ pg_stat/ pg_tblspc/pg_xact/
Step 4. Currently postgres is not running we need to start the postgres cluster:
A.check the postgres cluster status:
A.check the postgres cluster status:
[root@master bin]# ps -ef|grep postgresroot 5141 3519 0 18:41 pts/000:00:00 grep --color=auto postgres
B.start the postgres cluster:
[root@master ]# systemctl start postgresql-10[root@master ]# ps -ef|grep postroot 2271 1 0 17:21 ?00:00:00 /usr/libexec/postfix/master -wpostfix2274 2271 0 17:21 ?00:00:00 pickup -l -t unix -upostfix2275 2271 0 17:21 ?00:00:00 qmgr -l -t unix -uroot 5171 3519 0 18:44 pts/000:00:00 su postgrespostgres 5172 5171 0 18:44 pts/000:00:00 bashpostgres 5295 1 0 18:47 ?00:00:00 /usr/pgsql-10/bin/postmaster -D /var/lib/pgsql/10/data/postgres 5297 5295 0 18:47 ?00:00:00 postgres: logger process postgres 5299 5295 0 18:47 ?00:00:00 postgres: checkpointer process postgres 5300 5295 0 18:47 ?00:00:00 postgres: writer process postgres 5301 5295 0 18:47 ?00:00:00 postgres: wal writer process postgres 5302 5295 0 18:47 ?00:00:00 postgres: autovacuum launcher process postgres 5303 5295 0 18:47 ?00:00:00 postgres: stats collector process postgres 5304 5295 0 18:47 ?00:00:00 postgres: bgworker: logical replication launcher root 5306 5237 0 18:47 pts/000:00:00 grep --color=auto post
C. Check the database connectivity:
[root@master ]# psqlpsql: FATAL: role "root" does not exist[root@master ]# su postgres[postgres@master root]$ cd[postgres@master ]$ psqlpsql (10.3)Type "help" for help.postgres=# show data_directory; data_directory ------------------------ /var/lib/pgsql/10/data(1 row)
For More info about postgresql server start|stop|reload|restart
Step 5. Changing data directory path.
A. Stop the postgres server .
[postgres@master ]$ /usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data/ stop waiting for server to shut down.... done server stopped
B. Move the Data’s to /mnt/DATA partition:
[postgres@master ]$ rsync -av /var/lib/pgsql/10/data/* /mnt/DATA/sending incremental file listPG_VERSIONcurrent_logfilespg_hba.confpg_ident.confpostgresql.auto.confpostgresql.confpostmaster.optsbase/base/1/base/1/112......sent 41370578 bytes received 18299 bytes 16555550.80 bytes/sectotal size is 41316241 speedup is 1.00
C. Check the data directory on postgresql.conf file
[postgres@slave1 ]$ cat /mnt/DATA/postgresql.conf |grep data_directory#data_directory = 'ConfigDir' # use data in another directory
As postgres user:
change the data partition ownership.
change the data partition ownership.
[postgres@master DATA]$ /usr/pgsql-10/bin/pg_ctl -D /mnt/DATA startwaiting for server to start....2018-03-06 19:18:05.013 IST [5745] FATAL: data directory "/mnt/DATA" has group or world access2018-03-06 19:18:05.013 IST [5745] DETAIL: Permissions should be u=rwx (0700). stopped waitingpg_ctl: could not start server
Examine the log output.
Solution:
changing data partion permission as 700 then start the postgres cluster.
changing data partion permission as 700 then start the postgres cluster.
[postgres@master ]$ chmod 0700 /mnt/DATA/[postgres@master ]$ /usr/pgsql-10/bin/pg_ctl -D /mnt/DATA startwaiting for server to start....2018-03-06 19:22:47.515 IST [5920] LOG: listening on IPv6 address "::1%1", port 54322018-03-06 19:22:47.515 IST [5920] LOG: listening on IPv4 address "127.0.0.1", port 54322018-03-06 19:22:47.517 IST [5920] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"2018-03-06 19:22:47.521 IST [5920] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"2018-03-06 19:22:47.660 IST [5920] LOG: redirecting log output to logging collector process2018-03-06 19:22:47.660 IST [5920] HINT: Future log output will appear in directory "log". doneserver started
Checking postgres process whether is running or not.
[postgres@master DATA]$ ps -ef|grep postgresroot 5171 3519 0 18:44 pts/000:00:00 su postgrespostgres 5172 5171 0 18:44 pts/000:00:00 bashroot 5317 5237 0 18:48 pts/000:00:00 su postgrespostgres 5318 5317 0 18:48 pts/000:00:00 bashroot 5876 5843 0 19:22 pts/000:00:00 su postgrespostgres 5877 5876 0 19:22 pts/000:00:00 bashpostgres 5920 1 0 19:22 pts/000:00:00 /usr/pgsql-10/bin/postgres -D /mnt/DATApostgres 5921 5920 0 19:22 ?00:00:00 postgres: logger process postgres 5923 5920 0 19:22 ?00:00:00 postgres: checkpointer process postgres 5924 5920 0 19:22 ?00:00:00 postgres: writer process postgres 5925 5920 0 19:22 ?00:00:00 postgres: wal writer process postgres 5926 5920 0 19:22 ?00:00:00 postgres: autovacuum launcher process postgres 5927 5920 0 19:22 ?00:00:00 postgres: stats collector process postgres 5928 5920 0 19:22 ?00:00:00 postgres: bgworker: logical replication launcher postgres 5980 5877 0 19:28 pts/000:00:00 ps -efpostgres 5981 5877 0 19:28 pts/000:00:00 grep --color=auto postgres
Step 6: then put the application details on pg_hba.conf file the reload or restart the postgres server then check the postgres connectivity and check the data partition whether is updated or not in data_directory parameter.
[postgres@master ]$ psql psql (10.3) Type "help" for help. postgres=# postgres=# show data_directory; data_directory ---------------- /mnt/DATA (1 row)
0 comments:
Post a Comment