Ubuntu 16.04(Xenial)が4/21にリリースされましたが、DigitalOceanでさっそく使えるようになっていたので、ひとまずRとかRStudio Serverをインストールしてみたときのメモ。
結論から言うと、軽く触った感じ何の問題もなく動いてそうでした。
Rをインストール
RにはすでにXenial用のレポジトリが用意されています。それを追加するだけです。(細かい悩みですが、そろそろaptコマンドを使う頃なのか、まだapt-getなのか、どっちでしょう…)
$ sudo apt-add-repository 'deb https://cran.rstudio.com/bin/linux/ubuntu/ xenial/' $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 $ sudo apt update $ sudo apt install r-base
なんかこんなWarningが出ていました。SHA1のGPGキーは脆弱だとみなされるようになっているみたいです。更新する予定あるのかな?
Reading state information... Done All packages are up to date. W: https://cran.rstudio.com/bin/linux/ubuntu/xenial/Release.gpg: Signature by key E298A3A825C0 D65DFD57CBB651716619E084DAB9 uses weak digest algorithm (SHA1)
RStudioをインストール
ここも公式のインストラクションに従います。サクッとインストールされました。
$ sudo apt install gdebi-core
$ wget https://download2.rstudio.org/rstudio-server-0.99.896-amd64.deb
$ sudo gdebi rstudio-server-0.99.896-amd64.deb
ちゃんとsystemdで動いてますね。
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done
RStudio Server
RStudio is a set of integrated tools designed to help you be more productive with R. It includes a console, syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, and workspace management.
Do you want to install the software package? [y/N]:y
Selecting previously unselected package rstudio-server.
(Reading database ... 67772 files and directories currently installed.)
Preparing to unpack rstudio-server-0.99.896-amd64.deb ...
Unpacking rstudio-server (0.99.896) ...
Setting up rstudio-server (0.99.896) ...
groupadd: group 'rstudio-server' already exists
rsession: no process found
Created symlink from /etc/systemd/system/multi-user.target.wants/rstudio-server.service to /etc/systemd/system/rstudio-server.service.
● rstudio-server.service - RStudio Server
Loaded: loaded (/etc/systemd/system/rstudio-server.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2016-04-27 08:33:31 EDT; 1s ago
Process: 26533 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
Main PID: 26535 (rserver)
Tasks: 3 (limit: 512)
Memory: 884.0K
CPU: 994ms
CGroup: /system.slice/rstudio-server.service
└─26535 /usr/lib/rstudio-server/bin/rserver
Apr 27 08:33:31 ubuntu-2gb-sgp1-01 systemd[1]: Starting RStudio Server...
Apr 27 08:33:31 ubuntu-2gb-sgp1-01 systemd[1]: Started RStudio Server.
littlerをインストール
ここは好みですが、Dirkの便利ツール、littlerをインストールします。
$ sudo apt install r-cran-littler
/usr/lib/R/site-library/littler/examplesにパッケージインストール用の便利スクリプトがあるのでこれを使います。
$ sudo /usr/lib/R/site-library/littler/examples/install.r docopt
が、なんかエラーが出ます。レポジトリを設定してないよ、と。
Error in contrib.url(repos, type) : trying to use CRAN without setting a mirror
~/.Rprofileにレポジトリの設定を入れてもう一度やってみるとうまくいきました。
$ echo 'options(repos = c(CRAN = "https://cran.rstudio.com"))' > ~/.Rprofile
もろもろパッケージをインストール
littlerを使ってパッケージインストールしまくります。依存パッケージをちゃんとインストールすれば、問題なくインストールできました。まだあんまり動かしてないので、動作させるとおかしいとかあるかもしれませんけど。
$ sudo apt install \
libcurl4-openssl-dev \
libssh2-1-dev \
libgeos-dev \
libxml2-dev \
libgdal-dev \
libv8-dev \
libprotobuf-dev \
protobuf-compiler \
libproj-dev
$ sudo /usr/lib/R/site-library/littler/examples/install2.r \
dplyr \
ggplot2 \
tidyr \
purrr \
stringr \
devtools \
testthat \
lubridate \
httr \
rvest \
readr \
xml2 \
svglite \
broom \
curl \
jsonlite \
protolite \
V8 \
openssl \
gridExtra \
sp \
rgeos \
rgdal \
ggrepel \
ggfortify \
gridExtra \
roexygen2 \
rmarkdown \
htmlwidgets \
leaflet \
DiagrammeR \
rstudioaddin \
knitr