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.
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
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
Run the below command.
Now you can access the pgAdmin using the URL http://localhost:5050
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.
Now set the password for pgAdmin4.
When the installation is finished and make sure apache is running. you can access the pgAdmin using the URL https://serverip/pgadmin4
Login using the Email id postgres@localhost and password which you have set above.
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