On my local machine, when I want to start the postgres server (postgres was installed via Homebrew), I do this
pg_ctl -D /usr/local/var/postgres -l logfile start
I just installed postgres on a ubuntu vps (without Homebrew and not on OSX obviously) and the files are obviously set up a little differently, however, based on what I did on the local machine to start pg, I tried to find the path to postgres folder on the vps. From my home/michael
directory, I backed up two levels cd ../../
to a folder which contains these folders
bin etc lib mnt root selinux tmp vmlinuz
boot home lost+found opt run srv usr
dev initrd.img media proc sbin sys var
Inside etc
, there's a postgresql
inside of which there's a 9.1
folder, inside of which is main
that has all these files
environment pg_hba.conf postgresql.conf
pg_ctl.conf pg_ident.conf start.conf
Based on how I start pg on my local machine, I'm assuming pg_ctl.conf is the file I'm looking for. I tried to start pg this way
pg_ctl -D /etc/postgresql/9.1/main -l logfile start
but I get the response
-bash: pg_ctl: command not found
I'm assuming that I have to start the server once before launch of the app and then let it run, but I can't get it started.
Update
Once I finished installing postgres, I ran this command
sudo service postgresql restart
I'm not sure if that starts postgres once and I never need to start it again (hence this question is moot), or if that was just something I do at install and then start it everytime I use it as I do on my local machine.