254
votes
Accepted
How to install psql without Postgres?
Oh, yes:
$ sudo apt-get install -y postgresql-client
$ psql --version
psql (PostgreSQL) 9.5.12
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 ...
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 ...
81
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
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 ...
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 ...
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 /...
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, ...
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 ...
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
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.
26
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:
┌────────────────────────────────────────────────────────...
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
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 ...
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 ...
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/...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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/...
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....
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 ...
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 ...
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]
...
13
votes
Accepted
How to upgrade PostgreSQL from 14 to 15 on Ubuntu 22.04?
PostgreSQL 15 is not available in the default package repository. To install PostgreSQL >= 15, you need to add an additional APT repository to /etc/apt/sources.list.d/.
In order to do so, run:
sudo ...
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
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
postgresql × 667apt × 109
server × 70
14.04 × 52
package-management × 52
software-installation × 39
database × 33
16.04 × 28
12.04 × 27
permissions × 27
pgadmin × 26
command-line × 21
bash × 21
networking × 20
20.04 × 20
upgrade × 19
dependencies × 17
18.04 × 15
dpkg × 15
php × 15
python × 14
apache2 × 12
ruby × 12
mysql × 11
systemd × 11