LoginSignup
0
0

More than 5 years have passed since last update.

Vagrantfile of ruby environment for ubuntu 14.04

Posted at

自分の備忘録

Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "phusion/ubuntu-14.04-amd64"
  config.vm.network :private_network, ip:"192.168.33.10"

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
  end

  config.vm.provision :shell, path: "bootstrap.sh", privileged: false
end
bootstrap.sh
#!/bin/sh

# set interactive environmental-valiables
PS1='$ '
source ~/.bashrc

sudo ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtimesudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
sudo update-alternatives --set editor $(update-alternatives --list editor | grep 'vim.basic')
sudo sed -i'~' -E "s@http://(..\.)?(archive|security)\.ubuntu\.com/ubuntu@http://ftp.jaist.ac.jp/pub/Linux/ubuntu@g" /etc/apt/sources.list

# install
sudo apt-get -y update
sudo apt-get -y install software-properties-common
sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
sudo add-apt-repository -y ppa:git-core/ppa
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -

sudo apt-get -y update
sudo apt-get -y install g++ expect git nodejs libssl-dev libpq-dev samba libreadline-dev libsqlite3-dev npm postgresql-9.3 postgresql-contrib ruby-dev libxslt-dev libxml2-dev nkf imagemagick libmagickcore-dev libmagickwand-dev unzip language-pack-ja wget curl zip unzip git heroku
wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh

# for rbenv
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc

# rbenv setting
rbenv install 2.2.3
rbenv global 2.2.3
rbenv rehash

# bundler
gem install bundler
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0