Skip to content

Instantly share code, notes, and snippets.

@cboettig
Created April 1, 2024 02:42
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 cboettig/68c9eb9b30daa822b95d89d4fb83500e to your computer and use it in GitHub Desktop.
Save cboettig/68c9eb9b30daa822b95d89d4fb83500e to your computer and use it in GitHub Desktop.
gurobi-setup.sh
# Be sure to put a copy of the license file in "$HOME/gurobi.lic" for this to work!!
# Download the release
wget https://packages.gurobi.com/11.0/gurobi11.0.1_linux64.tar.gz # or path to most recent linux_64 download from https://www.gurobi.com/downloads/gurobi-software/
# extract:
tar -xvf gurobi*_linux64.tar.gz
# Set environmental variables
# (put these .in ~/.bashrc as well for cli bash use)
export GUROBI_HOME="${HOME}/gurobi1101/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
export GRB_LICENSE_FILE="${HOME}/gurobi.lic"
# Echo them into ~/.Renviron for R user
echo 'GUROBI_HOME="${HOME}/gurobi1101/linux64"' >> ~/.Renviron
echo 'PATH="${PATH}:${GUROBI_HOME}/bin"' >> ~/.Renviron
echo 'LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"' >> ~/.Renviron
echo 'GRB_LICENSE_FILE="${HOME}/gurobi.lic"' >> ~/.Renviron
# Inside RStudio, we must also set `rsession-ld-library-path`
# echo 'rsession-ld-library-path="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"' >> /etc/rstudio/rserver.conf
# install R packages
install2.r slam
R CMD INSTALL gurobi1101/linux64/R/gurobi_*.tar.gz
# We should be good to go, but will have to run R from the 'terminal' tab to bypass the stupid thing with rsession-ld-library-path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment