PostgreSQL is a powerful object-relational database management system, provided under a flexible BSD-style license. PostgreSQL contains many advanced features, is very fast and standards compliant.
PostgreSQL has bindings for many programming languages such as C, C++, Python, Java, PHP, Ruby… It can be used to power anything from simple web applications to massive databases with millions of records.
In this video tutorial, we will cover how to install PostgreSQL 9.6 on Ubuntu 16.04 LTS Xenial server
Step 1: Add PostgreSQL Apt Repository
– Add PostgreSQL apt repository
# echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' >> /etc/apt/sources.list.d/pgdg.list
– Import the repository signing key, and update the package lists
# wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Step 2: Install PostgreSQL
# sudo apt-get update # sudo apt-get install postgresql postgresql-contrib
Step 3: Connect to PostgreSQL
– After installing PostgreSQL database server, by default PostgreSQL, will create a system account user ‘postgres’ and a user named ‘postgres’ with role ‘postgres’.
– To connect use the following commands:
# sudo su - postgres # psql
Step 4: Usage Examples
– check log info
# \conninfo
– Change the password of postgres role
# \password postgres
– List databases
# \list # \l
– Connect to a database:
# \c database_name
– List all the tables
# \d
– Leave the psql command line
# \q
We hope this tutorial was enough Helpful. If you need more information, or have any questions, just comment below and we will be glad to assist you!