Installing PostgreSQL from Source on Slackware64

Home / Installing PostgreSQL from Source on Slackware64

PostgreSQL, often simply “Postgres”, is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards-compliance. With more than 15 years of development history, it is quickly becoming the de facto database for enterprise level open source solutions.

In this article we will discuss about how to install PostgreSQL from source on Slackware64. Our objective is to make PostgreSQL installed and running on our machine.

The PostgreSQL we will use is the PostgreSQL 9.3.5

Obtain Material

The PostgreSQL is freely distributed under open source flag. You can go to PostgreSQL download page to obtain the source code. For version 9.3.5, we can download directly from here.


Extract the source code and go to that directory.

tar -jxf postgresql-9.3.5.tar.bz2
cd postgresql-9.3.5

Installation is using usual procedure in unix family: configure, make, install. Note that we are using /usr/local as our installation directory (where the PostgreSQL will reside). You can change it to anything you like. Root privileges is not necessary for compilation process, however it is need to install it to our directory /usr/local. If you choose to install it to non-root privileged area, you can drop the “su -c” thing.

./configure --prefix=/usr/local
make -j4
su -c "make install"

At this point, PostgreSQL is installed, but can’t yet be operational. Let’s do configuration.


PostgreSQL User Account

We need a “postgres” user and group prior to building PostgreSQL. Do this using root privilege.

groupadd postgres
useradd -d /var/lib/pgsql postgres
passwd postgres

PostgreSQL Data Directory

Now we need to create PostgreSQL data directory if not exist. The data directory should be owned by postgres user.

mkdir /var/lib/pgsql/data
chown -Rf postgres:postgres /var/lib/pgsql

Initialize the directory. Before we can start creating any PostgreSQL database, the empty directory created above should be initialized.

su - postgres
/usr/bin/initdb -D /var/lib/pgsql/data

Next, validate the PostgreSQL data directory. Make sure all Postgres DB configuration file are created under the data directory.

Start PostgreSQL database. There are two ways to do it: using postmaster to do it, or invoking script.

/usr/bin/postmaster -D /var/lib/pgsql/data


/etc/rc.d/rc/postgres start

PostgreSQL Service

To make PostgreSQL run as service, we should make the init script executable.

chmod +x /etc/rc.d/rc.postgres

First Login

Let’s try our fresh build PostgreSQL.

psql -U postgres

where postgres is user account we have created before.

, , ,

About Author

about author


A man who is obsessed to low level technology.

1 Comment
  1. Installing PostGIS From Source on Slackware64 - Xathrya.ID

    […] of PostgreSQL has been discussed in different article. See here to read it. You can also skip it if you have already installed […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Social Share Buttons and Icons powered by Ultimatelysocial