Install PostgreSQL and pgAdmin on Ubuntu Server 18 - CentLinux

Latest

Wednesday, 4 March 2020

Install PostgreSQL and pgAdmin on Ubuntu Server 18

Install PostgreSQL and pgAdmin on Ubuntu Server 18

PostgreSQL (or Postgres) is a RDBMS (relational database management system) that emphasizes on extensibility and technical standards compliance. PostgreSQL is free and open source and distributed under PostgreSQL (permissive) License.

pgAdmin 4 is web-based interface for database administration of PostgreSQL servers. pgAdmin is the most popular and feature enrich web interface for PostgreSQL. pgAdmin is also free and open source.

In this article, you will learn how to install PostgreSQL and pgAdmin 4 on Ubuntu Server 18.04 LTS.

Have a look at our previous article, if you intend to install PostgreSQL and pgAdmin on CentOS 7.

This article focuses on installation of PostgreSQL and pgAdmin on Ubuntu Server. However, if you want to learn about database administration of PostgreSQL database servers, we highly recommend you to read PostgreSQL 11 Administration Cookbook by Packt Publishing. It contains over 175 recipes for database administrators to manage enterprise databases.

 

This Article Provides:

     

    Environment Specification:

    We are using a minimal Ubuntu Server 18.04 virtual machine with following specification.

    • CPU - 3.4 Ghz (2 cores)
    • Memory - 2 GB
    • Storage - 20 GB
    • Operating System - Ubuntu Server 18.04 LTS
    • Hostname – postgresql-01.centlinux.com
    • IP Address - 192.168.116.218 /24

     

    Upgrading Ubuntu Server Packages:

    Connect with postgresql-01.centlinux.com as a privileged user by using a ssh tool.

    Check the apt repository and obtain the list of packages that can be upgraded on this Ubuntu Server.

    ahmer@ubuntu-server:~$ sudo apt update Hit:1 http://pk.archive.ubuntu.com/ubuntu bionic InRelease Hit:2 http://pk.archive.ubuntu.com/ubuntu bionic-updates InRelease Hit:3 http://pk.archive.ubuntu.com/ubuntu bionic-backports InRelease Hit:4 http://pk.archive.ubuntu.com/ubuntu bionic-security InRelease Reading package lists... Done Building dependency tree Reading state information... Done 1 package can be upgraded. Run 'apt list --upgradable' to see it.

    Upgrade all available packages as follows.

    ahmer@ubuntu-server:~$ sudo apt upgrade -y Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following package was automatically installed and is no longer required: libdumbnet1 Use 'sudo apt autoremove' to remove it. The following packages will be upgraded: sosreport 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 165 kB of archives. After this operation, 217 kB of additional disk space will be used. Get:1 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 sosreport amd64 3.9-1ubuntu0.18.04.1 [165 kB] Fetched 165 kB in 1s (189 kB/s) (Reading database ... 102505 files and directories currently installed.) Preparing to unpack .../sosreport_3.9-1ubuntu0.18.04.1_amd64.deb ... Unpacking sosreport (3.9-1ubuntu0.18.04.1) over (3.6-1ubuntu0.18.04.4) ... Setting up sosreport (3.9-1ubuntu0.18.04.1) ... Installing new version of config file /etc/sos.conf ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

     

    Installing PostgreSQL APT Repository on Ubuntu Server:

    Download and import GPG Key of PostgreSQL apt repository.

    ahmer@ubuntu-server:~$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - OK

    Add PostgreSQL apt repository by creating a repository source file.

    ahmer@ubuntu-server:~$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

     

    Installing PostgreSQL on Ubuntu Server 18.04 LTS:

    We are installing PostgreSQL and relevant packages using apt command.

    ahmer@ubuntu-server:~$ sudo apt -y install postgresql postgresql-contrib [sudo] password for ahmer: Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libdumbnet1 Use 'sudo apt autoremove' to remove it. The following additional packages will be installed: libpq5 libsensors4 postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common ssl-cert sysstat Suggested packages: lm-sensors postgresql-doc locales-all postgresql-doc-10 libjson-perl openssl-blacklist isag The following NEW packages will be installed: libpq5 libsensors4 postgresql postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common postgresql-contrib ssl-cert sysstat 0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. Need to get 28.8 kB/5,344 kB of archives. After this operation, 21.1 MB of additional disk space will be used. Get:1 http://pk.archive.ubuntu.com/ubuntu bionic/main amd64 libsensors4 amd64 1:3.4.0-4 [28.8 kB] Fetched 28.8 kB in 1s (21.5 kB/s) Preconfiguring packages ... Selecting previously unselected package libpq5:amd64. (Reading database ... 102533 files and directories currently installed.) Preparing to unpack .../0-libpq5_10.12-0ubuntu0.18.04.1_amd64.deb ... Unpacking libpq5:amd64 (10.12-0ubuntu0.18.04.1) ... Selecting previously unselected package libsensors4:amd64. Preparing to unpack .../1-libsensors4_1%3a3.4.0-4_amd64.deb ... Unpacking libsensors4:amd64 (1:3.4.0-4) ... Selecting previously unselected package postgresql-client-common. Preparing to unpack .../2-postgresql-client-common_190ubuntu0.1_all.deb ... Unpacking postgresql-client-common (190ubuntu0.1) ... Selecting previously unselected package postgresql-client-10. Preparing to unpack .../3-postgresql-client-10_10.12-0ubuntu0.18.04.1_amd64.deb ... Unpacking postgresql-client-10 (10.12-0ubuntu0.18.04.1) ... Selecting previously unselected package ssl-cert. Preparing to unpack .../4-ssl-cert_1.0.39_all.deb ... Unpacking ssl-cert (1.0.39) ... Selecting previously unselected package postgresql-common. Preparing to unpack .../5-postgresql-common_190ubuntu0.1_all.deb ... Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common' Unpacking postgresql-common (190ubuntu0.1) ... Selecting previously unselected package postgresql-10. Preparing to unpack .../6-postgresql-10_10.12-0ubuntu0.18.04.1_amd64.deb ... Unpacking postgresql-10 (10.12-0ubuntu0.18.04.1) ... Selecting previously unselected package postgresql. Preparing to unpack .../7-postgresql_10+190ubuntu0.1_all.deb ... Unpacking postgresql (10+190ubuntu0.1) ... Selecting previously unselected package postgresql-contrib. Preparing to unpack .../8-postgresql-contrib_10+190ubuntu0.1_all.deb ... Unpacking postgresql-contrib (10+190ubuntu0.1) ... Selecting previously unselected package sysstat. Preparing to unpack .../9-sysstat_11.6.1-1ubuntu0.1_amd64.deb ... Unpacking sysstat (11.6.1-1ubuntu0.1) ... Setting up ssl-cert (1.0.39) ... Setting up libpq5:amd64 (10.12-0ubuntu0.18.04.1) ... Setting up postgresql-client-common (190ubuntu0.1) ... Setting up postgresql-common (190ubuntu0.1) ... Adding user postgres to group ssl-cert Creating config file /etc/postgresql-common/createcluster.conf with new version Building PostgreSQL dictionaries from installed myspell/hunspell packages... Removing obsolete dictionary files: Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service â /lib/systemd/system/postgresql.service. Setting up libsensors4:amd64 (1:3.4.0-4) ... Setting up postgresql-client-10 (10.12-0ubuntu0.18.04.1) ... update-alternatives: using /usr/share/postgresql/10/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode Setting up sysstat (11.6.1-1ubuntu0.1) ... Creating config file /etc/default/sysstat with new version update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode Created symlink /etc/systemd/system/multi-user.target.wants/sysstat.service â /lib/systemd/system/sysstat.service. Setting up postgresql-10 (10.12-0ubuntu0.18.04.1) ... Creating new PostgreSQL cluster 10/main ... /usr/lib/postgresql/10/bin/initdb -D /var/lib/postgresql/10/main --auth-local peer --auth-host md5 The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /var/lib/postgresql/10/main ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default timezone ... Etc/UTC selecting dynamic shared memory implementation ... posix creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... ok Success. You can now start the database server using: /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start Ver Cluster Port Status Owner Data directory Log file 10 main 5432 down postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log update-alternatives: using /usr/share/postgresql/10/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode Setting up postgresql (10+190ubuntu0.1) ... Setting up postgresql-contrib (10+190ubuntu0.1) ... Processing triggers for systemd (237-3ubuntu10.39) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for ureadahead (0.100.0-21) ... Processing triggers for libc-bin (2.27-3ubuntu1) ...

    PostgreSQL installation process creates a default OS user postgres to own PostgreSQL files and processes.

    Switch to postgres user.

    ahmer@ubuntu-server:~$ sudo su - postgres

    Connect to PostgreSQL by using psql command and set the password for postgres (database user).

    postgres@ubuntu-server:~$ psql psql (10.12 (Ubuntu 10.12-0ubuntu0.18.04.1)) Type "help" for help. postgres=# ALTER USER postgres PASSWORD '123'; ALTER ROLE postgres=# \q postgres@ubuntu-server:~$ exit logout

     

    Installing pgAdmin 4 on Ubuntu Server 18.04 LTS:

    PGDG repository also provides pgAdmin and relevant packages. Therefore, we can easily install it by using an apt command.

    But first, we have to update the packages on our Ubuntu Server.

    ahmer@ubuntu-server:~$ sudo apt update Get:1 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease [46.3 kB] Hit:2 http://pk.archive.ubuntu.com/ubuntu bionic InRelease Get:3 http://pk.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] Get:4 http://pk.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] Get:5 http://pk.archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] Get:6 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages [179 kB] Get:7 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [871 kB] Get:8 http://pk.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,054 kB] Fetched 2,403 kB in 31s (78.2 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 7 packages can be upgraded. Run 'apt list --upgradable' to see them.

    Upgrade available packages.

    ahmer@ubuntu-server:~$ sudo apt upgrade -y Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following package was automatically installed and is no longer required: libdumbnet1 Use 'sudo apt autoremove' to remove it. The following NEW packages will be installed: libllvm6.0 pgdg-keyring postgresql-12 postgresql-client-12 The following packages will be upgraded: libpq5 postgresql postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common postgresql-contrib 7 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 37.5 MB of archives. After this operation, 126 MB of additional disk space will be used. Get:1 http://pk.archive.ubuntu.com/ubuntu bionic/main amd64 libllvm6.0 amd64 1:6.0-1ubuntu2 [14.5 MB] Get:2 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 libpq5 amd64 12.2-2.pgdg18.04+1 [172 kB] Get:3 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 pgdg-keyring all 2018.2 [10.7 kB] Get:4 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql-common all 213.pgdg18.04+1 [236 kB] Get:5 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql-client-common all 213.pgdg18.04+1 [87.2 kB] Get:6 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql-client-12 amd64 12.2-2.pgdg18.04+1 [1,392 kB] Get:7 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql-12 amd64 12.2-2.pgdg18.04+1 [14.5 MB] Get:8 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql all 12+213.pgdg18.04+1 [62.9 kB] Get:9 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql-client-10 amd64 10.12-2.pgdg18.04+1 [1,422 kB] Get:10 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql-10 amd64 10.12-2.pgdg18.04+1 [4,950 kB] Get:11 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql-contrib all 12+213.pgdg18.04+1 [62.9 kB] Fetched 37.5 MB in 54s (693 kB/s) Preconfiguring packages ... Selecting previously unselected package libllvm6.0:amd64. (Reading database ... 103350 files and directories currently installed.) Preparing to unpack .../00-libllvm6.0_1%3a6.0-1ubuntu2_amd64.deb ... Unpacking libllvm6.0:amd64 (1:6.0-1ubuntu2) ... Preparing to unpack .../01-libpq5_12.2-2.pgdg18.04+1_amd64.deb ... Unpacking libpq5:amd64 (12.2-2.pgdg18.04+1) over (10.12-0ubuntu0.18.04.1) ... Selecting previously unselected package pgdg-keyring. Preparing to unpack .../02-pgdg-keyring_2018.2_all.deb ... Unpacking pgdg-keyring (2018.2) ... Preparing to unpack .../03-postgresql-common_213.pgdg18.04+1_all.deb ... Leaving 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common' Unpacking postgresql-common (213.pgdg18.04+1) over (190ubuntu0.1) ... Preparing to unpack .../04-postgresql-client-common_213.pgdg18.04+1_all.deb ... Unpacking postgresql-client-common (213.pgdg18.04+1) over (190ubuntu0.1) ... Selecting previously unselected package postgresql-client-12. Preparing to unpack .../05-postgresql-client-12_12.2-2.pgdg18.04+1_amd64.deb ... Unpacking postgresql-client-12 (12.2-2.pgdg18.04+1) ... Selecting previously unselected package postgresql-12. Preparing to unpack .../06-postgresql-12_12.2-2.pgdg18.04+1_amd64.deb ... Unpacking postgresql-12 (12.2-2.pgdg18.04+1) ... Preparing to unpack .../07-postgresql_12+213.pgdg18.04+1_all.deb ... Unpacking postgresql (12+213.pgdg18.04+1) over (10+190ubuntu0.1) ... Preparing to unpack .../08-postgresql-client-10_10.12-2.pgdg18.04+1_amd64.deb ... Unpacking postgresql-client-10 (10.12-2.pgdg18.04+1) over (10.12-0ubuntu0.18.04.1) ... Preparing to unpack .../09-postgresql-10_10.12-2.pgdg18.04+1_amd64.deb ... Unpacking postgresql-10 (10.12-2.pgdg18.04+1) over (10.12-0ubuntu0.18.04.1) ... Preparing to unpack .../10-postgresql-contrib_12+213.pgdg18.04+1_all.deb ... Unpacking postgresql-contrib (12+213.pgdg18.04+1) over (10+190ubuntu0.1) ... Setting up libllvm6.0:amd64 (1:6.0-1ubuntu2) ... Setting up libpq5:amd64 (12.2-2.pgdg18.04+1) ... Setting up pgdg-keyring (2018.2) ... Removing apt.postgresql.org key from trusted.gpg: OK Setting up postgresql-client-common (213.pgdg18.04+1) ... Installing new version of config file /etc/postgresql-common/supported_versions ... Setting up postgresql-common (213.pgdg18.04+1) ... Installing new version of config file /etc/apt/apt.conf.d/01autoremove-postgresql ... Setting up postgresql-client-10 (10.12-2.pgdg18.04+1) ... Setting up postgresql-client-12 (12.2-2.pgdg18.04+1) ... update-alternatives: using /usr/share/postgresql/12/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode Setting up postgresql-10 (10.12-2.pgdg18.04+1) ... Setting up postgresql-12 (12.2-2.pgdg18.04+1) ... Creating new PostgreSQL cluster 12/main ... /usr/lib/postgresql/12/bin/initdb -D /var/lib/postgresql/12/main --auth-local peer --auth-host md5 The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /var/lib/postgresql/12/main ... ok creating subdirectories ... ok selecting dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default time zone ... Etc/UTC creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... ok Success. You can now start the database server using: pg_ctlcluster 12 main start Ver Cluster Port Status Owner Data directory Log file 12 main 5433 down postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log update-alternatives: using /usr/share/postgresql/12/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode Setting up postgresql-contrib (12+213.pgdg18.04+1) ... Setting up postgresql (12+213.pgdg18.04+1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for ureadahead (0.100.0-21) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Processing triggers for systemd (237-3ubuntu10.39) ...

    Install pgAdmin 4 and relevant packages using apt command.

    ahmer@ubuntu-server:~$ sudo apt install -y pgadmin4 pgadmin4-apache2

    The pgAdmin 4 installation process will launch a TUI (Terminal User Interface) based configuration screen.

    01-postgresql-pgadmin-ubuntu-configure-email

    Enter an email address to create a user account for pgAdmin web interface. Press Ok button.

    02-postgresql-pgadmin-ubuntu-configure-password

    Set a password for pgAdmin web interface user and press Ok button.

    The pgAdmin installation will be continue as follows.

    Setting up libwacom-common (0.29-1) ... Setting up libxdamage1:amd64 (1:1.1.4-3) ... Setting up libjs-underscore (1.8.3~dfsg-1) ... Setting up libdouble-conversion1:amd64 (2.0.1-4ubuntu1) ... Setting up libxfixes3:amd64 (1:5.0.3-1) ... Setting up libdrm-amdgpu1:amd64 (2.4.99-1ubuntu1~18.04.2) ... Setting up libevdev2:amd64 (1.5.8+dfsg-1) ... Setting up python3-sqlparse (0.2.4-0.1) ... Setting up liblcms2-2:amd64 (2.9-1ubuntu0.1) ... Setting up libjbig0:amd64 (2.1-3.1build1) ... Setting up python3-mako (1.0.7+ds1-1) ... Setting up fonts-dejavu-core (2.37-1) ... Setting up libatspi2.0-0:amd64 (2.28.0-1) ... Setting up libxshmfence1:amd64 (1.3-1) ... Setting up python3-simplejson (3.13.2-1) ... Setting up libwayland-client0:amd64 (1.16.0-1ubuntu1.1~18.04.3) ... Setting up libproxy1v5:amd64 (0.4.15-1) ... Setting up libjs-sphinxdoc (1.6.7-1ubuntu1) ... Setting up python3-sshtunnel (0.1.4-1~pgdg18.04+1) ... Setting up apache2-data (2.4.29-1ubuntu4.12) ... Setting up libgdk-pixbuf2.0-common (2.36.11-2) ... Setting up glib-networking-services (2.56.0-1) ... Setting up libdatrie1:amd64 (0.2.10-7) ... Setting up libjpeg-turbo8:amd64 (1.5.2-0ubuntu5.18.04.3) ... Setting up libglapi-mesa:amd64 (19.2.8-0ubuntu0~18.04.3) ... Setting up fonts-open-sans (1.11-1) ... Setting up libxcb-util1:amd64 (0.4.0-0ubuntu3) ... Setting up python3-psutil (5.4.2-1ubuntu0.1) ... Setting up fonts-font-awesome (4.7.0~dfsg-3) ... Setting up libjson-glib-1.0-0:amd64 (1.4.2-3) ... Setting up libgraphite2-3:amd64 (1.3.11-2) ... Setting up libcroco3:amd64 (0.6.12-2) ... Setting up libxcb-sync1:amd64 (1.13-2~ubuntu18.04) ... Setting up libatk1.0-data (2.28.1-1) ... Setting up python3-psycopg2 (2.8.4-1~pgdg18.04+1) ... Setting up libx11-xcb1:amd64 (2:1.6.4-3ubuntu0.2) ... Setting up libpixman-1-0:amd64 (0.34.0-2) ... Setting up python3-wtforms (2.1-1) ... Setting up libepoxy0:amd64 (1.4.3-1) ... Setting up libatk1.0-0:amd64 (2.28.1-1) ... Setting up libaprutil1:amd64 (1.6.1-2) ... Setting up qttranslations5-l10n (5.9.5-0ubuntu1) ... Setting up python-babel-localedata (2.4.0+dfsg.1-2ubuntu1) ... Setting up libmtdev1:amd64 (1.1.5-1ubuntu3) ... Setting up libatk-bridge2.0-0:amd64 (2.26.2-1) ... Setting up pgadmin4-doc (4.18-1.pgdg18.04+1) ... Setting up libdconf1:amd64 (0.26.0-2ubuntu3) ... Setting up libxcomposite1:amd64 (1:0.4.4-2) ... Setting up libxcb-shm0:amd64 (1.13-2~ubuntu18.04) ... Setting up libpciaccess0:amd64 (0.14-1) ... Setting up libxcb-shape0:amd64 (1.13-2~ubuntu18.04) ... Setting up libxrender1:amd64 (1:0.9.10-1) ... Setting up libxkbcommon0:amd64 (0.8.2-1~ubuntu18.04.1) ... Setting up libgudev-1.0-0:amd64 (1:232-2) ... Setting up libxcb-keysyms1:amd64 (0.4.0-1) ... Setting up liblua5.2-0:amd64 (5.2.4-1.1build1) ... Setting up libdrm-radeon1:amd64 (2.4.99-1ubuntu1~18.04.2) ... Setting up libcolord2:amd64 (1.3.3-2build1) ... Setting up libthai-data (0.1.27-2) ... Setting up javascript-common (11) ... Package apache2 is not configured yet. Will defer actions by package javascript-common. Setting up libxxf86vm1:amd64 (1:1.1.4-1) ... Setting up libllvm9:amd64 (1:9-2~ubuntu18.04.2) ... Setting up libdrm-nouveau2:amd64 (2.4.99-1ubuntu1~18.04.2) ... Setting up x11-common (1:7.7+19ubuntu7.1) ... update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults Setting up hicolor-icon-theme (0.17-2) ... Setting up python3-itsdangerous (0.24+dfsg1-2) ... Setting up libwayland-cursor0:amd64 (1.16.0-1ubuntu1.1~18.04.3) ... Setting up python3-tz (2018.3-2) ... Setting up libwayland-egl1:amd64 (1.16.0-1ubuntu1.1~18.04.3) ... Setting up libxrandr2:amd64 (2:1.5.1-1) ... Setting up python3-pyinotify (0.9.6-1) ... Setting up python3-dateutil (2.6.1-1) ... Setting up libavahi-common-data:amd64 (0.7-3.1ubuntu1.2) ... Setting up libaprutil1-ldap:amd64 (1.6.1-2) ... Setting up libwayland-server0:amd64 (1.16.0-1ubuntu1.1~18.04.3) ... Setting up fonts-roboto-unhinted (2:0~20160106-2) ... Setting up libjpeg8:amd64 (8c-2ubuntu8) ... Setting up libxcb-xkb1:amd64 (1.13-2~ubuntu18.04) ... Setting up libqt5core5a:amd64 (5.9.5+dfsg-0ubuntu2.5) ... Setting up libxcb-render-util0:amd64 (0.3.9-1) ... Setting up libqt5dbus5:amd64 (5.9.5+dfsg-0ubuntu2.5) ... Setting up fontconfig-config (2.12.6-0ubuntu2) ... Setting up python3-flask (0.12.2-3) ... Setting up python3-flask-sqlalchemy (2.1-3build1) ... Setting up libqt5network5:amd64 (5.9.5+dfsg-0ubuntu2.5) ... Setting up libwacom2:amd64 (0.29-1) ... Setting up libxcb-image0:amd64 (0.4.0-1build1) ... Setting up dconf-service (0.26.0-2ubuntu3) ... Setting up libaprutil1-dbd-sqlite3:amd64 (1.6.1-2) ... Setting up apache2-utils (2.4.29-1ubuntu4.12) ... Setting up libgbm1:amd64 (19.2.8-0ubuntu0~18.04.3) ... Setting up apache2-bin (2.4.29-1ubuntu4.12) ... Setting up python3-alembic (0.9.3-2ubuntu1) ... Setting up python3-flask-paranoid (0.2.0-2) ... Setting up libharfbuzz0b:amd64 (1.7.2-1ubuntu1) ... Setting up libtiff5:amd64 (4.0.9-5ubuntu0.3) ... Setting up python3-flask-compress (1.4.0-1) ... Setting up libthai0:amd64 (0.1.27-2) ... Setting up libinput-bin (1.10.4-1ubuntu0.18.04.1) ... Setting up libxkbcommon-x11-0:amd64 (0.8.2-1~ubuntu18.04.1) ... Setting up libxtst6:amd64 (2:1.2.3-1) ... Setting up python3-babel (2.4.0+dfsg.1-2ubuntu1) ... update-alternatives: using /usr/bin/pybabel-python3 to provide /usr/bin/pybabel (pybabel) in auto mode Setting up libdrm-intel1:amd64 (2.4.99-1ubuntu1~18.04.2) ... Setting up libwacom-bin (0.29-1) ... Setting up libxcursor1:amd64 (1:1.1.15-1) ... Setting up python3-flask-gravatar (0.4.2-1) ... Setting up python3-flask-login (0.4.0-2) ... Setting up libice6:amd64 (2:1.0.9-2) ... Setting up libegl-mesa0:amd64 (19.2.8-0ubuntu0~18.04.3) ... Setting up libavahi-common3:amd64 (0.7-3.1ubuntu1.2) ... Setting up python3-flaskext.wtf (0.14.2-2) ... Setting up dconf-gsettings-backend:amd64 (0.26.0-2ubuntu3) ... Setting up alembic (0.9.3-2ubuntu1) ... Setting up python3-flask-mail (0.9.1+dfsg1-1) ... Setting up libapache2-mod-wsgi-py3 (4.5.17-1ubuntu1) ... Package apache2 is not configured yet. Will defer actions by package libapache2-mod-wsgi-py3. Setting up libfontconfig1:amd64 (2.12.6-0ubuntu2) ... Setting up python3-flask-principal (0.4.0-1build1) ... Setting up libsm6:amd64 (2:1.2.2-1) ... Setting up apache2 (2.4.29-1ubuntu4.12) ... Enabling module mpm_event. Enabling module authz_core. Enabling module authz_host. Enabling module authn_core. Enabling module auth_basic. Enabling module access_compat. Enabling module authn_file. Enabling module authz_user. Enabling module alias. Enabling module dir. Enabling module autoindex. Enabling module env. Enabling module mime. Enabling module negotiation. Enabling module setenvif. Enabling module filter. Enabling module deflate. Enabling module status. Enabling module reqtimeout. Enabling conf charset. Enabling conf localized-error-pages. Enabling conf other-vhosts-access-log. Enabling conf security. Enabling conf serve-cgi-bin. Enabling site 000-default. info: Executing deferred 'a2enconf javascript-common' for package javascript-common Enabling conf javascript-common. info: Executing deferred 'a2enmod wsgi' for package libapache2-mod-wsgi-py3 Enabling module wsgi. Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service â /lib/systemd/system/apache2.service. Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service â /lib/systemd/system/apache-htcacheclean.service. Setting up gsettings-desktop-schemas (3.28.0-1ubuntu1) ... Setting up libgtk-3-common (3.22.30-1ubuntu4) ... Setting up at-spi2-core (2.28.0-1) ... Setting up libgdk-pixbuf2.0-0:amd64 (2.36.11-2) ... Setting up python3-flask-babelex (0.9.3-1~pgdg18.04+1) ... Setting up python3-flask-migrate (2.1.1-2) ... Setting up libinput10:amd64 (1.10.4-1ubuntu0.18.04.1) ... Setting up libgl1-mesa-dri:amd64 (19.2.8-0ubuntu0~18.04.3) ... Setting up libgdk-pixbuf2.0-bin (2.36.11-2) ... Setting up python3-flask-security (1.7.5-2) ... Setting up libegl1:amd64 (1.0.0-2ubuntu2.3) ... Setting up gtk-update-icon-cache (3.22.30-1ubuntu4) ... Setting up libavahi-client3:amd64 (0.7-3.1ubuntu1.2) ... Setting up pgadmin4-common (4.18-1.pgdg18.04+1) ... Setting up fontconfig (2.12.6-0ubuntu2) ... Regenerating fonts cache... done. Setting up libglx-mesa0:amd64 (19.2.8-0ubuntu0~18.04.3) ... Setting up libcups2:amd64 (2.2.7-1ubuntu2.7) ... Setting up libcairo2:amd64 (1.15.10-2ubuntu0.1) ... Setting up libcairo-gobject2:amd64 (1.15.10-2ubuntu0.1) ... Setting up pgadmin4-apache2 (4.18-1.pgdg18.04+1) ... apache2_invoke: Enable configuration pgadmin4 NOTE: Configuring authentication for SERVER mode. pgAdmin 4 - Application Initialisation ====================================== Setting up libpango-1.0-0:amd64 (1.40.14-1ubuntu0.1) ... Setting up libglx0:amd64 (1.0.0-2ubuntu2.3) ... Setting up libpangoft2-1.0-0:amd64 (1.40.14-1ubuntu0.1) ... Setting up libgl1:amd64 (1.0.0-2ubuntu2.3) ... Setting up libpangocairo-1.0-0:amd64 (1.40.14-1ubuntu0.1) ... Setting up libqt5gui5:amd64 (5.9.5+dfsg-0ubuntu2.5) ... Setting up libqt5widgets5:amd64 (5.9.5+dfsg-0ubuntu2.5) ... Setting up librsvg2-2:amd64 (2.40.20-2) ... Setting up librsvg2-common:amd64 (2.40.20-2) ... Setting up libqt5svg5:amd64 (5.9.5-0ubuntu1) ... Setting up pgadmin4 (4.18-1.pgdg18.04+1) ... Setting up humanity-icon-theme (0.6.15) ... Setting up ubuntu-mono (16.10+18.04.20181005-0ubuntu1) ... Setting up adwaita-icon-theme (3.28.0-1ubuntu1) ... update-alternatives: using /usr/share/icons/Adwaita/cursor.theme to provide /usr/share/icons/default/index.theme (x-cursor-theme) in auto mode Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ... Processing triggers for mime-support (3.60ubuntu1) ... Processing triggers for ureadahead (0.100.0-21) ... Processing triggers for libglib2.0-0:amd64 (2.56.4-0ubuntu0.18.04.4) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Processing triggers for udev (237-3ubuntu10.39) ... Setting up glib-networking:amd64 (2.56.0-1) ... Processing triggers for systemd (237-3ubuntu10.39) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Setting up libsoup2.4-1:amd64 (2.62.1-1ubuntu0.4) ... Setting up libsoup-gnome2.4-1:amd64 (2.62.1-1ubuntu0.4) ... Setting up librest-0.7-0:amd64 (0.8.0-2) ... Setting up libgtk-3-0:amd64 (3.22.30-1ubuntu4) ... Setting up libgtk-3-bin (3.22.30-1ubuntu4) ... Setting up qt5-gtk-platformtheme:amd64 (5.9.5+dfsg-0ubuntu2.5) ... Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.36.11-2) ... Processing triggers for libc-bin (2.27-3ubuntu1) ...

    pgAdmin 4 has been installed on Ubuntu Server 18.04 LTS.

    pgAdmin web application runs at default http service port. Therefore, to access pgAdmin 4 we need to allow http service port in Ubuntu firewall.

    ahmer@ubuntu-server:~$ sudo ufw allow http Rules updated Rules updated (v6)

    To access pgAdmin 4 web interface, open URL http://postgresql-01.centlinux.com/pgadmin4 in a browser.

    03-postgresql-pgadmin-ubuntu-login-page

    Login using email/password that we have created during pgAdmin 4 installation.

    04-postgresql-pgadmin-ubuntu-dashboard

     

    Adding a PostgreSQL Server in pgAdmin 4:

    At the pgAdmin 4 dashboard, click on Add New Server to add a PostgreSQL database server in our pgAdmin 4 web interface.

    05-postgresql-pgadmin-ubuntu-add-server

    06-postgresql-pgadmin-ubuntu-add-server

    Click on Save to add local postgreSQL server.

    07-postgresql-pgadmin-ubuntu-server-stats

    We have successfully installed PostgreSQL and pgAdmin 4 on Ubuntu Server 18.04 LTS.

    No comments:

    Post a comment