How to Install PostgreSQL on Ubuntu 20.04

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody how is it going welcome to linuxin.com youtube channel in today's video we're gonna show you that how you can install post grace um on your ubuntu 20.04 so the idea is that postgresql is a relational database management system that provides an implementation of the sql querying language it is a popular choice for many small and large projects and it has the advantage of being standards compliant and having many advanced features like reliable transactions and concurrency without read blocks all right so what we're gonna do is that we're gonna use the terminal to install uh this thing the postgresql so you press ctrl alt t and right after pressing ctrl alt t what you're going to do is that you're going to update your repository okay so whenever make sure you open up your system after a long time and if you are going to install something up for a long time or even every day make sure that you update your repository okay so once the update is done now what you're going to do is that you're going to install the postgresql software using this command so you would just write here sudo apt and then you would write your install and then you would write here postgresql and after that you're gonna write here uh post gray sql so the idea is that till here it's done if you hit enter post free sql will be installed so what we want to do is that we want to install some additional packages as well so we just write here postgre sql hyphen contrive so this is a package that you know offers some additional utilities and functionalities so we have added that as well so now if we hit enter it is going to install this post pre-sql you can see that it's 121 megabytes in size so i'm gonna press y because yes i want to install this on my system and now it would start to download it once it downloads it it would start to install it all right so we'll wait the installation procedure created a user account called postgres that is associated with the default postgres role in order to use postgres you can log into that account so there are two ways in which you can access the postgresql and i'm going to show you both so basically there are two ways in which you can access the postgresql and i'm going to show you both so let me just clear it so what i'm going to do is that i'm going to write here sudo hyphen i hyphen u and then i'm going to write here postgres okay so once i do that i hit enter and you can see that now i am using the post phrase user okay so i'm logged in as a post race user and now if i wanna access the uh post phrase uh you can say command line specifically or the interface then what i can do is that i can write here psql and if i hit enter you can see that here i come and in order to quit all i can do is that i can write here slash oh excuse me i can write here forward slash q and it would basically quit it all right another way to do the same thing is that i write here sudo and then i write here hyphen u and then i write here post grace and then i write here psql okay so it would now take me directly to that interface okay right here so in order to quit i can write here slash q and it would take me out of there all right so let me just clear it another thing that we can do is that we can create a user so in postgres uh the current user is my let me show you again so if i go here and if i write here um slash and then if i write here con info you can see that it says you are connected to database post race as user postgres via socket uh you know in slash variable slash run slash postgresql at port 5432 so the database is postgres and the user is post phrase as well so what i'm going to do is that i'm going to create a new user and a new database and then i'm going to connect that new user and the new database here as well okay so let's see how do we do that so first of all let me just quit it i come out of here let me just clear it and now i would create a user so for that i would just write here sudo hyphen u and then i would write here postgres and then i would write here create user and then i would write here hyphen hyphen interactive all right so after that you hit enter it is going to ask you enter the name of role to add so we're going to add linux send all right so we hit enter it is going to say shell the new role to be as super user all right so we press y and you can see that we have added it so after creating the user uh we're gonna create a new database as well so let's create it we write here sudo hyphen u and then we write here postgres and then we write here create db and we create a database with the linux name as well so we hit enter and you can see that it has not given us any errors which mean that the database have been created successfully and as i have shown you previously that if you go to the postgres sql database interface with the postgres user uh you would see you had seen that statement that i'm talking about the post race uh the database post phrase is connected to the user postgres at the board four five four three two okay a statement something like that so right now uh instead of actually signing in as the postgres user we're gonna sign in as a linux in user so instead of this command let me show you all right so previously what we have done is that we had here uh sudo hyphen u post press and pu sql okay so you know what it would do so instead of post phrase what we're gonna do is that we're gonna write here our user name which is essentially linux hint all right so we hit enter and you can see that now we have got into the postgres all right so here if i just write here forward slash and if i write here con info you hit enter and you can see here it says you're connected to the database linux and as user linux synth via socket in slash var slash run slash postgresql at port 5432 all right so i hope you have understood this thing you know what i'm talking about so that's how you basically create a new user you create a new database in postgresql so if you have any questions you can ask us in the comments below so that's how you install poster sql on your ubuntu 20.04 thank you so much for watching and for written articles always you can visit our website linuxin.com [Music] [Music] you
Info
Channel: linuxhint
Views: 24,676
Rating: 4.8403754 out of 5
Keywords: postgresql, postgres, install postgres on ubuntu, ubuntu, linux, How to Install PostgreSQL on Ubuntu 20.04
Id: 9lq74SafVcw
Channel Id: undefined
Length: 8min 40sec (520 seconds)
Published: Wed May 13 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.