PostgreSQL is a database management system free under license with the same name, which also supports procedures stored in languages such as Java, C ++, Ruby, Python Perl …
Deciding whether to use MySQL or PostgreSQL can become a dilemma. It seems that the first is a little faster than the second, but the second, being free, is much denser in terms of features. That’s why at Ubunlog we want to teach you how download, install i to Prepare PostgreSQL for Use in Ubuntu | (Or any other Linux distribution) in the simplest way possible.
To install it, we need add a new repository in the repository list. We can do this easily by adding a line to ours sources.list with the repository in question. To do this we run:
suo sh -c ‘trobo «deb http: // apt.postgresql.org / pub / repos / apt /` lsb_release -cs`-PGDG main »>> /etc/apt/sources.list.d/pgdg.list’
Now we have to download the GPG key so that apt can check the validity of the packages we download from the previous repository. we execute:
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O – | sudo apt-key add –
Then we update the repositories:
sudo apt-get update
And finally, we install the packages PostgreSQL:
sudo apt-get install postgresql postgresql-contrib
Prepare PostgreSQL for use
In order to start using PostgreSQL, we must first connect us to your server. That’s why when installing PostgreSQL we actually have to created a system user named “postgres”. This user has PostgreSQL database administration privileges, so the first step is sign in with this user:
suo seu – postgres
Now we have to start the PostgreSQL terminal to log in to the database server. For this we run ‘psql’ and us we logged in to connect to the server.
If we want to take a look at the connection oa la version we have from PostgreSQL, we can run the following command:
postgres- # conninfo
Finally, for disconnect us from server from the database, we can do this by running the following:
postgres- # q
Note that we run the ‘exit’ command for exit the session which we had started at the beginning under the user «postgres».
If you have had any problems during the installation or preparation of PostgreSQL, leave it to us in the comments section and we will do our best to help you. Until next time.