Created
April 22, 2021 00:39
-
-
Save exaucae/70a1b102cc26406c61cbbf45f524ad46 to your computer and use it in GitHub Desktop.
PostgreSQL vagrant file
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
#!/usr/bin/sh | |
sudo apt-get update | |
echo "-------------------- installing postgres" | |
sudo apt-get install -y postgresql | |
sudo mkdir -p /usr/local/pgsql/data | |
sudo chown postgres:postgres /usr/local/pgsql/data | |
echo "-------------------- creating postgres admin role with password p@ss0ver" | |
sudo su postgres -c "psql -c \"CREATE ROLE admin SUPERUSER LOGIN PASSWORD 'p@ss0ver'\" " | |
echo "-------------------- creating your_db database" | |
sudo su postgres -c "createdb -E UTF8 -T template0 --locale=en_US.utf8 -O admin your_db" | |
# gotta put this at the end because it reboots and then all commands are lost | |
sudo apt-get upgrade -y | |
echo "-------------------- installation successful!" | |
# ref: http://tutorials.jumpstartlab.com/topics/vagrant_setup.html | |
# ref: https://gist.github.com/davisford/8000332 |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "generic/debian10" | |
config.vm.box_version = "3.2.2" | |
config.vm.box_url = "https://app.vagrantup.com/generic/boxes/debian10" | |
config.vm.network "forwarded_port", guest: 5433, host: 5433, host_ip: "127.0.0.1" | |
config.vm.network "forwarded_port", guest: 5432, host: 5434, host_ip: "127.0.0.1" | |
config.vm.provider "virtualbox" do |vb| | |
vb.gui = true | |
vb.name = "postgres-vm" | |
vb.cpus = 2 | |
vb.memory = "1024" | |
end | |
config.vm.provision "shell", privileged: false, path: "bootstrap.sh" | |
end | |
# ref: http://tutorials.jumpstartlab.com/topics/vagrant_setup.html | |
# ref: https://gist.github.com/davisford/8000332 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment