248 votes
Accepted

How to install psql without Postgres?

Oh, yes: $ sudo apt-get install -y postgresql-client $ psql --version psql (PostgreSQL) 9.5.12
Steve Bennett's user avatar
224 votes
Accepted

How do I install PostgreSQL 9.6 on any Ubuntu version?

For the following Ubuntu versions, you can install with the given commands, as per the official PostgreSQL Apt Repository. Ubuntu 17.04 - 17.10 Version 9.6 comes with the distribution. sudo apt-get ...
Victor's user avatar
  • 9,313
165 votes

How to install pgAdmin 4 in desktop mode on Ubuntu

For pgAdmin 4 v4.21 on Ubuntu, according to the download page: Install dependencies, create a virtual environment, download, install & configure Using Python2.x sudo apt-get install virtualenv ...
Victor's user avatar
  • 9,313
80 votes
Accepted

What is a masked service?

Masking a service will prevent it from starting. To unmask a service run: systemctl unmask name.service Source: How to Manage Systemd Services on a Linux System | How To Geek
Jeff's user avatar
  • 1,674
52 votes

How to install pgAdmin 4 in desktop mode on Ubuntu

Other option is to use docker and a docker image provided by thaJeztah - https://github.com/thaJeztah/pgadmin4-docker $ docker run --rm -p 5050:5050 thajeztah/pgadmin4 Then to access a PostgreSQL DB ...
Alexandar Mitsev's user avatar
50 votes
Accepted

How to install pgAdmin 4 in desktop mode on Ubuntu

On Ubuntu 16.04 you can install pgadmin4 with sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' sudo apt install ...
Muhamed Huseinbašić's user avatar
43 votes
Accepted

Skipping acquire of configured file in ubuntu 20.04 LTS

The definition for your apt.postgresql.org repo is defined in one of two possible places. Let's find it... In terminal... sudo grep -i postgresql /etc/apt/sources.list or sudo grep -i postgresql /...
heynnema's user avatar
  • 70.6k
35 votes
Accepted

Unable to install postgreSQL 9.6 in Ubuntu 18.04

After few months I had to erase and install from scratch, so in order to install postgresql 9.6 I followed next steps: Important notes: If you have already installed postgresql 10 and you want 9.6, ...
webtechnelson's user avatar
30 votes

Remotely access postgresql database

This does not work anymore, if it ever did : host all all * md5 The correct possible lines for this are : host all all 0.0.0.0/0 md5 #ipv4 range host all all ::0/0 md5 #ipv6 range host all all all ...
Kethryweryn's user avatar
28 votes

How to make Postgres start automatically on boot

From Ubuntu 15.04 onwards do: sudo systemctl enable [SERVICE] Which in your case is: sudo systemctl enable postgresql
Kim's user avatar
  • 381
26 votes
Accepted

How to enable PostgreSQL driver for PDO for php 7?

You've been running php7.1 while you installed php7.0 pgsql module. Try php -v to check your version and install php7.1-pgsql.
Voovode's user avatar
  • 396
25 votes
Accepted

"postgres: command not found" / after regular install of postgres and configure new data directory

postgres execution command is psql and not postgres postgres is the username info from pgGettingStarted To test your connection using psql, run the following command: psql -U postgres -W
Yaron's user avatar
  • 13.2k
25 votes
Accepted

psql command "Error: PostgreSQL version 12 is not installed"

I've reproduced your case and here's how I resolved it: Use sudo apt purge postgresql-12 answering Yes if you want to remove it completely: ┌────────────────────────────────────────────────────────...
Gryu's user avatar
  • 7,559
24 votes

Problems installing postgresql-9.4: Unable to locate package

You can install postgres 9.4 on Ubuntu 14.04! Follow the instructions on http://www.postgresql.org/download/linux/ubuntu/: Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for ...
TimoSolo's user avatar
  • 341
24 votes

Postgresql server doesn't start

This is an idiosyncrasy of the systemd integration of PostgreSQL in Xenial. The postgresql service unit installed by the postgresql-common package is just a dummy service which causes the actual ...
Tilman's user avatar
  • 3,509
22 votes

How do I install PostgreSQL 9.6 on any Ubuntu version?

Follow below steps: Reference is taken from this blog. You need to add the latest PostgreSQL repository for the latest version. sudo add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt/...
Anvesh's user avatar
  • 591
21 votes

How do I reinstall PostgreSQL 9.5 on Ubuntu Xenial (16.04.1)?

I've finally managed to resolve the problem. The installer failed to create a config, because the previous data directory was present (it's not deleted by the uninstall command). So, in order to ...
Slava Fomin II's user avatar
21 votes
Accepted

Peer authentication failed for user with all privileges in Postgres 9.5

Open /etc/postgresql/9.5/main/pg_hba.conf with root access sudo nano /etc/postgresql/9.5/main/pg_hba.conf Change peer to md5 in these lines. Before changing # "local" is for Unix domain socket ...
Anwar's user avatar
  • 76.6k
20 votes
Accepted

Set PostgreSQL pager to less?

\setenv PAGER less in .psqlrc overwrites the environment variable with an undesirable different value (without the -S option). Either remove it, or change it to \setenv PAGER 'less -S', or create a ...
Daniel Vérité's user avatar
19 votes

How to remove Postgres from my installation?

Follow the commands: sudo apt-get --purge remove postgresql List all postgres related packages: dpkg -l | grep postgres remove all the above listed packages using the command : apt-get --purge ...
T.Tijo's user avatar
  • 191
19 votes

How to install pgAdmin 4 in server mode on Ubuntu 16.04

These are the steps I followed to make it run: 1) I didn't have virtualenvwrapper installed, so I (duh!) installed it sudo pip install virtualenvwrapper 2) Standing on my home folder, I made a ...
ffflabs's user avatar
  • 301
18 votes
Accepted

How to install postgresql-9.4 on Ubuntu 16.04?

Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository: deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main Import the repository signing key, and update the ...
Videonauth's user avatar
  • 33.3k
17 votes

How to make psql to default to localhost?

If you don't like the default of connecting via a unix socket, you can set the environment variable PGHOST. I have export PGHOST="db" in my ~/.bashrc, to connect to the server with that name. A few ...
Andrew's user avatar
  • 313
16 votes

How to install PostgreSQL 13 in Ubuntu?

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/...
Thirumal's user avatar
  • 979
14 votes

After upgrade 14.04 to 16.04.1 Postgresql server does not start

Systemd should use script from /etc/init.d. Instead, systemd uses some kind of template file. To fix that, follow that steps: Remove invalid service script: # rm /lib/systemd/system/postgresql....
Artur Eshenbrener's user avatar
14 votes

How to uninstall the postgresql

The simplest way to do this is open a terminal and type: sudo apt-get --purge remove postgresql This will remove the postgresql package. There may be chances that additional packages are also ...
Murtaza Manasawala's user avatar
13 votes

How to uninstall specific versions of Postgres?

Different versions of PostgreSQL are located in the packages postgresql-9.*. So you should remove your two packages: sudo apt-get purge postgresql-9.3 postgresql-9.5 Then you should remove ...
Correcter's user avatar
  • 241
13 votes
Accepted

After upgrade 14.04 to 16.04.1 Postgresql server does not start

This should work out of the box if you provide the correct version and cluster name. Lets say you're running version 9.5 and the cluster is called main: Start: systemctl start [email protected] ...
malte's user avatar
  • 389
12 votes

How do I find the path to pg_hba.conf from the shell?

Using command-line, ask your database: $ psql -U postgres postgres=# SHOW config_file; Copied from Stackoverflow - https://stackoverflow.com/a/3603162/5677857
neonidian's user avatar
  • 291
12 votes
Accepted

PostgreSQL fails to reinstall after upgrading Ubuntu 12.04 to 14.04

I had the same problem, upgraded Ubuntu 12.04 to 14.04. Don't know but it also using systemd. While checking /etc/init.d/postgresql file it uses /usr/share/postgresql-common/init.d-functions. This ...
Shivaditya's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible