Installing EDB Postgres Advanced Server on Ubuntu 20.04 x86_64 v12

Prerequisites

Before you begin the installation process:

  • Set up the EDB repository

    Setting up the repository is a one-time task. If you have already set up your repository, you don't need to perform this step.

    To determine if your repository exists, enter this command:

    apt-cache search enterprisedb

    If no output is generated, the repository isn't installed.

    To set up the EDB repository:

    1. Go to EDB repositories.

    2. Select the button that provides access to the EDB repository.

    3. Select the platform and software that you want to download.

    4. Follow the instructions for setting up the EDB repository.

Install the package

sudo apt-get -y install edb-as<xx>-server

Where <xx> is the version of the EDB Postgres Advanced Server you are installing. For example, if you are installing version 12, the package name would be edb-as12-server.

To install an individual component:

sudo apt-get -y install <package_name>

Where package_name can be any of the available packages from the available package list.

Initial configuration

This section steps you through getting started with your cluster including logging in, ensuring the installation was successful, connecting to your cluster, and creating the user password.

To work in your cluster, login as the enterprisedb user. Connect to the database server using the psql command line client (although you can use a client of your choice with the appropriate connection string).

sudo su - enterprisedb

psql edb

The server runs with the peer or ident permission by default. You can change the authentication method by modifying the pg_hba.conf file.

Before changing the authentication method, assign a password to the database superuser, enterprisedb. For more information on changing the authentication, see modifying the pg_hba.conf file.

ALTER ROLE enterprisedb IDENTIFIED BY password;

Experiment

Now you are ready to create and connect to a database, create a table, insert data in a table, and view the data from the table.

First let's create a database to hold human resource information named hr using psql.

# running in psql
CREATE DATABASE hr;
Output
CREATE DATABASE

Connect to the hr database inside psql.

\c hr
Output
psql (15.2.0, server 15.2.0)
You are now connected to database "hr" as user "enterprisedb".

Create columns to hold department numbers, unique department names, and locations.

CREATE TABLE public.dept (deptno numeric(2) NOT NULL CONSTRAINT dept_pk
PRIMARY KEY, dname varchar(14) CONSTRAINT dept_dname_uq UNIQUE, loc
varchar(13));
Output
CREATE TABLE

Insert values into the dept table.

INSERT INTO dept VALUES (10,'ACCOUNTING','NEW YORK');
Output
INSERT 0 1
INSERT into dept VALUES (20,'RESEARCH','DALLAS');
Output
INSERT 0 1

View what is in the table by selecting the values from the table.

SELECT * FROM dept;
Output
deptno  |   dname    |   loc
--------+------------+----------
10      | ACCOUNTING | NEW YORK
20      | RESEARCH   | DALLAS
(2 rows)