initializing the database postgre

initializing the database postgre

by James Noxon -
Number of replies: 5
I have installed everything, so now to set things up.
Instructions at https://docs.moodle.org/27/en/PostgreSQ

 psql -U postgres
   Password for user postgres:
I enter command thus
odroid@odroid:/$psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"

so I tried the root user (what do I know)

odroid@odroid:/$psql -U odroid

psql: FATAL: role "odroid" does not exist

Install did not ask me for a user name, but it did ask for a password. What's the default username?


Average of ratings: -
In reply to James Noxon

Re: initializing the database postgre

by James Noxon -

There is no line in the Moodle instructions that says to run the initdb command. Is this just assumed?

yours - pj

In reply to James Noxon

Re: initializing the database postgre

by James Noxon -

I managed to switch user to postgres and followed the instructions to the letter, and ended up with the same things shown in https://docs.moodle.org/28/en/PostgreSQL except the user for moodle is postgres

When I went to show the table there with the \l command I couldn't get out of that, and the table unfortunately covered my terminal log so now I can't remember how I switched user to postgres (!@!)

I expected to be able to scroll back and see how I did it, I had tried so many things... arrgh

moving on...

In reply to James Noxon

Re: initializing the database postgre

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

It's put the output automatically into a program called `less`. Press the q (lower-case Q) key.

In reply to Andrew Lyons

Moodle Lubuntu Installation

by James Noxon -

Hi all, I ended up getting some things going but felt I needed to refresh my memory of the command line programs, so I went to the library and got a LINUX manual and after a few days I have more confidence. Now I have a few more questions.

In the install instructions, there are notes to create some users for various tasks so that permissions can be limited depending on what task is at hand. Can someone provide a complete list of all the users normally used to administer a single user Lubuntu install of Moodle? I know there is 'moodleuser' and 'postgre' that last one seems to have been created automatically during the install as I found it with cat /etc/passwrd and I didn't put it in there. I'm not talking about the students who login to Moodle courses.

Is there a command line to get the version of locally installed packages, perhaps in apt?

I have reflashed the OS eMMC and am going to go through the install again, once I figure out how to save the terminal output - it makes very interesting reading!

thanks - pj

In reply to James Noxon

Re: initializing the database postgre

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi James,

Unfortunately this depends on your Postgres configuration, which will depend on how it was installed for you.

On Debian, the postgres user can only log on using the ident method and does not accept a password. By default, the only user to exist is the 'postgres' user too. Therefore for your initial Postgres connection, you need to login as the postgres user (on Debian that's "postgres"), and set things up from there. I do so using:

sudo su - postgres
createuser -SRDP <username>
createdb -O <username> <databasename>


For my development environment, I also throw in a user for myself:

sudo su - postgres
createuser -srd <myunixusername>
createdb -O <myunixusername> <myunixusername>

This enables me to run psql as my own user and auth using ident.

Best wishes,

Andrew