Skip to main content

Not clear how to install Gurobi in Linux with command prompt

Answered

Comments

8 comments

  • Official comment
    Gwyneth Butera
    Gurobi Staff Gurobi Staff

    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.  

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Eli Towle
    Gurobi Staff Gurobi Staff

    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
  • Fikri Kucuksayacigil
    Gurobi-versary
    Collaborator
    Curious

    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
  • Fikri Kucuksayacigil
    Gurobi-versary
    Collaborator
    Curious

    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
  • Fikri Kucuksayacigil
    Gurobi-versary
    Collaborator
    Curious

    Okay, I think I added the above-mentioned commands into .bashrc file. Let me test if it is installed or not.

    0
  • Eli Towle
    Gurobi Staff Gurobi Staff

    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
  • Fikri Kucuksayacigil
    Gurobi-versary
    Collaborator
    Curious

    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

Post is closed for comments.