Try our new documentation site (beta).
Building an Image
Starting with Gurobi 8.0, we have greatly simplified the process to create a custom virtual machine image running the Gurobi Remote Services. This will give you more flexibility to start your servers in any Azure data center around the world. Also, you will be able to select and maintain the operating system. At the time of writing this guide, we recommend using the ubuntu 16.04 LTS Image (we will assume such a choice in the following instructions). We do not recommend to use ubuntu 18.04 yet, as the creation of an image in Azure with this specific operating system leads to networking problems. In the following section, we will explain how to create an image using the portal or Packer. Using Packer is recommended.
Building an Image using the Azure Portal
In order to create manually the Image, please follow these steps, you should be very familiar with Azure:
- Launch an Azure instance:
- Login to the Azure portal.
- Select the
Resource groups
menu option and click onAdd
to create a new resource groupgurobi
. - Select the
Virtual machines
menu options and click onAdd
to start the creation of a new virtual machine. - Select the the ubuntu 16.04 LTS or later base Image and click on
create
. - Then, give the machine a name
grbrs811
, set the username toubuntu
and give a password. Set the resource group thegurobi
and click onOK
. - Then, select a small machine type, such as
A0
orA1
. - Then, select the public inbound port SSH(22) to be open, and click on
OK
. - Review the configuration and click on
Create
. - Select the
Virtual machines
menu option and wait for the instance to be running to lookup the instance public IP (we will call itazure-instance
).
- Copy the server package to your instance:
scp gurobi_server8.1.1_linux64.tar.gz ubuntu@azure-instance:/tmp/
- Log in to your instance:
ssh ubuntu@azure-instance
- Unpack the server package:
sudo tar xfz /tmp/gurobi_server8.1.1_linux64.tar.gz -C /opt/
- Replace the configuration file with the predefined Azure configuration:
sudo cp /opt/gurobi_server811/linux64/bin/grb_rs_azure.cnf /opt/gurobi_server811/linux64/bin/grb_rs.cnf
Alternatively, you can copy a configuration file that you prepared in advance. - Review and update the configuration file as necessary (optional):
sudo vi /opt/gurobi_server811/linux64/bin/grb_rs.cnf
- Start the Remote Services:
sudo /opt/gurobi_server811/linux64/bin/grb_rs start
- Verify the log. The log messages are automatically forwarded to the syslog and also to service.log rotating
file:
tail -f /opt/gurobi_server811/linux64/bin/service.log
The log file should indicate that the server started. Disregard the message about the license being invalid, unless you modified the configuration file with aCLOUDKEY
. However, make sure that there is no errors about the configuration file and properties. Here is a sample of the expected output:... 2018-03-01T17:20:46Z - info : Starting API server (HTTP) on port 80...
- Prepare the machine for the image
sudo waagent -deprovision+user
- Log out of the instance
- Select the instance in the Azure dashboard and click on
Capture
. Select the existing resource groupgurobi
and select the option to delete the VM after creating the image. - Wait for the image to be ready.
Building an Image with Packer
You can easily automate the creation of the Image using Packer. Here is a sample script provided as-is. You can easily extend it to copy a predefined configuration file, or to set up TLS encryption by copying your private key and certificate. With this script example, Packer will also select the latest ubuntu 16.04 base Image for you. To use this script, please follow these steps:
- If not done already, you need to create a resource group to store the image.
Login to the Azure portal. Select the
Resource groups
menu option and click onAdd
to create a new resource groupgurobi
. - Install Packer
- Create a new directory
- Download the script
gurobi-azure.json
and save it in this new directory. - Download the server package
gurobi_server8.1.1_linux64.tar.gz
and save it in this new directory. - Run Packer from this directory and provide your Azure account information on the command line:
$ packer build \ -var 'AZURE_CLIENT_ID=YOUR ACCESS KEY' \ -var 'AZURE_CLIENT_SECRET=YOUR SECRET KEY' \ -var 'AZURE_TENANT_ID=YOUR TENANT ID' \ -var 'AZURE_SUBSCRIPTION_ID=YOUR SUBSCRIPTION ID' \ gurobi-azure.json
- When the script is completed, you can get the image name at the end of the log:
==> Builds finished. The artifacts of successful builds are: --> azure-arm: Azure.ResourceManagement.VMImage: ManagedImageResourceGroupName: gurobi ManagedImageName: gurobi-server811-1535730766 ManagedImageLocation: eastus