Skip to content

Instantly share code, notes, and snippets.

@patperu
Created August 12, 2019 13:59
Show Gist options
  • Save patperu/23b9a6237503f30d037cf173e14b2d10 to your computer and use it in GitHub Desktop.
Save patperu/23b9a6237503f30d037cf173e14b2d10 to your computer and use it in GitHub Desktop.
Upgrade R
#!/bin/bash
# Remove existing R installation.
#
sudo apt-get purge -y r-base-core
# Add keys.
#
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
#
# If you're behind a firewall you can try something like this:
#
# gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-key E084DAB9
# gpg -a --export E084DAB9 | sudo apt-key add --
# Add CRAN repository.
#
OSNAME=$(. /etc/os-release; echo "$ID")
OSVERS=$(lsb_release -cs)
sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/$OSNAME $OSVERS-cran35/"
# Update the package list.
#
sudo apt-get -y update
# Install new R.
#
sudo apt-get -y install r-base
# Install some other things that are required for building various R packages.
#
sudo apt-get -y install \
htop \
libcurl4-openssl-dev \
libssl-dev \
libgeos-dev \
libgdal-dev \
libproj-dev \
libxml2-dev \
libudunits2-dev \
libsodium-dev \
pandoc \
openjdk-8-jdk \
openjdk-8-jre \
cargo \
libcairo2-dev \
libfreetype6-dev \
libclang-dev
# Where does R expect to find Java?
#
sudo R CMD javareconf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment