# 安装依赖
$ sudo apt-get install xorg-dev libreadline-dev
$ sudo apt-get install libcurl4-openssl-dev
$ sudo apt-get install libbz2-dev
$ sudo apt-get install libcairo2-dev libgtk2.0-dev
$ sudo apt-get install texinfo texlive
$ wget http://mirrors.ctan.org/fonts/inconsolata.zip
$ sudo cp -Rfp inconsolata/* /usr/share/texmf/
$ # 或者 sudo cp -r inconsolata/ /usr/share/texlive/texmf-dist/tex/latex/
$ sudo mktexlsr # 刷新
# 如果没有java解释器,安装下
$ sudo apt-get install default-jdk
# 下载与安装R
$ curl -O http://cran.utstat.utoronto.ca/src/base/R-3/R-3.5.0.tar.gz
$ tar -zxvf R-3.5.0.tar.gz
$ cd R-3.5.0/
$ ./configure --prefix=$HOME/local/R --enable-R-shlib --with-cairo=yes
$ # ./configure --with-cairo --with-libpng --with-libtiff --with-jpeglib --enable-R-shlib --prefix=$HOME/local/R
$ make
$ make install
# 创建符号链接
$ cd /usr/bin/
$ sudo ln -s $HOME/local/R/bin/Rscript Rscript
$ sudo ln -s $HOME/local/R/bin/R R
# 检查
$ ls -l R*
lrwxrwxrwx 1 root root 23 6月 28 17:01 R -> /home/wsx/local/R/bin/R
lrwxrwxrwx 1 root root 29 6月 28 17:01 Rscript -> /home/wsx/local/R/bin/Rscript
# 使用
$ R
R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
遇到编译问题和报错,可以参考下面两篇博文:
自定义修改提示符,比如在.Rprofile
中添加:
options(prompt="ℝ> ")