+92-514264094
  • fb
  • Home
  • Services
  • Our Expertise
  • Recent Projects
  • About Us
    • Profile Info
    • Testimonials
    • Blog
    • About Us
    • Get a Quote
  • Contact Us

Postgre SQL Installation In Linux

This tutorial will guide you step by step for the installation of postgres in linux distribution .

Installation

Ubuntu's default repositories contain Postgres packages, so we can install them without a hassle using the apt packaging system. Since we haven't updated our local apt repository lately, let's do that now. We can then get the Postgres package and a "contrib" package that adds some additional utilities and functionality: sudo apt-get update sudo apt-get install postgresql postgresql-contrib postgre-SQl-installation-command Now that our software is installed, we can go over how it works and how it may be different from similar database management systems you may have used.

Access PostgreSQL command prompt

The installation procedure created a user account called "postgres" that is associated with the default Postgres role. In order to use Postgres, we'll need to log into that account. You can do that by typing: sudo -u postgres psql postgres postgre-SQl To exit from postgre SQL prompt, type \q in the psql prompt return back to the Terminal.

Set “postgres” user password

Login to postgre sql prompt, sudo -u postgres psql postgres and set postgres password with following command: postgres=# \password postgres postgre-SQl To install Postgre SQL Adminpack, enter the command in postgre sql prompt: postgres=# CREATE EXTENSION adminpack; CREATE EXTENSION postgre-SQl

Create New User and Database

For example, let us create a new user called “demo” with password “demo”, and database called “mydb”. sudo -u postgres createuser -D -A -P demo postgre-SQl sudo -u postgres createdb -O demo mydb postgre-SQl

Delete Users and Databases

To delete the database, switch to postgres user: sudo -u postgres psql postgres Enter command: $ drop database (database-name) postgre-SQl To delete a user, enter the following command: $ drop user (user-name) postgre-SQl

MangoCoders © 2017 All Rights Reserved