Skip to content

Instantly share code, notes, and snippets.

@richfitz
Forked from mondus/R on Bede
Last active July 21, 2020 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richfitz/2853ede5450996d5259ed267f48e90dd to your computer and use it in GitHub Desktop.
Save richfitz/2853ede5450996d5259ed267f48e90dd to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script for installing R 3.6.3 on Bede
#
# The require dependancies are
# * bzip2
# * curl
# |-> openssl
# * pcre
# * xz
# * R
#
# Most can be installed easily. There is a conflict with openssl which is already installed by anaconda so LD_LIBRARY_PATH can be explicitly set.
set -ex
# Some common stuff
LOCAL_INSTALL_DIR=~/local_install
DOWNLOAD_DIR=~/r_deps_downloads
mkdir -p $DOWNLOAD_DIR
cd $DOWNLOAD_DIR
# Bzip2
cd $DOWNLOAD_DIR
wget https://www.sourceware.org/pub/bzip2/bzip2-latest.tar.gz
tar -xzvf bzip2-latest.tar.gz
cd $(find . -name 'bzip*' -type d)
make
make install PREFIX=$LOCAL_INSTALL_DIR
# pcre
cd $DOWNLOAD_DIR
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar -xzvf pcre-8.43.tar.gz
cd $(find . -name 'pcre*' -type d)
./configure --prefix=$LOCAL_INSTALL_DIR --enable-utf8
make
make install
# xz
cd $DOWNLOAD_DIR
wget https://tukaani.org/xz/xz-5.2.5.tar.gz
tar -xzvf xz-5.2.5.tar.gz
cd $(find . -name 'xz*' -type d)
./configure --prefix=$LOCAL_INSTALL_DIR
make
make install
# OpenSSL (required for CURL)
cd $DOWNLOAD_DIR
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
tar -xzvf openssl-1.1.1g.tar.gz
cd $(find . -name 'openssl*' -type d)
./config --prefix=$LOCAL_INSTALL_DIR --openssldir=$LOCAL_INSTALL_DIR
make
make install
# CURL (requires local installation of openssl
cd $DOWNLOAD_DIR
wget https://curl.haxx.se/download/curl-7.71.1.tar.gz
tar -xzvf curl-7.71.1.tar.gz
cd $(find . -name 'curl*' -type d)
./configure --prefix=$LOCAL_INSTALL_DIR --with-ssl CPPFLAGS="-I$LOCAL_INSTALL_DIR/include" LDFLAGS="-L$LOCAL_INSTALL_DIR/lib" LD_LIBRARY_PATH=$LOCAL_INSTALL_DIR/lib
make LD_LIBRARY_PATH=$LOCAL_INSTALL_DIR/lib
make install
# Finally install R
R_VERSION=3.6.3
cd $DOWNLOAD_DIR
curl -O https://cran.rstudio.com/src/base/R-3/R-${R_VERSION}.tar.gz
tar -xzvf R-${R_VERSION}.tar.gz
cd R-${R_VERSION}
./configure --prefix=$LOCAL_INSTALL_DIR --with-readline=no --with-x=no --disable-java CPPFLAGS="-I$LOCAL_INSTALL_DIR/include" LDFLAGS="-L$LOCAL_INSTALL_DIR/lib" LD_LIBRARY_PATH=$LOCAL_INSTALL_DIR/lib
make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment