Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
02-install-r-cran-openblas
# 1: Add RStudio to apt sources
# key added after sudo apt-get update returned a warning following this guide: https://support.rstudio.com/hc/en-us/articles/218004217-Building-R-from-source
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
printf '#CRAN mirror\ndeb https://cran.rstudio.com/bin/linux/ubuntu artful/\ndeb-src https://cran.rstudio.com/bin/linux/ubuntu artful/\n' | sudo tee -a /etc/apt/sources.list.d/cran-mirror.list
# 2: Enable development repositories
# you need to enable multiverse repo or packages as xvfb won't be found
printf 'deb http://us.archive.ubuntu.com/ubuntu artful main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu artful main restricted universe multiverse\n
deb http://security.ubuntu.com/ubuntu artful-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu artful-security main restricted universe multiverse\n
deb http://us.archive.ubuntu.com/ubuntu artful-updates main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu artful-updates main restricted universe multiverse\n' | sudo tee -a /etc/apt/sources.list
# 3: Update packages
sudo apt-get update
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove
sudo apt-get upgrade --with-new-pkgs
# 4: Build R from source
sudo apt-get build-dep r-base libopenblas-base
cd ~/GitHub/r-with-intel-mkl/
wget https://cran.r-project.org/src/base/R-3/R-3.4.2.tar.gz
tar xzvf R-3.4.2.tar.gz
cd R-3.4.2
./configure --prefix=/opt/R/R-3.4.2-openblas --enable-R-shlib --with-blas --with-lapack
make && sudo make install
printf 'export RSTUDIO_WHICH_R=/opt/R/R-3.4.2-openblas/bin/R\n' | tee -a ~/.profile
sudo ln -s /opt/R/3.4.2-openblas/bin/R /usr/local/bin/R
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.