Compile and Install from source code
From PostgreSQL wiki
Jump to navigationJump to searchA set of instructions for building Postgres from a source archive.
Acquire the source code
From postgresql.org
The source code can be found at git.postgresql.org or in the main file browser.
From GitHub
The mirror of Postgres on GitHub provides a "Download ZIP" option.
Build+install the source code
Detailed instructions can be found in the documentation.
Red Hat requirements
The following packages are needed for building Postgres with SSL support:
sudo yum install -y bison-devel readline-devel zlib-devel openssl-devel wget ccache sudo yum groupinstall -y 'Development Tools'
Ubuntu requirements
The following packages are needed for building Postgres with including SSL support:
sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config
You might also consider installing the package libipc-run-perl if you want to run TAP tests and the package meson for building