-
-
Save doabit/7733058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On Mavericks (same for 10.6+) the biggest issue is that port 5432 is already taken so | |
# this: --- config.vm.network "forwarded_port", guest: 5432, host: 5433' --- | |
# should go on 'Vagrantfile' and then you use port 5433 to connect through pgadmin3 | |
echo >&2 "===CUSTOM-MSG=== Setup THE DATABASE" | |
# installs postgresql database and creates "vagrant" superuser with password "somepass". | |
sudo apt-get -y install postgresql postgresql-client libpq-dev | |
echo >&2 "===CUSTOM-MSG=== Create role and login" | |
sudo su postgres -c "psql -c \"CREATE ROLE vagrant SUPERUSER LOGIN PASSWORD 'somepass'\" " | |
# create database 'mynewdb' for role (superuser) vagrant | |
echo >&2 "===CUSTOM-MSG=== Create db" | |
sudo su postgres -c "createdb -E UTF8 -T template0 --locale=en_US.utf8 -O vagrant mynewdb" | |
# enable the db to listen from the host through tcp | |
sudo su postgres -c "printf \"\n\n# === CUSTOM VAGRANT SETTINGS === \n \" >> /etc/postgresql/*/main/postgresql.conf" | |
sudo su postgres -c "echo \" listen_addresses = '*' \" >> /etc/postgresql/*/main/postgresql.conf" | |
sudo su postgres -c "printf \"\n\n# === CUSTOM VAGRANT SETTINGS === \n \" >> /etc/postgresql/*/main/pg_hba.conf" | |
sudo su postgres -c "echo \" host all all 10.0.2.2/24 md5 \" >> /etc/postgresql/*/main/pg_hba.conf" | |
#restart | |
sudo /etc/init.d/postgresql restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey so when you put connection parameters in pgadmin what format are you setting those this?