In this article, I will take you through the steps to install PostgreSQL on Ubuntu 20.04 LTS but before that let me ask you a question. Do you know which is the world's most advanced open source relational database ? If your answer is PostgreSQL then you are absolutely correct. It is one of the most advanced, powerful and open-source object-relational database system with high reliability, robustness, and performance features. It provides variety of features that help developers and administrators deploy their data-backed applications. We will see the steps to Install PostgreSQL Server in below section. More on official documentation.
PostgreSQL: these are the interactive terminal client psql. Programs for creating and removing users and databases. This is the client package for PostgreSQL 13. PostgreSQL 13 on a standalone machine, you need the server package. Postgresql-13, too. Apr 23, 2020 PostgreSQL, or Postgres, is a relational database management system that provides an implementation of the SQL querying language. This quickstart guide demonstrates how to install Postgres on an Ubuntu 20.04 server. It also provides instructions for g.
How to Install PostgreSQL on Ubuntu 20.04 LTS
Also Read:8 Useful apt-add-repository command examples in Linux [Cheat Sheet]
Step 1: Prerequisites
a) You should have a running
Ubuntu 20.04 LTS Server.
b) You should have
sudo or root access to run privileged commands.
c) You should have
apt or apt-get utility installed in Your Server.
d) You should also have
wget , apt-key and mlocate utility available in your Server.
Step 2: Add Repository
As PostgreSQL packages are not available through Ubuntu repositories, we need to add the required repository configuration in
/etc/apt/sources.list.d/pgdg.list from where we can download the PostgreSQL package by using below command.
Step 3: Import Repository Signing KeyPostgresql Client Ubuntu Download
Next, you need to import the repository signing key by downloading it through wget utility and adding it using apt-key command as shown below. How to draw on imac.
Step 4: Update Your Server
Once repository is added, you can now update the package cache with list of packages from repository by using
apt-get update command as shown below.
Step 5: Install PostgreSQL
You can install the latest version of postgresql by running
apt-get -y install postgresql command or you can install the specific version by running apt-get -y install postgresql-14 command.
Step 6: Check PostgreSQL Service
By default after installation, postgresql service will be started automatically. You can check the status by running
/etc/init.d/postgresql status command. But in case it is not in active state, you can start or restart the service by using /etc/init.d/postgresql start or /etc/init.d/postgresql restart command. How many copies of elder scrolls online sold.
Step 7: Check Postgres Version
There is a chance that postgres utility will not be available in the location where System usually look for all the binaries. So you might need to find the utility by using locate postgres command. In my system, it is installed under
/usr/lib/postgres/14/bin directory. This path might be different for you. Once you located your package you can now run the utility by either specifying the entire path or adding this path in $PATH variable and then just use postgres command. For now I am using entire path to check the version of PostgreSQL Server currently installed by running /usr/lib/postgresql/14/bin/postgres -V command as shown below.
Step 8: Switch to psql prompt
PostgreSQL prohibits running any psql command through root user so in case you are currently logged in with root account, you need to switch it to a non-privileged account. You can switch to
postgres user by running su - postgres command and then run psql command to start the postgres prompt as shown below.
Step 9: Show List of Databases
You can check the current list of databases by using
l command in the PostgreSQL prompt as shown below.
Step 10: Check Your Database Connection
You can also check the current database connection details by using
conninfo command in the PostgreSQL prompt.
Install Postgresql Client On Ubuntu 20Step 11: Create a DatabasePostgresql 9.6 Download
When it comes to database creation, you need to use
create database <db_name> syntax. In this example, we are creating a sample database by using CREATE DATABASE sample command and then checking the list by using l command.
Ubuntu 20 PostgresqlStep 12: Uninstall PostgreSQL Database
Once you are done with the Database and you don't need it any longer then you can uninstall PostgreSQL Database by using
apt-get -y remove postgresql command as shown below.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2021
Categories |