PostgreSQL, as we know is an Open Source RDBMS. Since I am not that much into Database, I don’t know how it compares with MySQL.My focus on this post is on how to install it on a Linux server. Lets start with it
Download source-code. First step will be to download the source-code from its official site. Choose the version that you want to install. I chose 9.3.5 since this was my requirement. I downloaded the zipped tar file. Choose any one that suits you. Its around 21MB in size.
Unpack the tar file. Now we need to untar the downloaded file & configure it to prepare installation. Issue below command to untar it.
tar -xvf postgresql-9.3.5.tar.gz
Do a listing of the pwd (present working directory) & see if a new directory is created or not. Now move to this directory. By default, PostgreSQL is installed under /usr/local/pgsql directory. If you want to install it here, just run the configuration script, that is :
./configure
If you want it to be installed somewhere else, then issue :
./configure -prefix=/opt/PostgreSQL/9.3.
Prefix means the directory where you want to install it. Choose accordingly. This step will take some time, So, be patient ?
You may run into a few errors like : –
configure: error: readline library not found
configure: error: zlib library not found.
To fix it, install these packages.
readline-devel.x86_64 & zlib-devel.x86_64
Make sure to use packages for your architecture.
Build installer & run installer. Now that we have configured the source, we can now make the installer & install PostgreSQL. Just issue
make