With PostgreSQL, one can also add custom functions using different programming languages such as C/C++, Java, etc. pgAdmin is a web-based interface for managing of PostgreSQL database instances easily from your web browser. If you’re not a seasoned database administrator and you want to manage PostgreSQL easily via your favorite web browser, then use pgAdmin4. PostgreSQL packages are included in Ubuntu default repositories, however, the versions in Ubuntu repositories aren’t the latest. To install the latest, you will have to install the PostgreSQL package repository on Ubuntu Linux, and this tutorial will show you how. Also, for students and new users learning Linux, the easiest place to start learning is Ubuntu Linux. Ubuntu is the modern, open-source Linux operating system for desktops, servers, and other devices. To learn how to install PostgreSQL and pgAdmin4 Ubuntu Linux, follow the steps below

How to add PostgreSQL repository on Ubuntu Linux

Adding the PostgreSQL repository to Ubuntu is relatively easy. Simply run the commands below to add the PostgreSQL repository key and file. The commands below will add the repository key and the repository file to Ubuntu Linux.

How to install PostgreSQL on Ubuntu Linux

Now that the repository and key are added, run the commands below to update and install the latest PostgresSQL packages. To install PostgreSQL 11, run the commands below The commands above will also install the PostgreSQL contrib package which provides several additional features for the PostgreSQL database system. After installing PostgreSQL, the commands below can be used to stop, start and enable. To validate that PostgreSQL is installed and running, run the commands below. When you run the commands above, it should show something similar to the one below.

How to access the PostgreSQL shell

When you install PostgreSQL, a Postgres user is automatically created. This user is the superuser for the PostgreSQL instance, and it is equivalent to the MySQL root user. To access PostgreSQL interactive shell and manage the database, you need to switch users and login into the shell as Postgres users. Then use the psql command to invoke the interactive shell when you want to create and manage PostgreSQL databases. Set password for DB administrator (Postgres) Another way to access the PostgreSQL prompt without switching users is to use the sudo command. To create a change PostgreSQL database administrator password, log in as a Postgres user and invoke the psql command shell using the commands below. On the psql shell, run the below commands to change the database admin password. Either command below should work. After that, quit and exit.

How to install pgAdmin4 web portal

Now that PostgreSQL is installed, run the commands below to install pgAdmin4 to use to manage your PostgreSQL server. During the installation, you will be prompted to enter the PostgreSQL user password. Create a password for the pgAdmin4 web service. After installing, open your web browser and browse to the server hostname or IP address followed by pgAdmin4 URI http://example.com/pgadmin4 Enter the web interface’s initial user account as shown in the image above. Log in and add a new PostgreSQL server. Begin setting up your environment. That’s it! You may want to restrict access to only local IP addresses. Conclusion: This post showed you how to install PostgreSQL on Ubuntu Linux and its web-based tool to manage databases. If you find any error above or have something to add, please use the comment form below.