25th Anniversary Savings | 25% Off Dedicated Servers*Shop Now
25th Anniversary Savings | 25% Off VPS Hosting* †††Shop Now
Limited Inventory: High-Performance AMD-Powered Servers Now Available.* Shop Now >
Dedicated Hosting Deals | From $99/moShop Now

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 http://yum.postgresql.org/9.4/fedora/fedora-23-x86_64/pgdg-fedora94-9.4-4.noarch.rpm

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/multi-user.target.wants/postgresql-9.4.service 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:

About the Author: dpepper

Latest Articles

cPanel EA NGINX vs Engintron: What is the Best Option?

Read Article

cPanel EA NGINX vs Engintron: What is the Best Option?

Read Article

What Is Umask and How to Use it Effectively

Read Article

Troubleshooting: Too Many Redirects

Read Article

What Is a Time Series Database? How It Works & Use Cases

Read Article