How to get started with Postgres on Ubuntu Linux.

This uses the employees' data from the Sakila sample schema created for MySQL. It demonstrated how to install, configure and import data on Ubuntu Linux.

Postgres is a popular open source database. Its used in the Public and Private Sector, across projects large and small. Postgres provides a way to store structured data, with a SQL interface.

In this how to we install Postgres on Ubuntu 18.04 bionic. It installs the default Postgres package in Ubuntu's apt package repository.

Once we've installed Postgres we will install git. The data we will import data is stored on github. The data imported is the MySQL employees demo data.

Postgres is easily integrated into GARNET8 Collaboration Clouds (G8CC). G8CC provides a simple efficient, secure data sharing layer. It allows you to govern, access and automate information. It empowers agility, reducing delivery and ongoing costs. You can read more about integrating Postgres and G8CC here.

Step 1 - Installing Postgres.

If your using a desktop version of Ubuntu you will need to open a terminal.

In our terminal we can make sure Ubuntu is up to date. To do this type:

sudo apt update

If you have packages to update type "Y" and wait for them to update.

Next we will install Postgres and the -contrib package. The contrib package adds functionality.

sudo apt install postgresql postgresql-contrib

Once downloaded and install you have completed the first step.

Step 2 - Loging into Postgres prompt and adding database.

Postgres uses roles for authentication and authorisation. The Postgres install creates a default user. This user has the name "postgres". You open a Postgres command prompt by typing:

sudo -u postgres psql

You exit the command prompt with \q. Before we exist we will alter the password and create a database. To alter a password in Postgres, type the following. Replace "NewPassword" with your password.

ALTER USER postgres PASSWORD 'NewPassword';

Next we create our Postgres database by typing.


You can list the databases created with \l.

Now type \q to exit the terminal.

Step 3 - Install git

You may already have git installed. In which case you can skip this step.

As we have already updated are Ubuntu operating systems. We can use the default package for git. In your terminal type:

sudo apt install git

To install git.

Step 4 - Download and import demo data.

To download the data type the following in your terminal.

git clone

This will create a directory.

cd pgsql-sample-data/employee

The above command changes are directory. Type ls to view files. One of the files will be "employees.sql". This file will be used to import our data. To import the employees data type the following command in your terminal.

psql -U postgres -h localhost employees < employees.sql

The prompt will request your password. Type that and press enter.

We can now log back into our Postgres prompt.

sudo -u postgres psql

To connect to our "employees" database type:

\c employees

Next we can list the tables in our employees database.


To quite the prompt type \q.

You have successfully install Postgres and imported the employees data.

You can now connect G8CC as a data interface and sharing layer. G8CC provides a simple low code framework. It allows you to securely access, share and extend data. It achieves this within and across traditional borders.

You can see how simple it is to connect G8CC to Postgres here.

Securely share and extend data from Postgres with G8CC.

Contact us here today to reduce IT delivery costs.

With G8CC you can:

Deploy anywhere.

Deploy our Application Platform on AWS, Microsoft Azure, Google Cloud Platform (GCP), Kubernetes, private cloud.

Access Management.

G8CC's flexibility allows you to manage your data building trust. That empowers you to add value to your data across traditional borders.

Save Money.

Remove duplicated effort and wastage. Harness and build on the value of digital and data, reducing delivery and ongoing costs.

Get started by: