How to install and use PostgreSQL 10 on Ubuntu 16.04 LTS?

PostgreSQL is a powerful, open source object-relational database system ( ORDBMS ). Unlike other relational database systems, PostgreSQL allows users to create unique operators, complex data types, aggregate functions, data type conversion character, and other various database objects through the SQL function.

PostgreSQL 10 includes such enhancements as

  • Logical replication using publish/subscribe
  • Declarative table partitioning
  • Improved query parallelism
  • Significant general performance improvements
  • Stronger password authentication based on SCRAM-SHA-256
  • Improved monitoring and control

Step 1: Add PostgreSQL Apt Repository

– Add PostgreSQL apt repository

# echo 'deb xenial-pgdg main' >> /etc/apt/sources.list.d/pgdg.list

– Import the repository signing key, and update the package lists

# wget --quiet -O - | sudo apt-key add -

Step 2: Install PostgreSQL

# sudo apt-get update
# sudo apt-get install postgresql-10

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 using 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

Done !!

For any technical support,  hire our expert.

Was this answer helpful? 0 Users Found This Useful (0 Votes)