How To Install and Use pgAdmin On Ubuntu 20.04 / 19.10

We can install pgAdmin4 on ubuntu 20.04 using the two methods. pgAdmin4 is basically used to manage the PostgreSQL server with GUI mode. you can add your PostgreSQL server in this software and manage it using GUI. Let’s see, how to install pgAdmin on Ubuntu.

Check Out: How To Install Ionic Framework On Ubuntu 20.04 / 19.10

How To Install and Use pgAdmin On Ubuntu 20.04 / 19.10

Before installing, We need to update and upgrade the Ubuntu machine using the following command. you can also install the Postgresql to complete these setup.

sudo apt update
sudo apt upgrade -y
sudo apt install postgresql

Start and enable the service.

sudo systemctl enable postgresql
sudo systemctl start postgresql

Install the required dependencies on Ubuntu. 

sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev

Check Out: How To Install Apache SVN Server On Ubuntu 20.04

Method 1:

Once the above packages installed. we need to create a virtual environment using the following commands. 

cd /opt
sudo virtualenv .pgadmin4

When the Virtual Environment is created. we need to activate. 

cd /opt/.pgadmin4
source bin/activate

We need to download the pgAdmin package on ubuntu using the below command. 

cd /opt/.pgadmin4
sudo wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.4/pip/pgadmin4-1.4-py2.py3-none-any.whl

Once you have downloaded the file. you have to install it using the pip or pip3 command. The PIP version depends on your system. 

sudo pip3 install pgadmin4-1.4-py2.py3-none-any.whl

After the installation, we need to configure it using the below command.

Note: The python version depends on your system. So, you can change it according to your version. 

echo "SERVER_MODE = False" >> lib/python2.7/site-packages/pgadmin4/config_local.py

Check Out: Solve add-apt-repository: Command Not Found on Ubuntu

Run the below command. 

python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py

Now you can access the pgAdmin using the URL http://localhost:5050

Method 2:

We can also install it using the pgAdmin4 APT repository because it’s not available in the ubuntu repository. Run the below command. 

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list

You need to install the pgAdmin4 using the below command. 

sudo apt install pgadmin4 pgadmin4-apache2

When the installation is running it will ask you to set the Email address that would be used for log in to the pgAdmin4.

Check Out: Install New Microsoft Edge Browser Based on Chromium On Windows

Now set the password for pgAdmin4.

pgadmin4 install ubuntu

When the installation is finished and make sure apache is running. you can access the pgAdmin using the URL https://serverip/pgadmin4

install pgadmin on ubuntu

Login using the Email id postgres@localhost and password which you have set above. 

pgadmin4 ubuntu

If you want to install pgAdmin desktop and web, you can use the following commands. 

sudo apt install pgadmin4-desktop                                                         ## For Desktop only
sudo apt install pgadmin4-web                                                                 ## For Web only

That’s it.

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment