Uses VirtualBox as a local backend for the Linode API. Much of the functionality of the Instances, Volumes, and Types APIs are implemented.
- Download Ubuntu Server 20.04 iso.
- Install VirtualBox onto the system.
- Follow the VirtualBox machine template setup instructions below.
npm install
npm run build
npm start
- In VirtualBox Manager:
- Machine > New... (or ctrl+n)
- Name it
ubuntu server template
> Create - File Size: 1 TB+ > Create
- Go to settings for
ubuntu server template
- Storage > IDE optical drive (says "Empty") > Click disk icon dropdown > Choosea disk file... > Select the ISO you downloaded
- Click OK and start the VM.
- Name it
- Machine > New... (or ctrl+n)
- Ubuntu setup. (ctrl+c view mode is nice)
- Click next until you get to "Guided Storage configuration"
- Select "Custom storage layout" > Done
- Select the VBOX_HARDDISK and press enter > Add GPT Partition
- Size: 20G > Format: ext4 > Mount: / > Create
- Add another GPT Partition
- Size: 512M > Format: swap > Create
- Done > Continue
- Enter
local-linode
for all options > Done - Check Install OpenSSH Server > Done
- Done > Wait for intallation to complete > Reboot Now
- Power off machine > Settings > Unmount install CD > Power on
- Machine GUI Menu > Devices > Insert Guest Additions image (may need to remove ubuntu iso)
- Log into the machine and run bash commands below.
- In Virtualbox Manager
- Machine GUI Menu > Devices > Optical Drives > Remove disk
- Power off machine > Machine settings
- Navigate to Network > Adapter 1 > Attached to: Select Host-only Adapter
- Navigate to Storage > Controller: SATA > Port Count > Enter
8
- Hit OK
- Right click machine > Export to OCI
- Format: Open Virtualization Format 2.0
- MAC Address Policy: Strip all network adapter MAC addresses
- Un-check Write Manifest file, might be faster
- File: "{default VirtualBox VMs folder}/ubuntu_server_template.ova"
- You can delete the Template you created in VirtualBox. If you need to update the OVA, you can edit a machine spawned by the script, re-export, and overwrite the template OVA.
sudo apt update
sudo apt upgrade -y
sudo apt install build-essential linux-headers-$(uname -r) -y
sudo mount /dev/cdrom /media
sudo /media/VBoxLinuxAdditions.run
sudo ufw allow ssh
sudo ufw enable
- Linode API
- node-sqlite3
- node-virtualbox
- Look at the source for most up-to-date API usage info
- vboxmanage
- this is what node-virtualbox uses under the hood to control virtualbox
- many of the options for creating a new instance and config are not implemented, such as interfaces
- the hotpluggable flag on vboxmanage storagectl causes a lot of issues. When attaching a drive to a running instance, it is set automatically and there isn't an issue. However, when using "--hotpluggable on", the vm will fail to start and other odd behavior. This must be worked around.
- the VM can also get into states where it can't be controlled if operations are done on it before it's fully booted, it seems
- resizing disks
- automate creating template vm