In this article, we are going to install PostgreSQL 11 on Ubuntu 19.04 Linux server.
Step1: Add PostgreSQL Repository:
So you need to add PostgreSQL apt repository to your system suggested on official PostgreSQL website using following commands.
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'
Step2: Update repository and Install PostgreSQL 11
sudo apt-get update sudo apt-get install postgresql-11 postgresql-contrib
Step3: Connect to PostgreSQL 11 on Ubuntu 19.04
sudo su - postgres
psql
postgres=# \conninfo You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".
Step4: To check whether PostgreSQL is running or not by using the command: We can get the PostgreSQL server status by using ps command or by checking postgresql service status.
Method1 to check the PostgreSQL is up or not:
systemctl status postgresql
root@ubuntu:/var/lib/postgresql# systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Wed 2019-07-31 00:50:46 PDT; 17min ago Main PID: 6573 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 2302) Memory: 0B CGroup: /system.slice/postgresql.service Jul 31 00:50:46 ubuntu systemd[1]: Starting PostgreSQL RDBMS... Jul 31 00:50:46 ubuntu systemd[1]: Started PostgreSQL RDBMS.
Method2 to check the PostgreSQL is up or not:
ps -eaf | grep -i postgresql
root@ubuntu:/var/lib/postgresql# ps -eaf | grep -i postgresql postgres 6829 1 0 00:50 ? 00:00:00 /usr/lib/postgre sql/11/bin/postgres -D /var/lib/postgresql/11/main -c config_file= /etc/postgresql/11/main/postgresql.conf root 9086 9061 0 01:07 pts/1 00:00:00 grep --color=aut o -i postgresql
For the same made video,