Not clear how to install Gurobi in Linux with command prompt
AnsweredHi,
I am not an expert in Linux system (a little familiarity with this operating system). I have a Linux cluster, and want to run an optimization model there. I was able to download Gurobi and put .tar file on the director. And, I was able to extract file from .tar file.
It is not clear what to do from now on. How do I install it? I reviewed the documentation, but it seems that installation part is skipped.
I would be really glad if you help me.
Kind regards,
Fikri Kucuksayacigil
-
Official comment
Hi Fikri - If you are at a university, the best solution is to ask your system administrator if Gurobi is installed on the cluster and, if not, to have them install Gurobi on your cluster. They can submit a support request for us to proceed.
-
Have you read the Linux software installation guide? Once you extract the \( \texttt{gurobi912} \) folder, you need to set a few environment variables. E.g., assuming you extracted the Gurobi package to \( \texttt{/opt/gurobi912} \):
export GUROBI_HOME="/opt/gurobi912/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"In order for these environment variable changes to be recognized by applications and persist across shell sessions, add the above commands to your \( \texttt{~/.bashrc} \) file (or equivalent for your Linux distribution).
To test your Gurobi installation, you can use the Gurobi command-line tool to solve a model file that comes with Gurobi:
gurobi_cl /opt/gurobi912/linux64/bin/examples/data/afiro.mps
0 -
Hi,
Thank you so much for your response. I put these commands in command prompt. Do I also need to put these in file? By the way, I do not know what is. Can you help me with this?
0 -
By the way, I had already looked at the documentation Linux software installation guide before I asked this question. I did not know that putting the above-mentioned commands is an installation. Could you please confirm this? Sorry for stupid questions.
0 -
Okay, I think I added the above-mentioned commands into .bashrc file. Let me test if it is installed or not.
0 -
Yes, I would consider setting these environment variables to be part of a proper Gurobi installation.
It's okay to enter those commands into the terminal to set your environment variables. But if you open a new terminal window, the changes you made to the environment variables will not be in effect. This is where the \( \texttt{~/.bashrc} \) can help.
The \( \texttt{~} \) symbol is a shortcut to your home folder. \( \texttt{.bashrc} \) is the name of a (text) file. It is essentially a set of commands that runs every time you open a terminal window (and some other places). If you want to learn more about the \( \texttt{.bashrc} \) file, there are many online resources and discussions devoted to the topic. Note that files beginning with a dot are "hidden" in Linux, so you will not see the \( \texttt{.bashrc} \) file in your home directory when using the system file explorer.
To edit the \( \texttt{~/.bashrc} \) file from a terminal window, you can use
nano ~/.bashrc
If you make any changes to \( \texttt{~/.bashrc} \), those changes will not take effect until you open a new terminal window.
If everything is working properly, you should be able to open a new terminal window and successfully solve a model without entering any additional commands:
gurobi_cl /opt/gurobi912/linux64/examples/data/afiro.mps
EDIT: fixed path to \( \texttt{afiro.mps} \), thanks Fikri.
0 -
Thank you so much for your answers. There were some errors related to the cluster, that is why I delayed a bit to respond.
I think I have a working installation. Everything seems fine.
Just one correction, the above command should be
gurobi_cl /opt/gurobi912/linux64/examples/data/afiro.mps
0
Please sign in to leave a comment.
Comments
7 comments