DEV Community

Elvis Otieno
Elvis Otieno

Posted on

Installing Psql in parrot

Having a problem installing psql in parrot or you did install but did not configure properly . here are major steps to follow.

Parrot psql installaton:
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib libpq-dev
Enter y when prompted “Do you want to continue? [Y/n]” and wait as the installation completes.

Defining a user role
Postgres uses “roles” to aid in authentication and authorization. By default, Postgres creates a Postgres user and is the only user who can connect to the server.

We want to create our own superuser role to connect to the server.

For those running on elementary or parrot, run the following command first;
$ sudo service postgresql start
$ sudo -u postgres createuser --superuser $USER
Enter your desired password when prompted.

We then have to create a database with that $USER login name, this is what Postgres expects as default.
$ sudo -u postgres createdb $USER
Navigate to your home directory and enter the following command to create the .psql_history in order to save your history:
$ touch .psql_history
You can now connect to the Postgres server by typing :
$ psql

When facing an error, go through your terminal and navigate to:
$ ls /etc/apt/sources.list.d
that is
$ cd ..
then when @ sources.list.d :
$ sudo rm -r pgdg.list
When done repeat the first instruction shared in this article

Top comments (2)

Collapse
 
nileshh97 profile image
Nilesh

I am facing a problem,
I am using parrot os, the terminal commands download the postgresql-common file and I get this error (attaching a screenshot of it)

Image description

Can you suggest any solutions?

Collapse
 
beauspot profile image
Iyere Handsome(Beau) Omogbeme

Thanks elvis this worked for me so much. I was super scared that It won't work cause I had a fatal experience working with it in my formal system on parrot os.