Skip to content

Instantly share code, notes, and snippets.

@abh1nav
Last active December 29, 2015 21:19
Show Gist options
  • Save abh1nav/7729797 to your computer and use it in GitHub Desktop.
Save abh1nav/7729797 to your computer and use it in GitHub Desktop.
Setup script for DVTO4
#!/bin/sh
#
# Base dependencies
sudo apt-get update -y
sudo apt-get install -y curl postgresql libpq-dev postgresql-server-dev-all build-essential
# Setup .gemrc to skip rdoc and ri installation
echo "install: --no-rdoc --no-ri" >> $HOME/.gemrc
echo "update: --no-rdoc --no-ri" >> $HOME/.gemrc
# Install RVM, Ruby and Rails
curl -L https://get.rvm.io | bash
source $HOME/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install rails –no-ri –no-rdoc
# Bundle install
cd /vagrant
bundle install
# Tell Postgres to listen on all interfaces
echo "listen_addresses = 'localhost'" | sudo tee -a /etc/postgresql/9.1/main/postgresql.conf
echo "host all all 0.0.0.0/0 md5" | sudo tee -a /etc/postgresql/9.1/main/pg_hba.conf
sudo service postgresql restart
# Setup the catsanddogs_development user
sudo -u postgres psql postgres -c "alter user postgres with password 'dvto4'"
sudo -u postgres psql postgres -c "create database catsanddogs_development"
sudo -u postgres psql postgres -c "grant all privileges on database catsanddogs_development to postgres"
# rake db setup
cd /vagrant
rake db:migrate RAILS_ENV=development
# done
echo ""
echo "----"
echo "Please restart your shell"
echo "!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment