Vultr Startup Scripts Quickstart Guide

Last Updated: Mon, Apr 20, 2020
Quickstart Guides System Admin

Script Types

Vultr allows you to assign two types of scripts to a server. Boot scripts configure new deployments, and PXE scripts automatically install operating systems. Assign startup scripts to your servers on your Startup Scripts page.

Boot Scripts

A boot script is executed on your server the very first time it starts. It will not run on subsequent reboots.

On Linux

  • The startup script is saved to /tmp/firstboot.exec.
  • It is executed with /bin/bash as root.
  • The output is saved to /tmp/firstboot.log.


  • The startup script is saved to /tmp/firstboot.exec.
  • It is executed with /bin/sh as root.
  • The output is saved to /tmp/firstboot.log.

On Windows

  • The startup script is saved to C:\image\firstboot.cmd.
  • It is executed with cmd.exe as Administrator.
  • The output is saved to C:\image\firstboot.log

PXE Scripts

A PXE script automates installation of custom operating systems. A PXE script will be executed by iPXE every time your server starts, but only if there is no operating system installed to the server's disk.


  • Must be a valid iPXE script.
  • PXE scripts are listed under the 'Upload ISO' option on the deploy page.
  • Not supported on Bare Metal.

Boot Script Example: Query Instance Metadata

Startup scripts may query the Vultr Metadata API to discover information about the instance. This script logs the metadata for the deployed instance to /tmp/metadata.json.


curl -o /tmp/metadata.json

Your script can manipulate the JSON metadata with tools such as jq, Python, sed, awk, or grep. For example, you could use the metadata to discover your IP address and generate configuration files automatically on first boot.

Boot Script Example: Pre-Load SSH Public Key

This example installs a public key for SSH authorization. Replace "ssh-rsa AA..." with your SSH public key info.


mkdir -p /root/.ssh
chmod 600 /root/.ssh
echo ssh-rsa AA... > /root/.ssh/authorized_keys
chmod 700 /root/.ssh/authorized_keys

PXE Script Example: Boot CoreOS

This is an example that boots CoreOS. You need to add your SSH key before this will work.


set base-url

kernel ${base-url}/coreos_production_pxe.vmlinuz sshkey="ssh-rsa AAAA..." cloud-config-url=
initrd ${base-url}/coreos_production_pxe_image.cpio.gz

Want to contribute?

You could earn up to $300 by adding new articles