How To Install Postgresql 11 On Linux Mint 19 Tara
How To Install Postgresql 11 On Linux Mint 19 Tara
The installation process for PostgreSQL 11 on Ubuntu or Linux Mint is, like a lot of things in the Linux world,
less than intuitive for new users. As much for my own benefit as anyone else's, Now I am going to walk
through the steps to getting PostgreSQL installed and configured on a Linux box.
As of this writing, the most up-to-date version of PostgreSQL is version 11, released at 2018-10-18.
However, the 11 release is not available directly using the Advanced Packaging Tool (APT) or the Linux Mint
Software Manager.
Fortunately, the PostgreSQL Global Development Group (PGDG) maintain an apt repository of PostgreSQL
packages for Debian and Ubuntu-derived Linux distros, located at http://apt.postgresql.org/pub/repos/apt/
Before we can install PostgreSQL, we have to add the package source for the distro we are currently using.
In this case, I have been using Linux Mint 19 Tara, which is derived from (and therefore should be
compatible with) Ubuntu 18.04 ("Bionic Beaver") release. We'll understand why this matters in a short while.
Create a file at
/etc/apt/sources.list.d/postgresql.list with the following command:
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" > \
/etc/apt/sources.list.d/postgresql.list'
Update system package source. Once this task is done, we proceed with upgrade packages to the latest
versions.
Please note that this can be a long process. Also, you may be prompted at several points to make some
choices about configuration items. Specifically, you may informed that this that or the other configuration file
has been changed, and asked if you want to keep your original version, or replace with the package
maintainer’s version. Select "Y" to accept the package maintainer’s version in these cases.
After pressing "Enter" you will be asked whether to continue with installation or not.
Press "Y" and then "Enter". It will then download all necessary files and continue with installation.
While PostgreSQL become installed, a system user account named postgres was also created with an
identical user account in postgres. By default, the postgres user account isn't configured with a password, so
it isn't viable to log into the server the use of the postgres user account without first creating a password for it.
This postgres account has an all-access pass on your PostgreSQL database server, permission-wise.
The postgres user account has similarities to the sa account in SQL server.
PostgreSQL is installed with a default database postgres . For the most part, we use the postgres database
for administration functions, and create new databases on the PostgreSQL server to suit our needs.
The psql Command Line Utility
PostgreSQL consists of psql , a command line application for managing your databases and server. While a
GUI-based software such as pgadmin3 is often less complicated to use in the daily task, the command line
utilty psql is always handy. psql gives total control of your postgres system from the terminal, together with
the ability to execute SQL queries.
We will use psql to perform our preliminary configuration and to create an initial database super user.
In this step we will super-user account to deals with our database in the daily task.
To do this, we will get access to the postgres account through your machine root user. Then we'll use
that postgres account to create a brand new super-user account for your PostgreSQL installation which can
be regulated more efficiently. As an example we will use adjie as our new PostgreSQL super-user account.
$ sudo su -
[sudo] password for adjie:
# su - postgres
$ psql
postgres=# CREATE USER adjie
Notice in the above we can enter multiple lines of command in SQL shell. The SQL is not executed until
semi-colon followed enter is found. Which means, the semi-colon will make the shell execute entered
commands. After pressing "Enter" it will respond with something like this:
CREATE ROLE
postgres=#
Let's verify that everything is working correctly. Try to log in with psql using our new super-user account and
create a quick test database:
$ psql postgres
psql (11.0 (Ubuntu 11.0-1.pgdg18.04+2))
Type "help" for help.
postgres=#
Note in the above terminal session, we specified the postgres default database when we logged in, since
there aren’ tyet any other databases to connect to.
Next test is to create test database test_database using our new super-user account:
postgres=# CREATE DATABASE test_database WITH OWNER adjie;
CREATE DATABASE
postgres=# \connect test_database;
You are now connected to database "test_database" as user "adjie".
test_database=#
If everything works as shown, then congratulations. Now you have a working installation of PostgreSQL 11
on Linux Mint 19 Tara.
Optional step
If you would like to manipulate your database in graphical mode, then pgadmin4 is the way to go. Install
pgadmin4 by issuing this command:
After pressing "Enter" you will be asked whether to continue with installation or not, something like this:
Press "Y" and then "Enter". It will then download all necessary files and continue with installation.
Final Words
I hope that you now know how to install PostgreSQL 11 on Linux Mint 19 Tara. If you run into any issues
or have any feedback feel free to drop a comment below.
Reference
https://wiki.postgresql.org/wiki/Apt
https://r00t4bl3.com/post/how-to-install-postgresql-11-on-linux-mint-19-tara