PostgreSQL Installation – Using Source Code vs apt-get on Ubuntu

installationpostgresqlUbuntu

I want to install PostgreSQL on a server that runs Ubuntu 14.04.2 LTS.

I understand that I have two options:

  1. Install PostgreSQL using the source code distribution
  2. Install PostgreSQL using apt-get install postgresql postgresql-contrib with these instructions.

Which option should I use?

  • Will there be a difference in the outcome?
  • Will both options result in the same set up and configuration (assuming I choose the default installation with option #1)?
  • Is there a situation where I would prefer option #1 over option #2 and vice versa?

Best Answer

If you install from apt-get you will be able to use apt-get upgrade option later and other apt-get build in options (available from Ubuntu). Furthermore apt-get installs binaries and manages their versions. You just install and nothing more.

Installing from source gives you the ability to do a more detailed installation. (You can customize the build and installation process with command line options connected to ./configure PARAMETERS LIST.) It's useful if you need a feature that can be enabled only by compiling the package yourself. Next thing is that installation from source may not be visible to apt-get commands so you may not be able to use them.

But if you need to install Postgres stable version without any specialized functionalities use apt-get option.