Last active
December 13, 2015 14:47
-
-
Save amandasantanati/92a2a4475efa553abcae to your computer and use it in GitHub Desktop.
Shortcuts to install and set up Vagrant to Rails development
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
# install virtualbox | |
# install vagrant | |
# install VirtualBox GuestTools: VBoxLinuxAdditions.run | |
# entering project folder | |
cd project_folder | |
# creating Vagrantfile | |
vagrant init | |
# setting up Vagrantfile (see Vagrantfile gist) | |
nano Vagrantfile | |
# running VM and logging in | |
vagrant up --provider virtualbox | |
vagrant ssh | |
# updating SO | |
sudo apt-get update | |
# installing ruby dependencies | |
sudo apt-get install git-core curl zlib1g-dev build-essential | |
sudo apt-get install libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 | |
sudo apt-get install libxml2-dev libxslt1-dev libcurl4-openssl-dev | |
sudo apt-get install python-software-properties libffi-dev | |
# installing rbenv | |
cd | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
source ~/.bashrc | |
# installing ruby | |
rbenv install -v 2.2.3 | |
rbenv global 2.2.3 | |
# turning off gem documentation's download | |
echo "gem: --no-ri --no-rdoc" > ~/.gemrc | |
# installing postgres, creating a sudo postgres user and setting up its password | |
sudo apt-get install postgresql postgresql-contrib libpq-dev | |
sudo -u postgres createuser -s sudo_postgres_username | |
sudo -u postgres psql | |
postgres=# \password sudo_postgres_username | |
postgres=# \q | |
# installing nodejs | |
sudo add-apt-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install nodejs | |
# installing bundler and rails | |
gem install bundler | |
gem install rails | |
# installing imagemagick and rmagick if needed | |
sudo apt-get install imagemagick | |
sudo apt-get install libmagickwand-dev # if there's a error with magick-config | |
gem install rmagick | |
# accessing shared project folder and running a bundle install | |
cd /vagrant | |
bundle install | |
# running rails project at localhost:3000 | |
rails s -b 0.0.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment