NeevAI SuperCloud
LoginSIGN UP
  • NeevCloud Account
    • Getting Started with Neev account
      • Create & activate NeevCloud account
        • NeevCloud Account Signup
          • Email Verification
          • KYC Validation
          • Enter Billing Profile
          • Payment Validation
        • Customer Validation Process for Indian Customers
          • If you are the primary contact of the Organization
          • If you are not a Primary Contact in NeevCloud Account
      • Customer Validation Process FAQs
  • NeevCloud Products
    • Dashboard
    • Computes
      • Compute Flavors
      • Getting Started Launch VMs
        • Launch Alma Linux
        • Launch Window Server
        • Launch Instance using the Password
      • Launch instance by 1-click Marketplace platform
        • Create a Tally instance from the Neevcloud Marketplace
        • Create a PostgreSQL instance from Neevcloud Marketplace
        • Create a Nginx instance from Neevcloud Marketplace
        • Create a MariaDB instance from Neevcloud Marketplace
        • Create a Docker instance from Neevcloud Marketplace
        • Create a Nodejs Instance from Neevcloud Marketplace
        • Create a MongoDB Instance from the Neevcloud Marketplace
        • Create a CloudPanel Instance from the Neevcloud Marketplace
        • Create a GitLab Instance from the Neevcloud Marketplace
        • Create a Ubuntu RDP Instance from the Neevcloud Marketplace
        • Create a Clickhouse Instance from the Neevcloud Marketplace
        • Create an OpenLiteSpeed WordPress Instance from the NeevCloud Marketplace
        • Create a FortiGate instance from the Neevcloud Marketplace
      • Manage Cloud Instance
        • Overview
        • Volumes
        • Snapshots
        • Networking
        • Security Group
          • Add Rules to the Security group
        • Rescale
        • Pricing
      • Default username of operating systems
      • Volume-based instances and image-based instances.
      • How to Delete the Instance
    • GPU
      • Deploy GPU Instance with Tesla T4
    • Networking
      • Network
        • Create a Network
        • Create Network With Private IP
      • LoadBalancer
        • Configure Load Balancing
      • Floating IPs
        • Create Floating IPs
        • Assign Floating IPs
      • Routers
        • Create Router
      • Security Groups
        • Add Security Group
        • Allow SSH Port to Specific IP Address
        • Allow ICMP for ping
        • Allow RDP Port to Specific IP Address
      • Subnets
        • Create Subnets
    • Volumes
      • Create a volume
      • Delete a volume
      • Attach Volume to Instance
      • Extend Instance Volume Size
      • To create a server using volume
    • Backups
      • Here's a guide on how to create a backup.
    • Snapshots
      • Create snapshosts
      • Create an Instance using Snapshot
    • Storage
      • Object storage
        • Create Bucket
        • Service URLs for NeevCloud S3
      • Neevcloud S3 integration
        • Connect Acronis Backup Gateway With Neevcloud Storage
        • Connect Veeam Backup Gateway With Neevcloud Storage
        • Connect MSP360 Backup With Neevcloud Storage
        • Connect Vembu Backup with Neevcloud storage
        • Connect Ahsay cloud backup suite(ACBS) with NeevCloud Storage
        • Connect ARQ Backup Solution with NeevCloud Storage
        • Backup your WordPress Site to Neevcloud s3 storage with using Updraft plugin
        • Connect Bucket with S3 Client
        • Connect Bucket with Cyberduck
        • Connect S3 storage to CPanel
        • Connect S3 Drive to NeevCloud S3 Bucket
        • Mount S3 Bucket to Linux operating system
        • How To Mount NeevCloud S3 Bucket as a Window Drive
      • S3 data migrations
        • Migrate from AWS s3 storage to NeevCloud s3 storage
        • Migrate from Wasabi s3 storage to NeevCloud s3 storage
    • Kubernetes
      • Launch Kubernetes Cluster
    • Financial Information
      • Add Fund
      • Bill History
      • Billing Address
      • How Does NeevCloud Billing Works
    • Access Details
      • SSH KEY
        • Generate SSH_KEY
      • Application Credentials
      • S3/EC2 Credentials
        • Create S3/EC2 Credentials
    • Abuse Complaints
      • What is Phishing?
    • Support
    • Security
  • NeevCloud Guide
    • NeevCloud KnowledgeBase
      • Set up LEMP (Linux, Nginx, MySQL, PHP) in Ubuntu Linux
      • Set up LAMP (Linux, Apache, MySQL, PHP) in Ubuntu Linux
      • Set up WordPress in Linux instance
      • Set up Plesk in Ubuntu
      • Set up Cpanel in Linux Instance
      • Set up Grafana
        • Install Grafana and Prometheus on Ubuntu 22.04
      • Set up a MongoDB Cluster using 3 Linux Instances
        • MongoDB Cluster with 3 Linux Instances
      • Setup Ansible Linux Instance and Application deployment on Instances
        • Deployment Application on Instances
      • Install Node.js & NPM on Linux
        • Installation of Node.js and NPM in Alma Linux
      • How to use SFTP for Uploading & Downloading files
      • Two-factor Authentication
      • How to use PuTTY for SSH key-based authentication
      • How To Create VPC on NeevCloud
      • How to Install Nginx on Ubuntu 22.04
      • How To Install Apache on Ubuntu 22.04
      • How To Install MySQL on Ubuntu 22.04
        • Mysql database backup and restore by mysqldump
      • How To Install MariaDB on Ubuntu 22.04
      • How To Install PostgreSQL on Ubuntu 22.04
      • How To Install MongoDB on Ubuntu 22.04
      • How To Install phpMyAdmin on Ubuntu 22.04
      • How To Open Port on Linux
      • How to Install Metabase on Ubuntu 22.04
      • How to transfer data from a Windows server to a NeevCloud bucket using Rclone
      • How to Integrate QNAP NAS storage and Backup to Neevcloud
      • How to Install Remote Desktop (xrdp) on Ubuntu.
      • Setup MLflow in Neevcloud Instance
      • Docker
        • Docker Installation in Ubuntu/Debian
        • Some Best practices for using Docker in application development include:
          • Create a Docker File and using Docker file Build Images
          • Docker Container
          • Docker-Compose
      • Acronis Backup Gateway With Neevcloud
    • Kubernetes
      • Deploy Nginx Service in Kubernetes
      • Deploy Lamp in Kubernetes with using Helm.
      • Deploy WordPress in Kubernetes.
      • Deploy Argocd in Kubernetes
      • Deploy Jenkins in the Kubernetes cluster
    • Troubleshoot
      • How to Access Instances
        • Access Linux instance
        • Access with Password Authentication
        • Access Windows Instance
        • Change the RDP Port and access the windows server
      • How to change the SSH Port
      • Troubleshooting Steps If your Instance is not accessible
      • How to Monitor Server Load on a Windows Cloud Instance
      • Why cloud instance is Out Of disk space
      • High Processor Load on your cloud instance
      • Steps If your Website URL is down
      • Best Practices After Reboot.
      • Reset the root password.
    • Use case
      • High-Level Architecture with Load Balancer and Jump Server in a VPC Setup
    • FAQ
      • Setup Zabbix app
      • How to change the instance Password
      • How to Access a Server Using a Static IP Address
      • What is the billing process for NeevCloud?
      • What payment methods are accepted by NeevCloud?
      • What happens if I miss a payment?
      • What is YAML
      • How can I get support for billing-related issues?
      • Can I contact NeevCloud's technical support team?
      • How to raise the ticket in the NeevCloud
      • Where can I find additional information on pricing and billing?
      • What are the terms and conditions for using Neevcloud services
Powered by GitBook
On this page
  • Prerequisites
  • Update && Upgrade the system
  • Install PostgreSQL
  • Start and Enable PostgreSQL
  • To check the status
  • To check the version
  • Manage PostgreSQL service
  • Access PostgreSQL Prompt
  • Create a New Database
  • Create a New Table
  1. NeevCloud Guide
  2. NeevCloud KnowledgeBase

How To Install PostgreSQL on Ubuntu 22.04

In this guide, we will explain how to install PostgreSQL on Ubuntu 22.04, enabling you to set up a powerful relational database system for your projects.

PreviousHow To Install MariaDB on Ubuntu 22.04NextHow To Install MongoDB on Ubuntu 22.04

Last updated 7 months ago

PostgreSQL is one of the leading and most widely used open-source relational database management systems it is a robust and high-performance database system known for its flexibility in handling multiple data types stability, integrity, and concurrency.

Prerequisites

Make sure you have the necessary prerequisites to successfully install Postgresql on ubuntu 22.04.

  • Launch the on Neevcloud

  • Access the server using

Update && Upgrade the system

First, ensure your package list is up to date to avoid any issues with outdated packages

sudo apt-get update -y
sudo apt-get upgrade -y

Install PostgreSQL

To install PostgreSQL use the apt package manage and run the following command from a terminal prompt:

