Skip to content

Instantly share code, notes, and snippets.

@vikranth22446
Last active December 5, 2019 23:00
Show Gist options
  • Save vikranth22446/8cd039199372f51dc5b1069576b2e7d2 to your computer and use it in GitHub Desktop.
Save vikranth22446/8cd039199372f51dc5b1069576b2e7d2 to your computer and use it in GitHub Desktop.
Gurobi installation on server with non academic domain for academic purposes
# Gurobi installation on server with non academic domain for academic purposes
# Used for cs170 project
# Run on Ubuntu 19.10
sudo apt-get update
sudo apt-get install python3 python3-pip virtualenv
wget https://packages.gurobi.com/9.0/gurobi9.0.0_linux64.tar.gz
tar xzvf gurobi9.0.0_linux64.tar.gz
# now run part 2
# get key at https://www.gurobi.com/downloads/end-user-license-agreement-academic/
# get key at https://www.gurobi.com/downloads/end-user-license-agreement-academic/
echo 'export GUROBI_HOME="/home/$(whoami)/gurobi900/linux64"' >> ".bashrc"
echo 'export PATH="${PATH}:${GUROBI_HOME}/bin"' >> ".bashrc"
echo 'export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"' >> ".bashrc"
echo 'export GRB_LICENSE_FILE="/home/$(whoami)/gurobi.lic"' >> ".bashrc"
source ".bashrc"
python3 parse_grb_probe.py <insert key here>
# get key at https://www.gurobi.com/downloads/end-user-license-agreement-academic/
import os
from datetime import date
import sys
import subprocess
p = subprocess.Popen(
['grbprobe'],
stdout=subprocess.PIPE
)
keys = {}
for line in p.stdout.readlines()[1:]:
res = line.decode('utf-8').strip().split("=")
keys[res[0]] = res[1]
key = "<insert key>"
if len(sys.argv) >= 2:
key = sys.argv[1]
url = "https://apps.gurobi.com/keyserver?id={key}&hostname={hostname}&hostid={hostid}&username={username}&os={os}&sockets=1&cpu={cpu}&localdate={today}&version=9".format(hostname=keys["HOSTNAME"], hostid=keys["HOSTID"], username=keys["USERNAME"], os=keys["PLATFORM"], cpu=keys["CPU"], today=date.today(),key=key)
print(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment