THIS NOTES WILL PROVIDE A BRIEF IDEA
ABOUT THE INSTALLATION OF
POSTGRESQL USING RPM PACKAGES.
THINGS MAY VARY DEPENDING ON THE
OS CONFIGURATION
Prepared By: Subham Dash
PostgreSQL
Installation
Using
RPM
Packages
1. Go to the PostgreSǪL Download site
[Link]
2. Select Package installation,choose the OS family,scroll down to bottom and click on
directdownload.
[Link]
3. Select the required PostgreSǪL version
4. Download the 4 RPM packages (PGDG, CONTRIB, LIB, SERVER)
postgresql15-15.6-1PGDG.rhel9.x86_64.rpm
wget [Link]
1PGDG.rhel9.x86_64.rpm
postgresql15-contrib-15.6-1PGDG.rhel9.x86_64.rpm
wget [Link]
x86_64/postgresql15- contrib-15.6-1PGDG.rhel9.x86_64.rpm
postgresql15-libs-15.6-1PGDG.rhel9.x86_64.rpm
wget [Link]
x86_64/postgresql15-libs- 15.6-1PGDG.rhel9.x86_64.rpm
postgresql15-server-15.6-1PGDG.rhel9.x86_64.rpm
wget [Link]
x86_64/postgresql15- server-15.6-1PGDG.rhel9.x86_64.rpm
5. Check the downloaded packages
6. Install the RPM packages
rpm -ivh postgresql15-15.6-1PGDG.rhel9.x86_64.rpm
rpm -ivh postgresql15-contrib-15.6-1PGDG.rhel9.x86_64.rpm
rpm -ivh postgresql15-libs-15.6-1PGDG.rhel9.x86_64.rpm
rpm -ivh postgresql15-server-15.6-1PGDG.rhel9.x86_64.rpm
7. Give data directory permission and ownership to postgres user
Data directory: /PostreSǪL/data
chown -R postgres:postgres /PostreSǪL/data/
chmod -R 700 /PostgreSǪL/data/
8. Switch user to postgres
su – postgres
9. Initializing database using initdb utility
/usr/pgsql-15/bin/initdb -D /PostreSǪL/data/
10. Configuring some basic database parameters
# DB Version: 15
# OS Type: linux
# DB Type: web
# Total Memory (RAM): 32 GB
# Data Storage: ssd
max_connections = 200 checkpoint_completion_target =
shared_buffers = 8GB 0.9
effective_cache_size = 24GB wal_buffers = 16MB
maintenance_work_mem = 2GB default_statistics_target = 100
random_page_cost = 1.1 huge_pages = try
effective_io_concurrency = 200 min_wal_size = 1GB
work_mem = 20971kB max_wal_size = 4GB
11. Start the PostgreSQL server
12. Login to the console
Psql -U postgres -d postgres
-U -> Username
-d -> Database name