PostgreSQL Installation

PostgreSQL Installation

1.Community PostgreSQL (Open Source)
1.Binary(Packages)
2.Source
3.RPM(Redhat Package Management)
2.Enterprisedb
1.Run File
1.GUI Mode
2.Text Mode
2.Repository(yum Installation)

1.Community PostgreSQL Installation:

Binary Installation:(Online Installation - Internet Must)

Step 1:
goto https://www.postgresql.org/ and click Download Choose Packages on Top Left Cornor
Step 2:
Select Your Operating System. Choose Linux and select your Linux distribution(Redhat/centos).
Step 3:
Select PostgreSQL Version. Example Choose 12
Step 4:
Select Linux Platform. Example select Red Hat enterprise, CentOS, Scientific or Oracle version 7
Step 5:
Select OS architecture Type. Example Select x86_64
Step 6: Copy the Script and paste your terminal
Example:
# Install the repository RPM:
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Install PostgreSQL:
yum install postgresql12-server

# Optionally initialize the database and enable automatic start:
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12

Source Installation:(Offline Installation)

Step 1:
goto https://www.postgresql.org/ and click Download Choose Source on Top Left Cornor
Step 2:
Click PostgreSQL Version. Example click 12.3
Step 3:
choose tar.gz formate file. Example: postgresql-12.3.tar.gz
Step 4:
Untar the postgresql-12.3.tar.gz file
Example:
tar -xvzf postgresql-12.3.tar.gz
Step 5:
Open Untar Directory.
Example:
cd postgresql-12.3/
Step 6:
./configure or ./configure --prefix=/opt/PostgreSQL
options:
--prefix=PREFIX    install architecture-independent files in PREFIX [/usr/local/pgsql]
Step 7: 
make && make install
Step 8:
Create data Directory next Change owner & permission
Example:
mkdir /data
chown -R postgres:postgres /data
chmod 700 /data
Step 9:
Installation the database Cluster
Example:
su - postgres
cd /usr/local/pgsql/bin/   -->your prefix path/bin/
./initdb -D /data
Step 10:
Start the server
su - postgres
cd /usr/local/pgsql/bin/
./pg_ctl -D /data start

RPM Installation:

Step 1:
goto https://yum.postgresql.org/rpmchart/ next Select PostgreSQL version and OS Version with architecture Type.
Example:
goto postgresql version and click RHEL/CentOS/Oracle Linux 7 - x86_64
Step 2:
click PostgreSQL Database Server 12 PGDG
Step 3:
click download follow Package
Example:
    postgresql12 - PostgreSQL client programs and libraries
    postgresql12-contrib - Contributed source and binaries distributed with PostgreSQL
    postgresql12-libs - The shared libraries required for any PostgreSQL clients
    postgresql12-server - The programs needed to create and run a PostgreSQL server
Step 4:
Install RPM Packages
Example:
rpm -ivh postgresql12-12.3-5PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql12-contrib-12.3-5PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql12-libs-12.3-5PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql12-server-12.3-5PGDG.rhel7.x86_64.rpm
Step 5:
Create data Directory next Change owner & permission
Example:
mkdir /rpm_data
chown -R postgres:postgres /rpm_data
chmod 700 /rpm_data
Step 6:
Installation the database Cluster
Example:
su - postgres
cd /usr/local/pgsql/bin/   -->your prefix path/bin/
./initdb -D /rpm_data
Step 7:
Start the server
su - postgres
cd /usr/local/pgsql/bin/
./pg_ctl -D /rpm_data start

2.Enterprisedb Installation:(Download only for Register members)

Run File Installation:

Step 1:
goto https://www.enterprisedb.com/ and click Downloads option
Step 2:
click EDB Postgres Advanced Server Option and select version 10
note:
Advanced Server Installation Prerequest:(Redhat family)
set SELINUX=permissive on /etc/selinux/config file
step 3:
Click your OS and architecture
example:
choose Linux X86-64 Interactive Installer and automatically Download

GUI Mode Installation:

Step 1: Run edb-as10-server-10.12.20-1-linux-x64.run file
Example:
./edb-as10-server-10.12.20-1-linux-x64.run
1.open GUI window click next button accept the aggreement click next button
2.choos installation Directory click next button
3.select components and click next choose data directory and wal directory
4.click next button  choose compatible with oracle option click next button
5.choose password and click next button choose port
6.click next button select General Purpose and click next select Transaction Processing
7.click next button list the options next click to install

Text Mode Installation:

Step 1: Run edb-as10-server-10.12.20-1-linux-x64.run file
Example:
./edb-as10-server-10.12.20-1-linux-x64.run --mode text

Repository Installation:(yum Method or Online)

Step 1:
goto https://www.enterprisedb.com/ and click Downloads option
Step 2:
click EDB Postgres Advanced Server Option and select version 12
Step 3:
choose Linux x86_64 and click Access Repo
Step 4:
choose yum and next open new web page
Step 5:
select platform and select software
example:
select RHEL/CentOS 7- x86_64
select EDB Postgres Advanced Server choose 12
copy script and paste your terminal

Script:

# Install the repository configuration
yum -y install https://yum.enterprisedb.com/edbrepos/edb-repo-latest.noarch.rpm

# Replace 'USERNAME:PASSWORD' below with your username and password for the EDB repositories
# Visit https://www.enterprisedb.com/user to get your username and password
sed -i "s@<username>:<password>@USERNAME:PASSWORD@" /etc/yum.repos.d/edb.repo

# Install EPEL repository
yum -y install epel-release

# Install selected packages
yum -y install edb-as12-server 

# Initialize Database cluster
PGSETUP_INITDB_OPTIONS="-E UTF-8" /usr/edb/as12/bin/edb-as-12-setup initdb

# Start Database server
systemctl start edb-as-12

# Connect to the database server
# sudo su - enterprisedb
# psql postgres

Comments

Popular posts from this blog

PostgreSQL pg_pool-II Installation and Configuration

PostgreSQL Migration Using MTK

PostgreSQL Pages and Tuples