Disclaimer

Tuesday 27 October 2020

PostgreSQL-11 Text Mode/RUN file Installation

 

PostgreSQL-11 Text Mode/RUN file Installation

To specify that the installer should run in text mode, include the –mode text command line option when invoking the installer. Text-mode installations are useful if you need to install on a remote server using ssh tunneling (and have access to a minimal amount of bandwidth), or if you do not have access to a graphical interface.

In text mode, the installer uses a series of command line questions to establish the configuration parameters. Text-mode installations are valid only on Linux or Mac systems.

You must assume superuser privileges before performing a text-mode installation. At any point during the installation process, you can press Ctrl-C to abort the installation. 

To perform a text-mode installation on a Linux system, navigate to the directory that contains the installation binary file and enter:

Go to the location of PostgreSQL 11 installer(PostgreSQL-11.7-1-linux-x64-installer.run) and run the installer in text mode as below

[root@rac7 PostgreSQL]# ./PostgreSQL-11.7-1-linux-x64-installer.run --mode text

Language Selection
 
Please select the installation language
[1] English - English
[2] French - Français
[3] German - Deutsch
[4] Italian - Italiano
[5] Spanish - Español
Please choose an option [1] : 1
---------------------------------------------------------------------------
Welcome to the PostgreSQL Setup Wizard.
 
---------------------------------------------------------------------------
Please specify the directory where PostgreSQL will be installed.

 

Note: Provide the base directory for installation We have provided “/u02/PostgreSQL/11”

 

Installation Directory [/opt/2ndQuadrant/PostgreSQL]: /u02/PostgreSQL/11

 

----------------------------------------------------------------------------

Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.
 
PostgreSQL 11 : Y (Cannot be edited)
 
OmniDB [y/N] : y
 
pl-languages [y/N] : y
 
Is the selection above correct? [Y/n]: Y
 
---------------------------------------------------------------------------
Data Directory
 
Installer will initialize the PostgreSQL database in this directory. If it
already exists, this directory must be empty.

Note: Provide the data directory location We have  provided /u02/PostgreSQL/11/data

 

PostgreSQL Data Directory [/u02/PostgreSQL/11/11/data]: /u02/PostgreSQL/11/data

 

----------------------------------------------------------------------------

PostgreSQL Port

Note: provide the port number
Specify a listener port for the service. When prompted, enter the Port that the PostgreSQL service will monitor for connections. By default, PostgreSQL chooses the first available port 


The installer will initialize the PostgreSQL database server with this port
(leave as-is if you are unsure what to enter)
 
PostgreSQL Server Port [5433]:
 
---------------------------------------------------------------------------
Postgres User Password

Note: You must provide a password for the database superuser . The specified password must conform to any security policies (minimum length, use of special characters, and so on) in place on the host. After entering a password in the Password field, confirm the password and press Enter to continue.

Please enter the postgres user password :
Re-enter password :
---------------------------------------------------------------------------
Password for Database Superuser
 
Password :
Re-enter password :
---------------------------------------------------------------------------
Installation Summary
 
You are about to install PostgreSQL.
 
Please review the below information:
 

Installation Directory: /u02/PostgreSQL/11

PostgreSQL Data Directory: /u02/PostgreSQL/11/data

PostgreSQL Port: 5433

 

Click next if the information is correct

 

 

 

Press [Enter] to continue:

 

----------------------------------------------------------------------------

Please wait while Setup installs PostgreSQL on your computer.

 

 Installing

 0% ______________ 50% ______________ 100%

 #########################################

 

----------------------------------------------------------------------------

Setup has finished installing PostgreSQL on your computer.

 

Show readme file [Y/n]: Y

 

Readme
Welcome to Postgres Installer by 2ndQuadrant
============================================
 
Postgres Installer is a GUI based, user-friendly installer for PostgreSQL that
is digitally signed and certified by 2ndQuadrant. The installer is currently
available for PostgreSQL versions 9.5, 9.6, 10, 11 and 12. Postgres Installer
has the ability to run in graphical, command line, or quiet installation modes
for  Windows, macOS and Linux.
 
 
Features
========
 
Postgres Installer comes with features listed below. In addition to these, many
are in pipeline and will be available in upcoming releases.
 
. OmniDB
. PostGIS
. OpenSSL
. Python3
. Zlib
. LDAP
. Kerberos
Press [Enter] to continue:
. ICU
. Perl
. Tcl
. LLVM
 
For more details please visit.
https://www.2ndquadrant.com/en/resources/postgresql-installer-2ndquadrant/
 
 
Controlling PostgreSQL service
==============================
 
Once installer has completed installation successfully, following information
should hold true for your platform.
 
. Service name: postgresql-2ndQ-11
 
Open terminal and type following commands
 
. Status: sudo service "postgresql-2ndQ-11" status
. Start:  sudo service "postgresql-2ndQ-11" start
. Stop:   sudo service "postgresql-2ndQ-11" stop
 
Press [Enter] to continue:
 
Connect to PostgreSQL via psql
==============================
 
. Open terminal
. Change directory: cd  /u02/PostgreSQL/11/11/bin
. Connect with PostgreSQL by via psql client: ./psql -U postgres -d postgres -p
5433
 
Type in your 'postgres' superuser password. This should be the same as supplied
during installation on Database Superuser Password screen
Once connected, you can key in SQL queries as you like. Please refer to psql
documentation for help on using psql client.
 
https://www.postgresql.org/docs/9.4/static/app-psql.html
 
 
Connect to PostgreSQL via OmniDB
================================
 
OmniDB is an interactive and powerful, yet lightweight, browser-based database
management tool. OmniDB allows users to manage multiple databases in a unified
workspace with a user-friendly and fast-performing interface.  Despite its light
Press [Enter] to continue:
design, OmniDB is a reliable and comprehensive web tool with many facilitating
characteristics to easily add, edit and manage multiple databases
 
Usage instructions
==================
 
Open terminal and follow these steps
 
. Change directory: cd /u02/PostgreSQL/11/OmniDB
. Start OmniDB server: ./omnidb-server
. Port number will be shown inside the terminal once server is started
. Open your favorite browser and type in following URL to connect with OmniDB:
http://localhost:Port_Number --default OmniDB port is 8000
. Once you can see the OmniDB login screen please enter following credentials
  User name = admin
  Password =  admin
 
For detailed instructions on usage please visit:
https://omnidb.org/en/documentation-en/
 
For more OmniDB details and features please visit
. https://www.2ndquadrant.com/en/resources/omnidb/
. https://www.omnidb.org/en/
Press [Enter] to continue:
 
 
Getting started with PostGIS
============================
 
PostGIS is a spatial database extender for PostgreSQL object-relational
database. It add support for geographic objects allowing location queries to be
run in SQL.
 
NOTE: PostGIS is not supported for PostgreSQL 12 yet
 
Some of the extensions required for PostGIS.
 
. CREATE EXTENSION postgis;
. CREATE EXTENSION fuzzystrmatch; -- needed for postgis_tiger_geocoder
                                  -- optional used by postgis_tiger_geocoder,
                                  -- or can be used standalone
. CREATE EXTENSION postgis_tiger_geocoder;
. CREATE EXTENSION postgis_topology;
 
NOTE: GDAL DATA will need to be configured manually based on where you have
placed it. Path to default GDAL DATA directory is listed below:
 
Press [Enter] to continue:
. /u02/PostgreSQL/11/11/gdal
 
Set PostGIS DATA directory path by running following command inside PSQL.
 
. set postgis.gdal_datapath = '/u02/PostgreSQL/11/11/gdal';
 
Please refer to PostGIS documentation here
(https://postgis.net/docs/postgis_gdal_datapath.html) on how you can configure
GDAL DATA directory for your platform.
 
Please visit PostGIS official website for more details about PostGIS.
https://postgis.net/
 
 
Introduction to ICU
===================
ICU stands for International Components for Unicode. It provide the ability to
handle postgres database and run queries on your local language i,e.
 
. English
. French
. German
. Italian
Press [Enter] to continue:
 
And many more of course. You can run query below to see which languages are
supported
 
NOTE: Database encoding needs to be set before using ICU.
 
. create database db_name ENCODING 'UTF-8';
. select * from pg_collation;
 
NOTE: ICU is not supported on PostgreSQL 9.5 and 9.6
 
Introduction to Perl
====================
PL/Perl (Procedural Language/Perl) is a procedural language supported by the
PostgreSQL RDBMS.
PL/Perl, as an imperative programming language, allows more control than the
relational algebra of SQL. Programs created in the PL/Perl language are called
functions and can use most of the features that the Perl programming language
provides,
 
Setting up Perl
===============
. Open terminal
Press [Enter] to continue:
. Connect to 'psql'
. Run query 'CREATE LANGUAGE plperl;'
 
And you are done now you can create any function that you want
 
 
Introduction to Tcl
===================
PL/Tcl is a loadable procedural language for the PostgreSQL database system that
enables the Tcl language to be used to write functions and trigger procedures.
 
Setting up Tcl
==============
. Open terminal
. Connect to 'psql'
. Run query 'CREATE LANGUAGE pltcl;'
 
 
LLVM
====
Just-in-Time (JIT) compilation is the process of turning some form of
interpreted program evaluation into a native program, LLVM has support for
optimizing generated code. Some of the optimizations are cheap enough to be
Press [Enter] to continue:
performed whenever JIT is used, while others are only beneficial for
longer-running queries. long running queries that are CPU bound will benefit
from JIT compilation
 
NOTE: LLVM is only avialable in PostgreSQL-11 and above
 
. create table t1 (id serial);
. insert INTO t1 (id) select * from generate_series(1, 10000000);
. set jit = 'on'; set jit_above_cost = 10; set jit_inline_above_cost = 10; set
jit_optimize_above_cost = 10;
. explain analyze select count(*) from t1; -- See JIT section for results
. explain (analyze, verbose, buffers) select count(*) from t1; -- See JIT
section for results
 
 
Bug Reports and Feedback
========================
For bug reports and  feedback, please contact via pginstaller@2ndquadrant.com or
use our contact form on our Postgres Installer page:
https://www.2ndquadrant.com/en/resources/postgresql-installer-2ndquadrant/
 
 
Contact Us
Press [Enter] to continue:
Press [Enter] to continue:
==========
 
2ndQuadrant Ltd
 
7200 The Quorum
Oxford Business Park North
Oxford, OX4 2JZ
United Kingdom
 
Phone:   +44 870 766 7756
Fax:     +44 870 838 1077
Email:   info@2ndQuadrant.com
 
For detailed queries please visit our website: https://2ndQuadrant.com
 
 
 
Press [Enter] to continue:
[root@rac7 PostgreSQL]#

[root@rac7 PostgreSQL]#

[root@rac7 PostgreSQL]#

[root@rac7 PostgreSQL]#

 

After the installation, you need to set environment variables. There is a pg_env.sh file in which all environment variables are exported in /u02/PostgreSQL/11 (which base installation directory). You can run that file to set env settings Or you can set it in .bash_profile where every postgres user login env file gets run.

Open the bash file $vi .bash_profile   and Enter the below line:


source /u02/PostgreSQL/11/pg_env.sh

 

=========================================================================
Another Example:-
=========================================================================

[root@rac5 ~]# adduser postgres
[root@rac5 ~]#
[root@rac5 ~]# 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@rac5 ~]# cd /u01
[root@rac5 u01]# mkdir PostgreSQL
[root@rac5 u01]# cd PostgreSQL/
[root@rac5 PostgreSQL]# pwd
/u01/PostgreSQL
[root@rac5 PostgreSQL]#
[root@rac5 PostgreSQL]# chown -R postgres:postgres /u01/PostgreSQL



[root@rac5 Desktop]# ./PostgreSQL-10.9-1-linux-x64-installer.run --mode text
Language Selection

Please select the installation language
[1] English - English
[2] French - Français
[3] German - Deutsch
[4] Italian - Italiano
[5] Spanish - Español
Please choose an u01ion [1] : 1
----------------------------------------------------------------------------
Welcome to the PostgreSQL Setup Wizard.

----------------------------------------------------------------------------
Please specify the directory where PostgreSQL will be installed.

Installation Directory [/u01/2ndQuadrant/PostgreSQL]: /u01/PostgreSQL

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.

PostgreSQL 10 : Y (Cannot be edited)

OmniDB [y/N] : N

pl-languages [y/N] : y

Is the selection above correct? [Y/n]: Y

----------------------------------------------------------------------------
Data Directory

Installer will initialize the PostgreSQL database in this directory. If it
already exists, this directory must be empty.

PostgreSQL Data Directory [/u01/PostgreSQL/10/data]:

----------------------------------------------------------------------------
PostgreSQL Port

The installer will initialize the PostgreSQL database server with this port
(leave as-is if you are unsure what to enter)

PostgreSQL Server Port [5432]:

----------------------------------------------------------------------------
Postgres User Password

Please enter the postgres user password :
Re-enter password :
----------------------------------------------------------------------------
Password for Database Superuser

Password :
Re-enter password :
----------------------------------------------------------------------------
Installation Summary

You are about to install PostgreSQL.

Please review the below information:

Installation Directory: /u01/PostgreSQL
PostgreSQL Data Directory: /u01/PostgreSQL/10/data
PostgreSQL Port: 5432

Click next if the information is correct



Press [Enter] to continue:

----------------------------------------------------------------------------
Please wait while Setup installs PostgreSQL on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################

----------------------------------------------------------------------------
Setup has finished installing PostgreSQL on your computer.


Now check the postgres service 

[root@rac5 Desktop]# ps -ef | grep postgres
postgres  24319      1  0 00:33 ?        00:00:00 /u01/PostgreSQL/10/bin/postgres -D /u01/PostgreSQL/10/data -p 5432
postgres  24321  24319  0 00:33 ?        00:00:00 postgres: checkpointer process
postgres  24322  24319  0 00:33 ?        00:00:00 postgres: writer process
postgres  24323  24319  0 00:33 ?        00:00:00 postgres: wal writer process
postgres  24324  24319  0 00:33 ?        00:00:00 postgres: autovacuum launcher process
postgres  24325  24319  0 00:33 ?        00:00:00 postgres: stats collector process
postgres  24326  24319  0 00:33 ?        00:00:00 postgres: bgworker: logical replication launcher
root      24374  17286  0 00:34 pts/0    00:00:00 grep --color=auto postgres
[root@rac5 Desktop]#




==============SETTING HOME PATH & ENV PATH=====================

[root@postgres Desktop]# vi /etc/passwd

postgres:x:26:26:PostgreSQL Server:/u01/PostgreSQL/10:/bin/bash

:wq


[root@postgres Desktop]# cd /u01/PostgreSQL/10/

[root@postgres 10]# cp /root/.bash_profile .

[root@postgres 10]# cat pg_env.sh 
#!/bin/sh
# The script sets environment variables helpful for PostgreSQL

export PATH=/u01/PostgreSQL/10/bin:$PATH
export PGDATA=/u01/PostgreSQL/10/data
export PGDATABASE=postgres
export PGUSER=postgres
export PGPORT=5432
export PGLOCALEDIR=/u01/PostgreSQL/10/share/locale
export MANPATH=$MANPATH:/u01/PostgreSQL/10/share/man



# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
export PATH=/u01/PostgreSQL/10/bin:$PATH
export PGDATA=/u01/PostgreSQL/10/data
export PGDATABASE=postgres
export PGUSER=postgres
export PGPORT=5432
export PGLOCALEDIR=/u01/PostgreSQL/10/share/locale
export MANPATH=$MANPATH:/u01/PostgreSQL/10/share/man

:wq



psql -p 5432 -U postgres -d postgres



***********************************************************************************



[root@rac5 ~]# mkdir -p /data1/samik_postgres
[root@rac5 ~]#
[root@rac5 ~]# chown -R postgres:postgres /data1/samik_postgres
[root@rac5 ~]#
[root@rac5 ~]#
[root@rac5 ~]# su - postgres
Last login: Wed Aug  7 23:15:40 IST 2019 on pts/2
-bash-4.2$
-bash-4.2$
-bash-4.2$ initdb -D /data1/samik_postgres ---------------------------------------------------------to start the service
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 /data1/samik_postgres ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Kolkata
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the u01ion -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 /data1/samik_postgres -l logfile start






No comments:

Post a Comment

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...