Skip to content

Instantly share code, notes, and snippets.

@rakibulinux
Created June 24, 2020 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rakibulinux/7d8e3cc68a68949fffb10ed1e7be156a to your computer and use it in GitHub Desktop.
Save rakibulinux/7d8e3cc68a68949fffb10ed1e7be156a to your computer and use it in GitHub Desktop.
How to Install PostgreSQL and pgAdmin4 on Ubuntu 18.04 LTS
#!/bin/sh
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt update
sudo apt -y install postgresql postgresql-contrib
su - postgres
psql
#Now add a new password for the Postgres user by running the following query to the psql interface.
\password postgres
TYPE YOUR PASSWORD
#Install pgAdmin4 From Repository
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
#Install pgadmin4: It will ask for email and password. Type your own email address that will be used as a username. Then type the password.
sudo apt update
sudo apt install pgadmin4 pgadmin4-apache2 -y
#Visit
http://localhost/pgadmin4/
user: postgres
Pass: rakib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment