-
Notifications
You must be signed in to change notification settings - Fork 4
Install postgresql
EnriqueVidal edited this page Aug 1, 2012
·
6 revisions
This is a simple how-to install PostgreSQL in your system.
Possibly the simplest setup:
sudo apt-get install postgresql-9.1 postgresql-client-9.1 libpq-dev -y
Update your $PATH
to include the newly installed postgres binaries:
export PATH=/usr/lib/postgresql/9.1/bin:$PATH
Simply follow the steps in this code block (you can copy and paste if you like).
sudo port install postgresql91 postgresql91-server
sudo mkdir -p /opt/local/var/db/postgresql91/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql91/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql91/bin/initdb -D /opt/local/var/db/postgresql91/defaultdb'
sudo port load postgresql91-server
You'll need to update your $PATH
variable to use the newly installed postgres
tools, just do this in you .bash_profile
or .bashrc
(assuming you're using bash):
export PATH=/opt/local/lib/postgresql91/bin:$PATH
brew install postgresql
initdb /usr/local/var/postgres
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist