Complete Guide: Installing Gurobi Optimizer on Oracle ARM Ubuntu
š Introduction
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.
Why This Guide?
-
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
šÆ Prerequisites
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)
Required WLS License Data
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
Table of Contents
- š Introduction
Why This Guide?
- šÆ Prerequisites
Required WLS License Data
- š Step 1: System Verification and Preparation
1.1 Verify System Version
-
1.2 Update the System
-
š§ Step 2: Download and Install Gurobi
2.1 Create Installation Directory
-
2.2 Download Gurobi for ARM64
-
2.3 Extract and Install
-
š Step 3: Environment Variables Configuration
3.1 Configure System Variables
-
3.2 Load Variables in Current Session
-
š Step 4: Python Package Installation
4.1 Using UV (Recommended)
-
4.2 Alternative: Using pip
-
š Step 5: WLS License Configuration
5.1 Create License File
-
5.2 Configure License File Environment Variable
-
š§Ŗ Step 6: Installation Verification
6.1 Complete Test Script
-
6.2 Run the Tests
-
š Final System Configuration
Complete Environment Variables
-
File Structure
-
š Basic Usage
Simple Python Example
-
Command Line Usage
-
š§ Troubleshooting
Common Issues
-
Debug Logging
-
š Performance on Oracle ARM
Advantages of Oracle ARM for Gurobi
-
Recommended Configuration
-
š Academic Licenses
For Students
-
Academic Limitations
-
š Maintenance and Updates
Updating Gurobi
-
Configuration Backup
-
š Additional Resources
Official Documentation
-
Community and Support
-
š Conclusion
Next Steps
š Step 1: System Verification and Preparation
1.1 Verify System Version
# Check Ubuntu versionlsb_release -a
# Check processor architectureuname -mExpected output:
Distributor ID: UbuntuDescription: Ubuntu 24.04.3 LTSRelease: 24.04Codename: noble
aarch641.2 Update the System
# Update repositories and packagessudo apt update && sudo apt upgrade -y
# Install basic dependenciessudo apt install -y wget curl python3 python3-pip build-essentialš§ Step 2: Download and Install Gurobi
2.1 Create Installation Directory
# Create directory in /optcd /optsudo mkdir -p gurobicd gurobi2.2 Download Gurobi for ARM64
# 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.
2.3 Extract and Install
# 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š Step 3: Environment Variables Configuration
3.1 Configure System Variables
# 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"' >> ~/.zshrc3.2 Load Variables in Current Session
# Load the new variablessource ~/.bashrc # or ~/.zshrc if you use zsh
# Verify configurationecho $GUROBI_HOMEecho $PATH | grep gurobiš Step 4: Python Package Installation
4.1 Using UV (Recommended)
If 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.
4.2 Alternative: Using pip
# 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.
š Step 5: WLS License Configuration
5.1 Create License File
# 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.licš§Ŗ Step 6: Installation Verification
6.1 Complete Test Script
Create 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!š Final System Configuration
Complete Environment Variables
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"File Structure
/opt/gurobi/gurobi1203/armlinux64/ # Gurobi installation/home/ubuntu/gurobi.lic # WLS license fileš Basic Usage
Simple Python Example
import 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}")Command Line Usage
# Solve a .lp filegurobi_cl model.lp
# Check versiongurobi_cl --version
# Check licensegurobi_cl --licenseš§ Troubleshooting
Common Issues
1. 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
Debug Logging
# Enable logging in Pythonimport gurobipy as gp
env = gp.Env()env.setParam('CSClientLog', 3) # Verbose loggingš Performance on Oracle ARM
Advantages of Oracle ARM for Gurobi
-
Cost-effective: Up to 40% less expensive than x86 instances
-
Performance: Excellent for optimization problems
-
Scalability: Easy vertical scaling
-
Energy efficiency: Lower power consumption
Recommended Configuration
-
CPU: VM.Standard.A1.Flex (4 OCPU, 24 GB RAM)
-
Storage: 100 GB Boot Volume
-
Network: Variable bandwidth (up to 4 Gbps)
š Academic Licenses
For Students
-
Register atĀ Gurobi Academic Program
-
Use institutional email (.edu)
-
Get free WLS license
-
Follow this guide for installation
Academic Limitations
-
For non-commercial use only
-
Problem size limitations (generally sufficient for research)
-
Requires periodic validation of academic status
š Maintenance and Updates
Updating Gurobi
# 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 filesConfiguration Backup
# Backup license filecp ~/gurobi.lic ~/gurobi.lic.backup
# Backup configurationcp ~/.bashrc ~/.bashrc.backupš Additional Resources
Official Documentation
-
Gurobi Documentation
-
Python API Reference
-
Examples Repository
Community and Support
-
Gurobi Community Forum
-
Stack Overflow Tag: gurobi
-
Oracle Cloud Documentation
š Conclusion
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
Next Steps
-
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.