Postgresql installation Error Ubuntu 14.04 - postgresql

I've tried to install Postgres for the past few days on Ubuntu 14.04. I have followed this set of commands:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get purge postgresql
sudo apt-get -f install
sudo apt-get install postgresql
With no such luck... The error message I get is as follows:
postgres#CouchVictory:~$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I've also tried the suggestion here and I've made sure that my shell is a login shell. Any suggestions?

Related

How do i install Postgres on Ubuntu and create a superuser?

I have successfully installed Postgres on Ubuntu 20.04 by running the following commands:
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib libpq-dev
which was successful. I then run the command:
$ sudo service postgresql start
which was also successful.
However, the command
$ sudo -u postgres createdb $USER
failed. The error message was as follows:
createuser: error: could not connect to database template1: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Please help me out.

Start a postgres server with pgadmin

I'm trying to start a postgreSQL server in Debian 10 in order to access this database: https://catalogofraneitalia.wordpress.com/database/.
I have never used postgreSQL before and I have tried to follow the instructions I found on the internet. This is what I have run up to now:
sudo apt -y install gnupg2
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-11
sudo apt install postgis postgresql-11-postgis-3
I checked that postgreSQL is active, enabled and accepting connections
sudo su - postgres, psql and create user username with superuser password 'password' with the username and password chosen
sudo apt install pgadmin3 pgadmin3-data
I opened pgadmin and I cliked on Add server, inserting the username and password previously created and I received the message Peer authentication failed for user "username"
the correct steps to install pg are in the official site: https://www.postgresql.org/download/
Follow the steps on screen, once initialized you can open the port (listen_address and pg_hba.conf), restart the service, and done... you can connect from other machine.
Other thing, pgadmin3 is deprecated, try using pgadmin4.

Unable to start Postgresql on Ubuntu

I am using Ubuntu on WSL.
I have been trying to get a postresql server to start but I can't.
When I try to start a service using
service postgresql start, it gives me
11/main (port 5432): down
On top of that even running the psql command gives me :
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Can anyone help me with this? I've looked at a dozen SO questions and it ultimately ends at the same error.
Try out:
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

None of the supported PHP extensions (PgSQL, PDO_PgSQL) are available

i have enabled extension=php_pdo_pgsql.dll and extension=php_pgsql.dll in my php.ini file but still unable to get adminer to work.
and also sudo service apache2 restart
sudo apt-get install php7.0-pgsql
cd /etc/postgresql/9.5/main
sudo nano pg_hba.conf
local all postgres peer
should be
local all postgres md5
sudo service postgresql restart
then you good to go :)

postgresql: no such file or directory

I'm trying to install a postgresql database on my VPS server by using this guide.
In there it says
sudo apt-get install postgresql postgresql-contrib libpq-dev
And then
sudo su - postgres
createuser --pwprompt
exit
When I run createuser --pwprompt it asks me to create a password, once I fill it in I get the following error:
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
If I do psql --version I get psql (PostgreSQL) 9.4beta3
And which psql outputs /usr/bin/psql
Any idea on how to fix this problem?
Update
Running pg_ctl gives another error
WARNING:root:could not open file '/etc/apt/sources.list.d/passenger.list'
The program 'pg_ctl' is currently not installed. To run 'pg_ctl' please ask your administrator to install the package 'postgres-xc'
Althgough reading up on postgres-xc shows quite a lot of other problems.