How to install and use PostgreSQL on Ubuntu 20.04?
Overview
Many websites and apps use relational database management systems (RDBMS) as a fundamental building block. They offer a systematic technique to gather, arrange, and access data.
A RDBMS called PostgreSQL, sometimes known as Postgres, offers an implementation of the SQL. It complies with standards and includes several cutting-edge capabilities, like concurrency without read locks and transactions that can be trusted.
Learn step-by-step how to install and use PostgreSQL on Ubuntu 20.04 with this easy-to-follow guide. Start using this powerful open-source database today!
Prerequisites
There are certain prerequisites that need to be met before you begin:
Ubuntu 20.04 server
SSH supported code editor
Basic knowledge of database
Get Started
Postgres packages by default present in ubuntu's repositories, so we will use apt packaging system to install it. Follow the below steps:
Step 1: Update server's local package index
Step 2: Install Postgres packages with -contrib package.
Step 3: Check if the server is working properly using systemct1 start command.
Now, the PostgreSQL is installed, let's see how it works.
Moving to Postgres Account
Step 1: On your server, change to the Postgres account.
Step 2: Access the PostgreSQL prompt using the following command.
Step 3: Exit the PostgreSQL prompt using:
New role creation
Create a new role by typing:
New Database creation
Type the following command to create a new database:
Connecting to a database
Use the following command to connect to database:
Creating and deleting Table
Syntex for creating a table:
Adding data in a table
To view this data, type
Delete data from table
View table again
Conclusion
PostgreSQL is now configured on your Ubuntu 20.04 server.
Last updated