A hosting panel for the AI era: vibe-code it, push to GitHub, it's live.Explore →
DocsVM templates

VM templates

Sell VPSs with ZoPanel preinstalled: prepare one server, make a template of it, and every server made from it gets its own keys, ID and admin password.

If you sell virtual servers, you can install ZoPanel once, turn that machine into a template and create your customers' servers from it. They are ready as soon as they start: no installation to wait for.

A plain copy of an installed server is not enough. Every copy would share the same admin password, the same keys and the same machine ID. zopanel ctl prepare-template removes them, and each new server makes its own at its first boot.

Make the template

  1. Create a virtual machine with a supported system and install ZoPanel. Do not create customers or websites, and do not activate a license.

  2. If you like, adjust Packages and Settings. Packages, the panel name, the support link, the default PHP version, update and backup schedules are kept.

  3. Run, as root:

    zopanel ctl prepare-template
    
  4. Shut the machine down (poweroff) and make the template from its disk.

If you start the prepared machine again, it becomes a server of its own. Run the command again before you make another template from it.

What can be in a template

PHP, Node.js and the other runtimes, Apache, the web application firewall, FTP, PostgreSQL, Adminer and Docker can be installed beforehand. Email, webmail, calendars, the DNS server, MongoDB, Redis and S3 storage cannot: they hold host names and passwords made for one server. Customers install them from Components. The command lists anything that has to go first, and changes nothing until then.

Check what you added yourself: root's password, /root/.ssh/authorized_keys, shell history and copied files stay in the template.

What the customer does

The customer opens https://SERVER-IP:8888 and signs in as admin. There are two ways to give them the password.

Shown on the server (default). Each server makes a random password at its first boot. It is shown when root signs in over SSH, until it is changed in the panel:

  ZoPanel:   https://203.0.113.10:8888
  User:      admin
  Password:  (random, different on every server)

A user with sudo runs sudo zopanel ctl login-info. A lost password is replaced with sudo zopanel ctl reset-password admin.

Chosen by you. Your provisioning system writes the password with cloud-init and puts it in the welcome e-mail:

#cloud-config
write_files:
  - path: /etc/zopanel/first-boot.env
    permissions: "0600"
    content: |
      ZOPANEL_ADMIN_PASSWORD='a-long-random-password'
      ZOPANEL_ADMIN_EMAIL=customer@example.com
      ZOPANEL_LICENSE_KEY=ZP-XXXX-XXXX-XXXX

Every line is optional. The password needs 8 to 128 characters and no colon; otherwise a random one is made. The file is deleted after it has been read. A license key belongs to one server, so use a different key for each customer. Without a key the server runs on the Free plan.

What happens at the first boot

  • New machine ID, SSH host keys, panel certificate, encryption key and admin password, before the panel answers.
  • The clock is corrected over NTP, or over HTTPS where the provider blocks NTP. A template or host with a wrong date does no harm.
  • MariaDB's memory is set for the size of the new server.

If something is wrong

Problem What to do
The new server has no network The template's network configuration can name the old network card. Platforms with cloud-init replace it. Without cloud-init, remove the match: macaddress lines from the files in /etc/netplan before you make the template.
this server is prepared as a VM template The machine is ready: shut it down, or restart it to use it as a normal server.
The panel does not open on a new server Check journalctl -u zopanel-first-boot. The step runs again at every boot until it succeeds.
The password message does not appear The password was chosen through cloud-init, or it has been changed since. Use zopanel ctl reset-password admin.

← Updating ZoPanel Panel settings →