Skip to content

Instantly share code, notes, and snippets.

@theDisco
Created April 2, 2012 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theDisco/2286118 to your computer and use it in GitHub Desktop.
Save theDisco/2286118 to your computer and use it in GitHub Desktop.
Setting up rails in vagrant
#!/bin/bash
sudo apt-get install build-essential zlib1g-dev git-core vim curl mysql-server libmysql-ruby libmysqlclient-dev subversion
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> .bash_profile
source .bash_profile
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build/
sudo ./install.sh
rbenv install 1.9.2-p290
rbenv rehash
rbenv global 1.9.2-p290
cd /vagrant
gem install bundler
rbenv rehash
read -p "Mysql Username: " username;
read -p "Mysql Password: " password;
read -p "New DB Username: " dbusername;
read -p "New DB Password: " dbpassword;
mysql --user=$username --password=$password --execute="CREATE USER '$dbusername'@'localhost' IDENTIFIED BY '$dbpassword';"
mysql --user=$username --password=$password --execute="CREATE DATABASE bt_development;"
mysql --user=$username --password=$password --execute="CREATE DATABASE bt_test;"
mysql --user=$username --password=$password --execute="GRANT ALL ON bt_development.* TO '$dbusername'@'localhost';"
mysql --user=$username --password=$password --execute="GRANT ALL ON bt_test.* TO '$dbusername'@'localhost';"
mysql --user=$username --password=$password --execute="FLUSH PRIVILEGES;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment