0

I am currently working on a project which involves linear programming to optimise a solution to a problem (The linear programming model involves binary variables). As such i have been refered to used Gurobi to tackle this issue. Gurobi works fine on my computer, however i require to deploy the application i develop on a deployment platform such as Openshift. As gurobi's environment is required to be installed on the deployment platform for me to run my model i need guidance on how to do this, has anyone who have ever installed an environment on to openshift would greatly appreciate some assistance!

Else, if anyone has a easier and free implementation of a linear programming library for Java please do drop me a message here too! Thanks in advance!

  • What have you tried so far? What errors did you get or issues did you encounter? –  Feb 24 '15 at 15:56
  • Hey corey, as of now i've tried SSH into my application and installing Gurobi through the Commandline. However, i realised everytime i close the SSH connection the PATHing and environment i create resets itself, furthermore i am unable to add any extra files into folders such as OPT which is recommended of by Gurobi to where i should place it (Due to permission settings) @corey112358 – Brandon Seet Feb 24 '15 at 17:19
  • http://www.gurobi.com/documentation/6.0/linux-quick-start-guide/software_installation_guid this is the guide im following to install the environment on my application @corey112358 – Brandon Seet Feb 24 '15 at 17:22
  • You should be able to install gurobi locally, that is inside your "HOME" directory, even if you do not have a root access to the server (you cannot write in "/opt"); you just need to change "GUROBI_HOME" to e.g. "~/gurobi" instead of "/opt/gurobi600/linux". "everytime I close the SSH connection the PATHing and environment resets": this is _very_ weird. Are you actually copying the lines "export "GUROBI_HOME=...", etc in your "~/.bashrc" file? It won't work if you just type those in the command line. – Nicolas Grebille Feb 25 '15 at 03:12
  • @NicolasGrebille ohh yes that's typing in those command in the command line is what i am doing, sorry i am new to this. What should i be doing? – Brandon Seet Feb 25 '15 at 05:00
  • Too long for a comment, but see my answer below – Nicolas Grebille Feb 25 '15 at 06:03
  • @corey112358 i've tried to install and change edit some paths as per below, however, i'm still unable to get my application to initialise the GRBENV object which is the environment – Brandon Seet Feb 25 '15 at 13:30
  • @corey112358 as of now i've managed to change my licensing and add the suitable pathing for the non-default stuff such as GUROBI_HOME & GUROBI_LICENSE_KEY however i nneed to change the standard stuff such as PATH & LD_LIBRARY_PATH which i think Openshift automatically rewrites when i run the shell is it possible to change these two paths? – Brandon Seet Feb 25 '15 at 13:32
  • I've SSHed into my openshift application and have added in the export codes into the bash_profile in app-root/data export GUROBI_HOME="/var/lib/openshift/54d4e281e0b8cd3a1400015c/jbossews/gurobi600/linux64" export PATH="${PATH}:${GUROBI_HOME}/bin" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib" export GRB_LICENSE_FILE=="/var/lib/openshift/54d4e281e0b8cd3a1400015c/jbossews/gurobi.lic" – Brandon Seet Feb 25 '15 at 13:33

1 Answers1

1

I assume that your shell is bash on the server (echo $SHELL should return /bin/bash, you can check if you are unsure). You need to:

  1. Copy the archive gurobi6.0.0_linux64.tar.gz to your home directory and extract it:

     tar xvfz gurobi6.0.0_linux64.tar.gz`)
    

    This should create a subdirectory gurobi600_linux in your home directory.

  2. Check whether your LD_LIBRARY_PATH variable is set: type in a shell

     echo $LD_LIBRARY_PATH
    

    If it displays nothing (a blank line), then the variable is unset.

  3. Open (or create if it does not exist) the .bashrc file in your home directory with a text editor, and append the lines:

    export GUROBI_HOME="~/gurobi600/linux64"
    export PATH="${PATH}:${GUROBI_HOME}/bin"
    export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
    

    If your LD_LIBRARY_PATH was unset, replace the last line by:

    export LD_LIBRARY_PATH="${GUROBI_HOME}/lib"
    
  4. Type source ~/.bashrc to reload your environment (or just log out and log in again).

Then, setup your license and hopefully everything should be working fine!

Nicolas Grebille
  • 1,332
  • 8
  • 15
  • Thanks for the assistance and answer! However, i'm unable to copy the .gz to the home directory Openshift does not allow me to copy any folder onto it, the next place i can copy files into would be my jbossews folder in my home director will that work too ? – Brandon Seet Feb 25 '15 at 06:50
  • I guess I need to clarify something here: assuming your username is `jbossews`, your home directory _is_ `/home/jbossews`. `/home` is a system directory that contains all the users' "home" directories, you are not supposed to copy anything directly in it. Regarding your question, you can put gurobi anywhere as long as you have sufficient permissions; you just need to modify `GUROBI_HOME` accordingly (the `~` in the path in my answer stands for your home directory, that is `/home/jbossews` if I understood correctly). – Nicolas Grebille Feb 25 '15 at 08:27
  • [http://tinypic.com/r/3583pk6/8] my home director looks like the link i've attached. i cant seem to find the .bashrc file, if i have to create it do i just have to copy the export text you shown above into the command prompt write file portion as per the picture in the link below? {http://tinypic.com/view.php?pic=2agn8yq&s=8#.VO2SIfmUfT8] – Brandon Seet Feb 25 '15 at 09:14
  • Yes, provided that you extracted the archive in `/var/lib/openshift/.../jbossnews` and that your `LD_LIBRARY_PATH` was not empty beforehand. – Nicolas Grebille Feb 25 '15 at 09:30
  • Run `source ~/.bashrc` before logging out, so you can rename the file if something goes wrong. – Nicolas Grebille Feb 25 '15 at 09:36
  • If you can, I would strongly suggest that you ask help to someone in your company (or university) who has a basic knowledge of how a linux system works to deploy your project, though. – Nicolas Grebille Feb 25 '15 at 09:38
  • `[schedulemyinterview-is480.rhcloud.com 54d4e281e0b8cd3a1400015c]\> echo $LD_LIBRARY_PATH /opt/rh/mysql55/root/usr/lib64:` this is what is shown to me on initial ssh to my application and i was googling online about this .bashrc thing for openshift apparently it's provided in another area - https://forums.openshift.com/having-my-own-rc-run-command-file-executed-on-shell-login |||| which tells me that i should look into my app-root/data/.bash_profile directory to make changes to the initial do you think i should add the exports there instead? – Brandon Seet Feb 25 '15 at 09:42
  • Yes, apparently you need to add the lines to `~/app-root/data/.bash_profile` instead of `~/.bashrc` (it should be a file and not a directory though, see https://help.openshift.com/hc/en-us/articles/202399280). Of course you can also put it in any file and source it by typing `source ` everytime you log in if this does not work. – Nicolas Grebille Feb 25 '15 at 09:48
  • I tried adding the export lines into the .bash_profile file however i still cannot run Gurobi commands still, i echoed all the paths required and it seems like the paths are not registering `echo $GUROBI_HOME /var/lib/openshift/54d4e281e0b8cd3a1400015c/jbossews/gurobi600/linux64 echo $PATH /etc/alternatives/java_sdk_1.7.0/bin:/etc/alternatives/maven-3.0/bin:/bin:/usr/bin:/usr/sbin echo $LD_LIBRARY_PATH /opt/rh/mysql55/root/usr/lib64: ` – Brandon Seet Feb 25 '15 at 09:59
  • `export GUROBI_HOME="/var/lib/openshift/54d4e281e0b8cd3a1400015c/jbossews/gurobi600/linux64" export PATH="${PATH}:${GUROBI_HOME}/bin" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"` These are the values i placed into the bash_profile – Brandon Seet Feb 25 '15 at 10:01
  • It looks like PATH and LD_LIBRARY_PATH are not modified, whereas GUROBI_HOME has the correct value. There can be an error in your ".bash_profile" (beware, spaces and newlines are significant). Try to source your bash_profile after you log in (type `source ` in the command line). If it does not work, then you have a syntax error. Otherwise, it means that the system is resetting PATH and LD_LIBRARY_PATH after loading your file: you will have to source the `profile` again (manually) each time you log in, and you should send a bug report to openshift. – Nicolas Grebille Feb 25 '15 at 11:14
  • Thanks Nicolas ! I'm really grateful for your help in this entire thing, i've managed to install the Gurobi package and update the license key for my Openshift Server, as of now i'm trying to add the environment for the license. – Brandon Seet Feb 25 '15 at 11:36
  • `When you run the Linux version of the Gurobi Optimizer, it will look for the gurobi.lic key file in three different default locations. It will always look in your home directory. In addition, Gurobi Optimizer 6.0.0 will also look in /opt/gurobi and /opt/gurobi600. If you used a non-default license key file location, you should set environment variable GRB_LICENSE_FILE to point to the license key file. Important note: the environment variable points to the license key file itself, not to the directory that contains the file.` <-- this is what they said on Gurobi Site – Brandon Seet Feb 25 '15 at 11:37
  • It is exactly the same thing, just add the corresponding line to the `bash_profile` file, e.g. `export GRB_LICENSE_FILE="/home/jbossews/gurobi.lic"`. – Nicolas Grebille Feb 25 '15 at 12:50
  • Hey nicolas, i believe why the LD_Library_Path & Path are not working correctly is due to Openshift themselves when initiallising my shell automatically resets it and overrides the bash_profile properties which i have added in thus, only the other two works GRB_LICENSE_FILE & GUROBI_HOME – Brandon Seet Feb 25 '15 at 13:25
  • http://stackoverflow.com/questions/22720952/set-env-path-in-openshift <--- i've googled this on another stackoverflow post and i think this should be the way to change it, is this right? – Brandon Seet Feb 25 '15 at 13:26