PostgreSQL is a powerful, open source object-relational database system ( ORDBMS ). Unlike other relational database systems, PostgreSQL (Postgres) allows users to create unique operators, complex data types, aggregate functions, data type conversion character, and other various database objects through the SQL function.
In this article, we are going to show you how to install PostgreSQL 10 database on Ubuntu 16.04 LTS. The latest stable release 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 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-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 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
Conclusion
You have successfully installed the PostgreSQL 10 database server on on Ubuntu 16.04 LTS and Ubuntu 18.04 LTS system. Here are some more guides that cover how to use PostgreSQL (Postgres):
- How To Enable Network Remote Access To PostgreSQL Database Server
- how to install PgAdmin 4 in Server Mode as a web application using apache2 and Wsgi module on Ubuntu 16.04 LTS and Ubuntu 18.04 LTS
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!
PS. If you like this post please share it with your friends on the social networks using the buttons below.Thanks.
2 comments
In case you got ” Unable to locate package postgresql10″
It is sudo apt-get install postgresql-10 and not sudo apt-get install postgresql10
Hi Patrice,
Thanks for the comment, we already updated the article .