Install PostgreSQL with phpPgAdmin on Ubuntu 16.04

Install PostgreSQL with phpPgAdmin on Ubuntu

We’ll show you, how to Install PostgreSQL with phpPgAdmin on Ubuntu 16.04. PostgreSQL is an object-relational database management system (ORDBMS) that is suited for large databases and has many advanced features. Its emphasis is on extensibility and standards-compliance. PostgreSQL can handle workloads ranging from small single-machine applications to large Internet-facing applications with many concurrent users. Installing PostgreSQL with phpPgAdmin on Ubuntu 16.04, is an easy and doesn’t take much time, follow the steps in this tutorial and you will be able to create and manage databases in PostgreSQL on Ubuntu 16.04, in few minutes. PostgreSQL is available for many operating systems few of which are Linux, Solaris, FreeBSD and Microsoft Windows.

What happens if you want to manage the PostgreSQL databases from a graphical interface and not the command line?

You can install phpPgAdmin on Ubuntu 16.04, which is a is a web-based administration tool for PostgreSQL. It is perfect for users that don’t have experience in managing PostgreSQL from the command line. phpPgAdmin is the PostgreSQL equivalent of MySQL’s phpMyAdmin and provides a convenient way for users to create databases, create tables, alter tables and query their own data using industry-standard SQL.

So in today’s article, we will install PostgreSQL and phpPgAdmin on Ubuntu 16.04

Install PostgreSQL on Ubuntu 16.04

REQUIREMENTS

We will be using our SSD 1 Linux VPS hosting plan for this tutorial.

1. Log in to your server via SSH

# ssh root@server_ip

You can check whether you have the proper Ubuntu version installed on your server with the following command:

# lsb_release -a

You should get this output:

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

2. Update the system

Make sure your server is fully up to date using:

# apt-get update && apt-get upgrade

3. Install PostgreSQL and phpPgAdmin on Uubntu 16.04

Now install PostgreSQL and phpPgAdmin using the below command:

# apt-get install postgresql postgresql-contrib phppgadmin

This command will install all the necessary packages needed by PostgreSQL and phpPgAdmin such as Apache, PHP etc… so don’t worry if you don’t have Apache or PHP installed on your server.

4. Log into the Postgrees System Account

Once the installation is completed, log into the ‘postgres‘ system account so you can access PostgreSQL. Type:

# su - postgres

Now you can access PostgreSQL using:

postgres@vps:~$ psql

Change your ‘postgres‘ role password to match your needs:

postgres=# \password postgres

Enter the new password when prompted.

Quit the psql command line:

postgres=# \q

Exit the postgres user:

postgres=# exit

5. Configure Apache

In order to access phpPgAdmin via your browser, the Apache web server needs to be configured. Therefore open the phppgadmin.conf file:

# nano /etc/apache2/conf-available/phppgadmin.conf

Comment the ‘Require local‘ line by adding ‘#’ in front of the line. Then under that very line, add ‘Allow From all‘. Save and close the file. After editing the section should look like this:

# Only allow connections from localhost:
#Require local
Allow From all

Now tweak some settings for phpPgAdmin. Open the config.inc.php file:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
# nano /etc/phppgadmin/config.inc.php

Locate the ‘$conf[‘extra_login_security’] = true;‘ and change the value from true to false so you can log in to phpPgAdmin as the postgres user.

Save and close the file.

6. Restart PostgreSQL and Apache

Now restart PostgreSQL and Apache. Then enable them to start on boot. All of this can be done using the below 4 commands:

# systemctl restart postgresql

# systemctl restart apache2

# systemctl enable postgresql

# systemctl enable apache2

7. Verify phpPgAdmin Installation on Ubuntu 16.04

Now open your favorite web browser and access phpPgAdmin by navigating to http://your_server_IP/phppgadmin/. You will be welcomed by a page as shown in the image below:

Install phpPgAdmin on Ubuntu 16.04

You can log in using the postgres user and the password you’ve configured previously. Now use this great tool to create and manage databases in PostgreSQL.

Of course you don’t have to install PostgreSQL with phpPgAdmin on Ubuntu 16.04, if you use one of our Ubuntu VPS Hosting services, in which case you can simply ask our expert Linux admins to install PostgreSQL and phpPgAdmin on Ubuntu 16.04 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on Install PostgreSQL with phpPgAdmin on Ubuntu 16.04, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

4 thoughts on “Install PostgreSQL with phpPgAdmin on Ubuntu 16.04”

  1. I have an error: Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Misc has a deprecated constructor in /usr/share/phppgadmin/classes/Misc.php on line 8

    :(

    Reply
  2. *************@************:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description: Debian GNU/Linux 8.8 (jessie)
    Release: 8.8
    Codename: jessie
    *************@************::~$ php -v
    PHP 7.1.6-2 (cli) (built: Jun 14 2017 05:31:31) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.6-2, Copyright (c) 1999-2017, by Zend Technologies

    Reply
    • Most likely the Debian PhpPgAdmin package works only with PHP 5, you can try to install PhpPgAdmin from source.

      Reply

Leave a Comment