Setting PostgresSQL for my VPS

0

I am about to deploy my app to a vps for the first time, and running into some issues while configuring my DB.

After running the following commands...

# PostgreSQL
add-apt-repository ppa:pitti/postgresql
apt-get -y update
apt-get -y install postgresql libpq-dev

everything seemed to work fine until

sudo -u postgres psql

I was supposed to login to psql, but the command did not do anything (didn't return anything). I tried

su postgres

instead, and it got me to postgres@myaccount:/root$

and then I tried

sudo postgres psql

and it asked me for the password, but the root password did not work for this.

What's the right way of logging into postgres in this case, and how do I set up my database?

UPDATE: I tried the following,

root@max:~# su postgres
postgres@max:/root$ psql
bash: /usr/bin/psql: /usr/bin/perl: bad interpreter: permission denied

Maximus S

Posted 2012-12-02T00:27:20.433

Reputation:

Answers

0

I think psql is supposed to run as postgres user . You should not type 'sudo' .

root@myaccount:/root$ su postgres
postgres@myaccount:/root$ psql 

R Milushev

Posted 2012-12-02T00:27:20.433

Reputation: 116

when I do psql create user, it gives me usr/bin/perl: bad interpreter: permission denied – None – 2012-12-02T01:03:58.107

When you issue 'psql' command as a postgres user , it takes you to command prompt . There you should type : create user your_user with password 'password'; (notice the semicolon at the end of the sql command). In case the user is created successfully , you should see something like CREATE ROLE. – None – 2012-12-02T01:09:38.557

check my update please – None – 2012-12-02T01:15:12.020

1As 'postgres' , what does $ echo $PATH shows ? Is your perl package installed ? (on debian : apt-cache policy perl) – None – 2012-12-02T01:19:57.857

Installing perl solved the problem! – None – 2012-12-02T01:38:39.087

I'm happy for you . Good luck with the app. – None – 2012-12-02T01:40:12.097