Skip to content

Instantly share code, notes, and snippets.

@kazutan kazutan/Vagrantfile
Last active Mar 3, 2016

Embed
What would you like to do?
RStudio Serverまで持ってくるVagrantfile。
Vagrant.configure(2) do |config|
# 通常はこちらを使って下さい
config.vm.box = "ubuntu/trusty64"
# この記事の上の方で登録したboxを利用するため"ubuntu1404"としています
# config.vm.box = "ubuntu1404"
# 共有ディレクトリ設定(コメントアウトしてます)
# config.vm.synced_folder "../data", "/vagrant_data"
# ポートフォワーディング設定
config.vm.network "forwarded_port", guest: 8787, host: 1111
#仮想マシンのメモリ設定
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
# 以下プロビジョニング用スクリプト
$script = <<SCRIPT
echo "deb https://cran.rstudio.com/bin/linux/ubuntu trusty/" > /etc/apt/sources.list.d/cran.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E084DAB9
sudo apt-get update
sudo apt-get install -y r-base r-base-dev
## for install devtools, rvest(libxml2)
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev
## r-packages install
sudo R -e "install.packages('devtools', repos = 'https://cran.rstudio.com/', dep = TRUE)"
sudo R -e "install.packages('ggplot2', repos = 'https://cran.rstudio.com/', dep = TRUE)"
sudo R -e "install.packages('dplyr', repos = 'https://cran.rstudio.com/', dep = TRUE)"
sudo R -e "install.packages('tidyr', repos = 'https://cran.rstudio.com/', dep = TRUE)"
sudo R -e "install.packages('stringr', repos = 'https://cran.rstudio.com/', dep = TRUE)"
sudo R -e "install.packages('rvest', repos = 'https://cran.rstudio.com/', dep = TRUE)"
sudo R -e "install.packages('rmarkdown', repos = 'https://cran.rstudio.com/', dep = TRUE)"
## rstudio-server install
wget https://s3.amazonaws.com/rstudio-dailybuilds/rstudio-server-0.99.891-amd64.deb
sudo dpkg -i *.deb
sudo apt-get -f install rstudio-server
rm *.deb
SCRIPT
# スクリプト実行
config.vm.provision "shell", inline: $script
end
@kazutan

This comment has been minimized.

Copy link
Owner Author

commented Feb 4, 2016

ひとまずRのインストールとRStudioServerのインストールまで。

@kazutan

This comment has been minimized.

Copy link
Owner Author

commented Feb 6, 2016

事前によく使うパッケージを自動でインストールするように。あとshellの書き方を変更。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.