sudo apt install postgresql postgresql-contrib -y

Start and Enable PostgreSQL

After installation, the PostgreSQL service starts and enables

Once the PostgreSQL is installed, start the PostgreSQL server

Once the MariaDB is installed, start the MariaDB server

sudo systemctl start postgresql

Enable it to start when the system rebooted

sudo systemctl enable postgresql

To check the status

Verify that the database service is active and running. Run the following command

sudo systemctl status postgresql

To check the version

Verify the version installed by running the command:

sudo psql --version

Manage PostgreSQL service

PostgreSQL runs quietly in the background upon installation. By default, it listens on TCP port 5432. You can verify this using the ss command.

sudo ss -antpl  | grep 5432

Access PostgreSQL Prompt

When PostgreSQL is installed, a standard user account named Postgres is automatically created. The Postgres user takes on the default Postgres role as well.

PostgreSQL uses a role-based authentication system as its default. Having superuser privileges, the user 'Postgres' has complete administrative control. Enter this command to log in as the user 'Postgres'

sudo su - postgres

Then, to access the PostgreSQL prompt, type

psql

From here, you can start executing your database management tasks.

To leave the prompt, type \q, and exiting the prompt will return you to your Postgres account in your terminal. Execute the exit command to return to your normal account and leave.

\q
exit

Create a New Database

This section will cover the process of establishing a database in PostgreSQL and generating tables within it. The standard PostgreSQL installation includes three pre-existing databases: Postgres, template0, and template1.

To list the existing databases to run these commands.

\l

To create a database, run the create database database_name; command

create database example_db;

Create a New Table

In order to make a new table and add data, you must first change to the desired database where the table will be stored. Use the \c command to switch the database.

\c 

After transitioning to the database, you can begin to create tables. The syntax for a table in SQL is as follows

In this instance, we will generate a table named employees that includes six specific columns

CREATE TABLE employees (
	Person_ID serial PRIMARY KEY,
	First_Name VARCHAR ( 50 ) NOT NULL,
	Last_Name VARCHAR ( 50 ) NOT NULL,
	Email VARCHAR ( 255 ) UNIQUE NOT NULL,
           City VARCHAR ( 50 ) NOT NULL,
           age INT NOT NULL
);

To check the status of creating a table in a database to follow these \dt command

You can also use the \d table_name syntax to view the table schema.

\dt

To insert the values into the table, use the the INSERT INTO table_name command.

INSERT INTO employees 
VALUES ( 001, 'Phil', 'Shaw', 'philshaw@gmail.com', 'New York', 40);

Now check the status of table records to run these SELECT * FROM table_name command

SELECT * FROM employees;

Ubuntu 22.04 instance
SSH