| title | Set up the Azure Cobalt environment |
|---|---|
| weight | 3 |
| layout | learningpathall |
To run QuantLib on Azure Cobalt, first create an Arm64 Ubuntu virtual machine in the Azure portal.
Use the following settings:
- Virtual machine name:
quantlib-cobalt-vm - Region: a Cobalt-supported region such as West US 2
- Availability options: No infrastructure redundancy required
- Security type: Standard
- Image: Ubuntu Server 22.04 LTS
- VM architecture: Arm64
- Size: Standard_D4ps_v5
- Authentication type: SSH public key
- Username:
azureuser
For storage, a 64 GB OS disk is sufficient for this workflow.
For networking, allow inbound SSH on port 22. Restricting the source to My IP is recommended.
After creating the VM, download the generated private key in .pem format if Azure provides one during setup.
On your local machine, update the permissions on the private key:
chmod 600 ~/Downloads/quantlib-cobalt-vm_key.pemThen connect using SSH:
ssh -i ~/Downloads/quantlib-cobalt-vm_key.pem azureuser@<VM_PUBLIC_IP>Replace <VM_PUBLIC_IP> with the public IP address of your VM.
If you’ll reconnect often, add a shortcut entry to your SSH config:
nano ~/.ssh/configAdd:
Host quantlib-cobalt
HostName <VM_PUBLIC_IP>
User azureuser
IdentityFile ~/Downloads/quantlib-cobalt-vm_key.pemThen connect with:
ssh quantlib-cobaltAfter logging in, verify the architecture:
uname -mThe expected output is:
aarch64If you do not see aarch64, check that you created the VM with Arm64 architecture and selected an Azure Cobalt-compatible instance type.
Update the package index and install required packages:
sudo apt update
sudo apt install -y build-essential cmake curl libboost-all-devThese packages provide the compiler toolchain, build system support, download tools, and Boost libraries needed to build QuantLib.
If you want the build to continue even if your SSH session disconnects, install tmux:
sudo apt update
sudo apt install -y tmux
tmuxSet the version and download the release archive:
export QL_VER=1.41
cd ~
curl -L -o QuantLib-$QL_VER.tar.gz \
https://github.com/lballabio/QuantLib/releases/download/v$QL_VER/QuantLib-$QL_VER.tar.gzCheck that the file exists. Run:
ls -lh QuantLib-$QL_VER.tar.gzYou should see output showing the file name and size, for example:
-rw-r--r-- 1 azureuser azureuser 41M QuantLib-1.41.tar.gzIf the file is missing or has size 0, re-run the curl command.
Use the file command to confirm that the archive is a valid gzip-compressed tar file:
file QuantLib-$QL_VER.tar.gzExpected output is simlar to:
QuantLib-1.41.tar.gz: gzip compressed data, max compression, from Unix, original size modulo 2^32 42721280To check that the archive is not corrupted, run:
tar -tzf QuantLib-$QL_VER.tar.gz > /dev/nullIf the command completes without errors, the archive is valid.
If you see errors such as:
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archivethe download is incomplete or corrupted.l Delete the file and download it again.
Once the archive is verified, extract it:
tar -xzf QuantLib-$QL_VER.tar.gzThen move into the extracted directory:
cd QuantLib-$QL_VERList the contents:
lsYou should see files and directories such as:
configure
Makefile.am
ql/
test-suite/This confirms that the source code has been unpacked correctly and is ready to configure and build.