Skip to content

Instantly share code, notes, and snippets.

@tmknom
Created December 31, 2015 07:38
Show Gist options
  • Save tmknom/05c92bb522337d9942bf to your computer and use it in GitHub Desktop.
Save tmknom/05c92bb522337d9942bf to your computer and use it in GitHub Desktop.
Rails環境を一発で立ち上げるVagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-6.7"
config.vm.hostname = 'rails-vagrant'
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.provision :shell, inline: <<-EOT
# 各種モジュールのインストール
yum install -y epel-release
yum update -y
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
yum install -y git
yum install -y sqlite-devel
yum install -y nodejs
# rbenv + ruby-build
git clone https://github.com/rbenv/rbenv.git /opt/rbenv
git clone https://github.com/rbenv/ruby-build.git /opt/rbenv/plugins/ruby-build
echo 'export RBENV_ROOT="/opt/rbenv"' >> /etc/profile.d/rbenv.sh
echo 'export PATH="/opt/rbenv/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
# ruby
rbenv install 2.3.0
rbenv global 2.3.0
# rails
gem update --system --no-document
gem update --no-document
gem install bundler rails --no-document
EOT
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment