Monday 2 August 2021

PostgreSQL 9.0.x source installation

In this blog i will cover how to do a source installation PostgreSQL lower (outdated) version.

This will be helpful when you want to test your setup other than prod. 


We have all source packages available here, https://www.postgresql.org/ftp/source/


PostgreSQL Version : 9.0.23

OS : Opensuse Leap 15.3


Installing python package (make sure you have gcc devel packages installed)


zypper install python-base



Download uuid and extract it  (for source installation we need )


wget https://src.fedoraproject.org/repo/pkgs/uuid/uuid-1.6.2.tar.gz/5db0d43a9022a6ebbbc25337ae28942f/uuid-1.6.2.tar.gz

tar -xf uuid-1.6.2.tar.gz


Configure and install it 


cd uuid-1.6.2/

./configure

make -j20

make install


Download source package and extract it 


wget https://ftp.postgresql.org/pub/source/v9.0.23/postgresql-9.0.23.tar.bz2

tar -xf postgresql-9.0.23.tar.bz2


Configure and install it 


cd postgresql-9.0.23/

./configure --with-python

make -j20

make install

cd contrib

make all

make install

export PATH=/usr/local/pgsql/bin:$PATH



During configure if you get below readline error please follow the fix given below 


Expected error

 


Fix (need to install readline-devel)


zypper install readline-devel



Create the user and required folders


groupadd postgres  

useradd -G postgres postgres

passwd postgres

mkdir /home/postgres/ 

mkdir /usr/local/pgsql/data/ 

mkdir /var/log/postgres/ 

chown postgres.postgres /home/postgres/ 

chown postgres.postgres /usr/local/pgsql/data/ 

chown postgres.postgres /var/log/postgres

export PATH=/usr/local/pgsql/bin:$PATH



Switch to postgres user and initialize the db and we can start the service 


su postgres

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data --encoding=UTF8 --lc-collate=en_US.UTF-8 --locale=en_US.utf8

/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start




You can login to the DB ,