Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres extension problems on Linux #62

Open
helenst opened this issue Nov 26, 2016 · 3 comments
Open

Postgres extension problems on Linux #62

helenst opened this issue Nov 26, 2016 · 3 comments

Comments

@helenst
Copy link
Contributor

helenst commented Nov 26, 2016

There are some problems with the postgres tutorial extension when run on Linux:

  1. There are a few packages that are required for the psycopg2 install to work:
  • postgresql-server-dev-X.Y (version may vary - on Ubuntu 16.04 it is 9.5)
  • gcc
  • libpython3.5-dev
  1. The default auth setup doesn't work. (Ref Can't access postgres shell #59) - first of all, the default user can't open psql and create a database, that needs to be done by postgres user (so they must sudo). I don't know if this is something that just works on Mac or Windows?

  2. Authenticating a named (non-unix) user over the tcp socket requires a password, however the settings in the tutorial extension don't use a password (and the user is never given one). This was discussed in Can't access postgres shell #59 - there are various options for this:

  • Get them to use their unix username, but that may require separate settings across different machines.
  • Get them to create the db user with a password, and include the password in settings. Probably the least complex and applicable to all platforms but would require careful pointing out of it being probably OK to include the password in this case, but making sure they're aware of it not generally being a good idea :)
  • Editing postgres config to trust local connections. It's a small edit but involves acting as root, changing a config file (probably making sure it gets backed up just in case) and restarting the postgres server.

Again, I don't know whether all this "just works" on windows and mac.

Interested in other opinions about what is the best way to deal with this!

@chemadent
Copy link

chemadent commented Sep 26, 2017

Hi, I'm a Windows 7 user.

For the 2nd problem:

On Windows, during installation it asked for providing a password for the database superuser [postgres].
Following the steps on Django Girls Tutorial: Extension: PostgreSQL installation, when Windows users run psql in Command Prompt and enter the password set during installation, it yields the following error message:

psql: FATAL: password authentication failed for user "USERNAME"

So, the solution is psql -U postgres -W.

For the 3rd problem:

When Windows users attempt to apply all the migrations like this:
python manage.py migrate
Command Prompt yields:
[...]
psycopg2.OperationalError: fe_sendauth: no password supplied

However, I found #59 (comment) and it helped me solve this problem! Thank you!

@jonathan88n
Copy link

After running sudo apt-get install postgresql postgresql-contrib, I tried running psql but got this error:

psql: FAT: role: "jonathan" does not exist

How do I create a role or how do I do this step correct? Running on xubuntu.

image

@jonathan88n
Copy link

jonathan88n commented Oct 4, 2018

I don't know if it was the environment variable or who I was logged in as but I was poking at last line from comment above, #59 (comment), and this worked to get into psql:

sudo -i -u postgres
psql

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants