How To Install and Connect to PostgreSQL on Fedora 23

Posted on by dpepper
Category: Tutorials | Tags: Fedora 23, postgres
Reading Time: 2 minutes

PostgreSQL is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It often is used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check

Step #1: Add the PostgreSQL 9.4 Repository

In this case we want to install PostgreSQL 9.4.4 directly from the Postgres repository. First, we’ll add the repo:

rpm -iUvh

Step #2: Install PostgreSQL

First, we’ll observe best practices by ensuring that the list of available packages is up to date:

dnf -y update

Then it’s a matter of running one command for installation:

dnf -y install postgresql94 postgresql94-server postgresql94-contrib postgresql94-libs --enablerepo=pgdg94

PostgreSQL now should be installed.

Step #3: Start PostgreSQL

Configure Postgres to start when the server boots:
systemctl enable postgresql-9.4

That should produce output similar to the following:

[root@host ~]# systemctl enable postgresql-9.4
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/postgresql-9.4.service.

Initialize Postgres with the following command:

/usr/pgsql-9.4/bin/postgresql94-setup initdb

Which should result in:

/usr/pgsql-9.4/bin/postgresql94-setup initdb
Initializing database ... OK

Then start Postgres:

systemctl start postgresql-9.4

Step #4: Switch to the Default PostgreSQL User

As part of the installation, Postgres adds the system user “postgres” and is setup to use “ident” authentication. Roles internal to Postgres (which are similar to users) match with a system user account.

Let’s switch into that system user:

su - postgres

You’ll receive a command line similar to:


And then connect to the PostgreSQL terminal (in the postgres role):


To quit psql, type:


and to return to the previous user, type:

Avatar for dpepper

About the Author: dpepper

Latest Articles

10 Python Tips and Tricks for Data Science Projects

Read Article

How to Upload Information to VMware through SFTP

Read Article

Accessing Man Pages on Ubuntu 16.04 LTS

Read Article

Premium Business Email Pricing FAQ

Read Article

Microsoft Exchange Server Security Update

Read Article