Skip to content

Instantly share code, notes, and snippets.

@mondus
Last active July 21, 2020 13:45
Show Gist options
  • Save mondus/b7b263b9369a0df6bb43fdcba0a114fe to your computer and use it in GitHub Desktop.
Save mondus/b7b263b9369a0df6bb43fdcba0a114fe 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.
# Some common stuff
LOCAL_INSTALL_DIR=~/local_install
DOWNLOAD_DIR=~/r_deps_downloads
mkdir $DOWNLOAD_DIR
cd $DOWNLOAD_DIR
# Bzip2
cd $DOWNLOAD_DIR
mkdir bzip2
wget https://www.sourceware.org/pub/bzip2/bzip2-latest.tar.gz
tar -xzvf bzip2-latest.tar.gz
cd bzip*
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 pcre*
./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 xz*
./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 openssl*
./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 curl*
./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