I'm trying to follow this tutorial, but at the beginning it says to run a postgresql instance "locally" instead of as a daemon using the following commands.
$ initdb pg
$ postgres -D pg &
$ createdb shouter
So I've got a new 12.04 install (VMWare on Win7, if that matters) and did under my login:
$ sudo apt-get install postgresql
$ initdb pg
$ postgres -D pg
This gives me an error saying:
LOG: could not bind IPv4 socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING: could not create listen socket for "localhost"
FATAL: could not create any TCP/IP sockets
I figure this means installing the server caused it to run the daemon automatically. I'd prefer just running on the default port like in the tutorial, but I tried running a different port anyway:
$ postgres -D pg -p 5555
FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5555.lock": Permission denied
I've followed various other examples on different ways to install postgresql but all to no avail. How do I get past this error so that postgres -D pg
can execute successfully?
*note I'm perfectly willing to create a brand new VM, so if you've got instructions on how to do this with a fresh install, that'd be terrific.