Complete Guide: Installing Gurobi Optimizer on Oracle ARM Ubuntu
This guide will walk you through the complete process of installing Gurobi Optimizer with a Web License Service (WLS) license on an Oracle Cloud Infrastructure (OCI) server running Ubuntu on ARM64 architecture. It’s especially useful for graduate students in data science...
This guide will walk you through the complete process of installing Gurobi Optimizer with a Web License Service (WLS) license on an Oracle Cloud Infrastructure (OCI) server running Ubuntu on ARM64 architecture. It’s especially useful for graduate students in data science who have obtained an academic Gurobi license.
-
Oracle ARM servers offer excellent performance at low cost
-
Gurobi is essential for optimization problems in data science
-
WLS configuration can be complex without clear documentation
-
Combines modern tools like uv for Python package management
Before you begin, make sure you have:
-
An Oracle Cloud server with Ubuntu 20.04, 22.04, or 24.04 LTS
-
ARM64 architecture (aarch64)
-
Root/sudo access
-
Stable internet connection
-
A Gurobi WLS license (academic or commercial)
For this tutorial, you’ll need three values from your Gurobi account:
-
WLSACCESSID: Your WLS access ID
-
WLSSECRET: Your WLS secret key
-
LICENSEID: Your numeric license ID
# Check Ubuntu versionlsb_release -a
# Check processor architectureuname -mExpected output:
Distributor ID: UbuntuDescription: Ubuntu 24.04.3 LTSRelease: 24.04Codename: noble
aarch64# Update repositories and packagessudo apt update && sudo apt upgrade -y
# Install basic dependenciessudo apt install -y wget curl python3 python3-pip build-essential# Create directory in /optcd /optsudo mkdir -p gurobicd gurobi# Download the ARM Linux specific versionsudo wget https://packages.gurobi.com/12.0/gurobi12.0.3_armlinux64.tar.gzNote: The URL for ARM64 is different from the x86-64 version. Make sure to use armlinux64 instead of linux64.
# Extract the filesudo tar -xzf gurobi12.0.3_armlinux64.tar.gz
# Move the extracted directorysudo mv gurobi1203 /opt/gurobi/
# Clean up downloaded filesudo rm gurobi12.0.3_armlinux64.tar.gz# Add variables to bashrcecho 'export GUROBI_HOME="/opt/gurobi/gurobi1203/armlinux64"' >> ~/.bashrcecho 'export PATH="${PATH}:${GUROBI_HOME}/bin"' >> ~/.bashrcecho 'export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"' >> ~/.bashrc
# If you use zsh (recommended)echo 'export GUROBI_HOME="/opt/gurobi/gurobi1203/armlinux64"' >> ~/.zshrcecho 'export PATH="${PATH}:${GUROBI_HOME}/bin"' >> ~/.zshrcecho 'export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"' >> ~/.zshrc# Load the new variablessource ~/.bashrc # or ~/.zshrc if you use zsh
# Verify configurationecho $GUROBI_HOMEecho $PATH | grep gurobiIf you have uv installed (modern Python package management tool):
# Navigate to your projectcd /path/to/your/project
# Install gurobipy with uvuv add gurobipy
# Verify installationuv run python -c "import gurobipy as gp; print('Gurobipy imported successfully')"Important: You need to install gurobipy in each Python environment you create. The license file (created in Step 5) is shared across all environments, but the Python package must be installed separately for each project/environment.
# Install gurobipy in a virtual environmentpython -m venv myenvsource myenv/bin/activate # On Windows: myenv\Scripts\activatepip install gurobipy
# Verify installationpython -c "import gurobipy as gp; print('Gurobipy imported successfully')"Important: Since Gurobi 11.0, the Python package gurobipy is no longer included with the installer and must be installed separately.
Remember: Each new Python environment (virtualenv, conda env, uv project) requires its own gurobipy installation. The license file is shared system-wide.
# Create gurobi.lic file in home directorycat > ~/gurobi.lic**Important:** Replace the placeholder values with your actual WLS credentials from your Gurobi account. Keep this file secure and never commit it to version control.
**Note:** This file only needs to be created **once** on your system. It will be used by all your Python projects and environments automatically.
### 5.2 Configure License File Environment Variable
```text# Add license file variableecho 'export GRB_LICENSE_FILE=/home/ubuntu/gurobi.lic' >> ~/.bashrcecho 'export GRB_LICENSE_FILE=/home/ubuntu/gurobi.lic' >> ~/.zshrc
# Load in current sessionexport GRB_LICENSE_FILE=/home/ubuntu/gurobi.licCreate a file called test_gurobi.py:
#!/usr/bin/env python3"""Test script to verify that Gurobi works correctly with WLS license"""
import gurobipy as gpfrom gurobipy import GRB
def test_gurobi_license(): """Test connection with WLS license and solve a simple problem""" try: print("=== Gurobi Test with WLS License ===")
# Create a Gurobi environment print("1. Creating Gurobi environment...") env = gp.Env()
# Show license information print(f"2. Gurobi version: {gp.gurobi.version()}")
# Create a simple test model print("3. Creating simple optimization model...") model = gp.Model("wls_test", env=env)
# Create variables x = model.addVar(name="x") y = model.addVar(name="y")
# Set objective: maximize x + y model.setObjective(x + y, GRB.MAXIMIZE)
# Add constraints model.addConstr(2*x + 3*y = 0, "non_neg_x") model.addConstr(y >= 0, "non_neg_y")
# Solve the model print("4. Solving model...") model.optimize()
# Check solution status if model.status == GRB.OPTIMAL: print("✅ Success! Model solved correctly.") print(f" Optimal value: {model.objVal:.4f}") print(f" x = {x.x:.4f}") print(f" y = {y.x:.4f}")
# Show additional license information try: license_expiration = model.getAttr('LicenseExpiration') if license_expiration == 99999999: print(" License: No expiration date") else: print(f" License expires: {license_expiration}") except: print(" License expiration information not available")
else: print(f"❌ Error: Model could not be solved. Status: {model.status}")
except Exception as e: print(f"❌ Error during test: {e}") print("\nPossible causes:") print("- Problem with WLS license configuration") print("- Network connectivity issues") print("- Incorrect WLS credentials") return False
return True
def test_wls_connection(): """Test WLS connection specifically using parameters""" try: print("\n=== Direct WLS Connection Test ===")
# Create empty environment and configure WLS parameters manually with gp.Env(empty=True) as env: env.setParam("LicenseID", 1234567) # Replace with your License ID env.setParam("WLSAccessID", "your-access-id-here") # Replace with your Access ID env.setParam("WLSSecret", "your-secret-here") # Replace with your Secret env.start()
print("✅ WLS connection established successfully")
# Create a simple model to test with gp.Model(env=env) as model: x = model.addVar() model.setObjective(x) model.addConstr(x **Expected successful output:**
```textStarting Gurobi tests...=== Gurobi Test with WLS License ===1. Creating Gurobi environment...Set parameter WLSAccessIDSet parameter WLSSecretSet parameter LicenseID to value 1234567Academic license 1234567 - for non-commercial use only - registered to your@email.com2. Gurobi version: (12, 0, 3)3. Creating simple optimization model...4. Solving model...Gurobi Optimizer version 12.0.3 build v12.0.3rc0 (armlinux64 - "Ubuntu 24.04.3 LTS")...✅ Success! Model solved correctly. Optimal value: 1.6000 x = 0.8000 y = 0.8000 License: No expiration date
🎉 Gurobi is working correctly!Your ~/.bashrc or ~/.zshrc file should include:
# Gurobi Configurationexport GUROBI_HOME="/opt/gurobi/gurobi1203/armlinux64"export PATH="${PATH}:${GUROBI_HOME}/bin"export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"export GRB_LICENSE_FILE="/home/ubuntu/gurobi.lic"/opt/gurobi/gurobi1203/armlinux64/ # Gurobi installation/home/ubuntu/gurobi.lic # WLS license fileimport gurobipy as gpfrom gurobipy import GRB
# Create modelmodel = gp.Model("example")
# Create variablesx = model.addVar(name="x")y = model.addVar(name="y")
# Set objectivemodel.setObjective(3*x + 2*y, GRB.MAXIMIZE)
# Add constraintsmodel.addConstr(x + y = 0)model.addConstr(y >= 0)
# Solvemodel.optimize()
# Display resultsif model.status == GRB.OPTIMAL: print(f"Optimal value: {model.objVal}") print(f"x = {x.x}") print(f"y = {y.x}")# Solve a .lp filegurobi_cl model.lp
# Check versiongurobi_cl --version
# Check licensegurobi_cl --license1. Error “Cannot find gurobi”
# Check environment variablesecho $GUROBI_HOMEecho $PATH
# Reload configurationsource ~/.bashrc2. WLS License Error
# Check license filecat ~/gurobi.lic
# Check connectivityping gurobi.com
# Check license variableecho $GRB_LICENSE_FILE3. Architecture Error
-
Make sure you downloaded the armlinux64 version, not linux64
-
Verify with uname -m that you’re on aarch64 architecture
# Enable logging in Pythonimport gurobipy as gp
env = gp.Env()env.setParam('CSClientLog', 3) # Verbose logging-
Cost-effective: Up to 40% less expensive than x86 instances
-
Performance: Excellent for optimization problems
-
Scalability: Easy vertical scaling
-
Energy efficiency: Lower power consumption
-
CPU: VM.Standard.A1.Flex (4 OCPU, 24 GB RAM)
-
Storage: 100 GB Boot Volume
-
Network: Variable bandwidth (up to 4 Gbps)
-
Register at Gurobi Academic Program
-
Use institutional email (.edu)
-
Get free WLS license
-
Follow this guide for installation
-
For non-commercial use only
-
Problem size limitations (generally sufficient for research)
-
Requires periodic validation of academic status
# Download new versioncd /opt/gurobisudo wget https://packages.gurobi.com/12.1/gurobi12.1.0_armlinux64.tar.gz
# Extract and update environment variablessudo tar -xzf gurobi12.1.0_armlinux64.tar.gz# Update GUROBI_HOME in configuration files# Backup license filecp ~/gurobi.lic ~/gurobi.lic.backup
# Backup configurationcp ~/.bashrc ~/.bashrc.backup-
Gurobi Documentation
-
Python API Reference
-
Examples Repository
-
Gurobi Community Forum
-
Stack Overflow Tag: gurobi
-
Oracle Cloud Documentation
You have successfully completed the installation of Gurobi Optimizer on your Oracle ARM Ubuntu server. This setup will allow you to:
-
Solve complex optimization problems
-
Leverage high-efficiency ARM architecture
-
Use modern Python tools like uv
-
Work reliably with WLS licenses
-
Explore examples: Review the examples included in /opt/gurobi/gurobi1203/armlinux64/examples/
-
Integrate into projects: Use Gurobi in your data science projects
-
Optimize performance: Adjust parameters according to your specific needs
-
Share knowledge: Contribute to the community with your findings
Was this guide helpful? Share it with other students and professionals working with cloud-based optimization. The data science community grows when we share knowledge!
This tutorial was created during the actual installation process on an Oracle Cloud Infrastructure server with ARM64 architecture, ensuring that all steps have been tested and verified.