Install & Get start with PgAdmin 4 on Ubuntu 20.04
PgAdmin 4 (v5) is a popular database management tool for PostgreSQL and its' complete rewrite of pgAdmin 3. You can find pgAdmin 4 (v5) release notes here We are going to see how to install and get start with it on Ubuntu 20.04.
Step 1: Add official pgAdmin PPA and update package list
Before adding PPA we have to add public key for the same.
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
And then add PPA and update the package list
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
Step 2: Install pgAdmin 4
sudo apt install pgadmin4
Step 3: Setup master password and connect database server
After successful installation we can find the pgAdmin shortcut in in our application menu. We can open it by clicking on the app icon and pgAdmin will ask us to set master password which will be used to securely save and retrieve our database usernames and passwords.
After setting master password you can enter your database username and password to connect to the database server.
While installing PostgreSQL it will automatically created user with name postrges without any password. (You can see how to install PostgreSQL in ubuntu 20.04 here.. )
Now we can set password for that user as well as to the user in database server.
you can set the password to user in your linux system like this..
sudo passwd postgres
and then switch to that user (postgres) using
su postgres and alter the database user password using below command
psql -c "ALTER USER postgres PASSWORD 'root';"
Now you can connect to your database server using this username and password within pgAdmin
If the connection is successful you can see the list of databases
You can see more about how to get start with pgAdmin through the below Youtube videos.. You can also find more videos like this on our youtube channel.