Skip to content

Instantly share code, notes, and snippets.

@kou029w
Last active February 21, 2018 03:50
Show Gist options
  • Save kou029w/4c6005fda2525ec189b3505369259def to your computer and use it in GitHub Desktop.
Save kou029w/4c6005fda2525ec189b3505369259def to your computer and use it in GitHub Desktop.
rails on centos, vagrant
Vagrant.configure('2') do |config|
config.vm.box = 'centos/7'
config.vm.network 'forwarded_port', guest: 3000, host: 3000
config.vm.provision 'shell', privileged: false, inline: <<~'SCRIPT'
# anyenv のインストール
sudo yum install -y git
git clone https://github.com/riywo/anyenv ~/.anyenv
echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(anyenv init -)"' >> ~/.bash_profile
SCRIPT
config.vm.provision 'shell', privileged: false, inline: <<~'SCRIPT'
# rbenv のインストール
anyenv install rbenv
# ndenv のインストール
anyenv install ndenv
SCRIPT
config.vm.provision 'shell', privileged: false, inline: <<~'SCRIPT'
# Ruby 2.5.0 のインストール
sudo yum install -y gcc openssl-devel readline-devel
rbenv install 2.5.0
rbenv global 2.5.0
# Node.js 8.9.4 のインストール
ndenv install 8.9.4
ndenv rehash
# Rails 5.1 のインストール
sudo yum install -y libffi-devel sqlite sqlite-devel
gem install rails -v "~> 5.1.0"
# サンプル
rails new sample-app
cd sample-app
bin/bundle ins --path vendor/bundle
SCRIPT
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment