postgres install - ghdrako/doc_snipets GitHub Wiki

Binary install

cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
  1. Follow instruction https://www.postgresql.org/download
  2. https://download.postgresql.org/pub/repos/yum/15/redhat/rhel-9-x86_64/
  3. Install
yum localinstall postgresql15-libs-15.0-1PGDG.rhel8.x86_64.rpm postgresql15-15.0-1PGDG.rhel8.x86_64.rpm postgresql15-server-15.0-1PGDG.rhel8.x86_64.rpm -y
  1. Inicialize:
# /usr/pgsql-15/bin/postgresql-15-setup initdb
  1. Sturtup
systemctl start postgresql-15.service
systemctl status postgresql-15.service
systemctl enable postgresql-15.service

Installation from source

download the latest version of PostgreSQL from their official website at https://ftp.postgresql.org/pub/source/v15.0/ after select your host operating system and version and follow the installation instructions.

  1. tar -xzf postgresql-15.0.tar.gz
  2. useradd -d /home/postgres/ postgres
mkdir -p /pg_install/pgv150 
mkdir -p /pg_data/DATA
chown -R postgres:pos
tgres /pg_install/pgv150 
chown -R postgres:postgres /pg_data/DATA
cd postgresql-15.0 
./configure --prefix=/pg_install/pgv150/
make
make install
  1. Inicjalize database
su - postgres 
/pg_install/pgv150/bin/initdb -D /pg_data/DATA/
  1. start the database cluster
VI postgres.conf
/pg_install/pgv150/bin/pg_ctl -D /pg_data/DATA/ -l logfile start