+1 vote
in Databases by (3.2k points)
What command should I use to install PostgreSQL on Ubuntu 20?

After installing PostgreSQL, how can I access it from the command line?

1 Answer

0 votes
by (30.3k points)

Ubuntu’s default repositories contain PostgreSQL packages, so you can install them using the "apt install" command.

Step 1: Update your local package repository.

$ sudo apt-get update

Step 2: Install the postgres package. You can also install postgresql-contrib package that adds some additional utilities and functionality.

$ sudo apt install postgresql postgresql-contrib

The PostgreSQL is now installed. To access it from the command line, run the following command:

$ sudo -u postgres psql postgres

This will log you into the PostgreSQL prompt. You can run your SQLs there.

psql (12.6 (Ubuntu 12.6-0ubuntu0.20.04.1))
Type "help" for help.


Related questions

+2 votes
1 answer
+3 votes
1 answer