Postgres has released the latest version of postgresql i.e. 9.5 on 07-01-2016 with major enhancements (http://www.postgresql.org/docs/9.5/static/release-9-5.html) Lets learn how to install it.
Installation: Ubuntu’s default repository contain Postgres packages so we can install them without a hassle using the apt
packaging system.
Apt stores a list of repositories or software channels in the file
/etc/apt/sources.list
and in any file with the suffix .list under the directory
/etc/apt/sources.list.d/
We will create postgresql.list file under sources.list.d directory
Add the following to the file postgresql.list
wget, which is network downloader can be used to get the key file with extension .asc for ubuntu installation. Files that contain the .asc file extension are script files that have been written in the ActionScript programming language.
To turn off wget’s output we make use of the flag –quiet or -q. Flag -o is used to log all messages to logfile. | is a pipelinewhich takes the output of a command and runs it through another.
apt-key add
adds a key
So it basically downloads the key and then adds it in one command.
To test whether it added the key or not use :
Now update the sources with:
and install postgresql 9.5
We now install pg gem for our rails application
What is lib-pq ?
is this a Pure Go Postgres driver for database/sql https://github.com/lib/pq ?
No.
libpq is the C application programmer’s interface to PostgreSQL. libpq is a set of library functions that allow client programs to pass queries to the PostgreSQL backend server and to receive the results of these queries.
We need to install libpq-dev library so that pg gem can pass queries to PostgreSQL server and also receive these queries.
Its done. We have successfully installed Postgresql 9.5 and now we can query postgresql and from rails application.