Skip to content

Latest commit

 

History

History
157 lines (109 loc) · 5.54 KB

README.mdown

File metadata and controls

157 lines (109 loc) · 5.54 KB

Packer templates for Debian 9.5

Templates to create Vagrant boxes for Debian 9.5 (amd64).

Prerequisites

Provisioned software tools

  • VirtualBox Guest Additions or open-vm-tools
  • sshd
  • sudo
  • vagrant user and its insecure public key

How to create a box

VirtualBox

From the terminal, invoke the following command for VirtualBox provider:

packer build -only=virtualbox-iso -var-file=debian-9.5.0-amd64-netinst.iso debian-9-amd64-minimal.json

You will find a vagrant box file named Debian-9-amd64-minimal-v9.5.20181111-virtualbox.box in the same directory after the command has succeeded.

Then you can add the box named Debian-9-amd64-minimal-v9.5.20181111-virtualbox to your box list by the following command:

vagrant box add Debian-9-amd64-minimal-v9.5.20181111-virtualbox.box --name Debian-9-amd64-minimal-v9.5.20181111-virtualbox

VMware

From the terminal, invoke the following command for VMware provider:

packer build -only=vmware-iso -var-file=debian-9.5.0-amd64-netinst.iso debian-9-amd64-minimal.json

You will find a vagrant box file named Debian-9-amd64-minimal-v9.5.20181111-vmware.box in the same directory after the command has succeeded.

Then you can add the box named Debian-9-amd64-minimal-v9.5.20181111-vmware to your box list by the following command:

vagrant box add Debian-9-amd64-minimal-v9.5.20181111-vmware.box --name Debian-9-amd64-minimal-v9.5.20181111-vmware

In the output directory you will also find a VM image that can be directly imported from VMware.

Building a VM image on ESXi

In order to build a VM image on ESXi, you need to provide the following environment variables:

  • REMOTE_HOST - ESXi host name or IP address
  • REMOTE_USERNAME - ESXi login user name
  • REMOTE_PASSWORD - ESXi login password
  • REMOTE_DATASTORE - ESXi datastore name where a VM image will be created

You also have to enable SSH and VNC on ESXi host.

The following command will build a VM image on your ESXi:

packer build -only=esxi-iso -var-file=debian-9.5.0-amd64-netinst.iso debian-9-amd64-minimal.json

Variants

  • debian-9-amd64-minimal.json - Debian 9.5 minimal installation
  • debian-9-amd64-ansible.json - Debian 9.5 with Ansible + Testinfra.
  • debian-9-amd64-docker.json - Debian 9.5 with Docker + Docker Compose
  • debian-9-amd64-dwm.json - Debian 9.5 with X.org, suckless tools, ARandR, and xrdp.
  • debian-9-amd64-xfce.json - Debian 9.5 with Xfce + xrdp.

Installer CD images

Optional var files are provided to instruct to use alternative installer CD images, i.e., vars-debian-9-amd64-full.json instructs to use debian-9.5.0-amd64-xfce-CD-1.iso while vars-debian-9-amd64-netinst.json does debian-9.5.0-amd64-netinst.iso respectively. Without using these var files, debian-9-amd64-*.json templates use mini.iso.

Depending on situation you can specify either of var files on the command line:

packer build -var-file=vars-debian-9-amd64-full.json debian-9-amd64-minimal.json

It is recommended to use "jigdo" to download large iso image file and put it in ./iso directory. Templates instruct packer to use the image file rather than downloading an image from a mirror site.

Build parameters

The following parameters can be set at build time by supplying -var or -var-file command line options to packer:

  • vm_name - VM name. This also affects box file name and output directory name.
  • mem_size - RAM size of the created VM. Default value is 512 which means 512MB.
  • disk_size - Disk size of the created VM. Default value is 51200 which means 50GB.
  • root_password - Password for root user. Default value is vagrant.
  • vagrant_username - User name used for run time. Vagrant box is set for this user. Default value is vagrant.
  • vagrant_password - Password for vagrant_username. Default value is vagrant.
  • headless - Launch the virtual machine in headless mode if set to true. Default value is false.
  • virtualbox_version - VirtualBox Guest Additions version number. Default value is "5.1.22".

Copyright © 2017, 2018 Upperstream Software.