Place the preseed.cfg into a directory named http, so your file structure would look like this:
/
- http
- preseed.cgf
- box.json
| { | |
| "provisioners": [ | |
| { | |
| "type": "shell", | |
| "execute_command": "echo 'vagrant' | sudo -S sh '{{ .Path }}'", | |
| "inline": [ | |
| "VBOX_VERSION=$(cat ~/.vbox_version)", | |
| "sudo mkdir -p /mnt/virtualbox", | |
| "sudo mount -o loop ~/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt/virtualbox", | |
| "sudo sh /mnt/virtualbox/VBoxLinuxAdditions.run", | |
| "sudo umount /mnt/virtualbox", | |
| "sudo rm -rf ~/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt/virtualbox", | |
| "mkdir ~/.ssh", | |
| "wget -qO- https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub >> ~/.ssh/authorized_keys", | |
| "echo 'vagrant ALL=NOPASSWD:ALL' > /tmp/vagrant", | |
| "chmod 0440 /tmp/vagrant", | |
| "mv /tmp/vagrant /etc/sudoers.d/" | |
| ] | |
| }, | |
| ], | |
| "builders": [ | |
| { | |
| "type": "virtualbox-iso", | |
| "name": "vagrant", | |
| "boot_command": [ | |
| "<esc><esc><enter><wait>", | |
| "/install/vmlinuz noapic ", | |
| "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", | |
| "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", | |
| "hostname=YOUR_HOSTNAME ", | |
| "fb=false debconf/frontend=noninteractive ", | |
| "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", | |
| "keyboard-configuration/variant=USA console-setup/ask_detect=false ", | |
| "initrd=/install/initrd.gz -- <enter>" | |
| ], | |
| "boot_wait": "10s", | |
| "disk_size": 20480, | |
| "guest_os_type": "Ubuntu_64", | |
| "headless": true, | |
| "http_directory": "http", | |
| "http_port_min": 9000, | |
| "http_port_max": 10000, | |
| "iso_urls": [ | |
| "iso/ubuntu-14.04-server-amd64.iso", | |
| "http://releases.ubuntu.com/14.04/ubuntu-14.04-server-amd64.iso" | |
| ], | |
| "iso_checksum_type": "md5", | |
| "iso_checksum": "01545fa976c8367b4f0d59169ac4866c", | |
| "ssh_username": "vagrant", | |
| "ssh_password": "vagrant", | |
| "ssh_port": 22, | |
| "ssh_wait_timeout": "10000s", | |
| "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p", | |
| "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", | |
| "guest_additions_url": "http://download.virtualbox.org/virtualbox/{{.Version}}/VBoxGuestAdditions_{{.Version}}.iso", | |
| "virtualbox_version_file": ".vbox_version", | |
| "vm_name": "Box For You", | |
| "vboxmanage": [ | |
| [ | |
| "modifyvm", | |
| "{{.Name}}", | |
| "--memory", | |
| "1024" | |
| ], | |
| [ | |
| "modifyvm", | |
| "{{.Name}}", | |
| "--vram", | |
| "16" | |
| ], | |
| [ | |
| "modifyvm", | |
| "{{.Name}}", | |
| "--cpus", | |
| "1" | |
| ] | |
| ] | |
| } | |
| ], | |
| "post-processors": [ | |
| { | |
| "output": "builds/{{.Provider}}.box", | |
| "type": "vagrant", | |
| "vagrantfile_template": "/path/to/Vagrantfile", | |
| } | |
| ] | |
| } |
| # Some inspiration: | |
| # * https://github.com/chrisroberts/vagrant-boxes/blob/master/definitions/precise-64/preseed.cfg | |
| # * https://github.com/cal/vagrant-ubuntu-precise-64/blob/master/preseed.cfg | |
| # English plx | |
| d-i debian-installer/language string en | |
| d-i debian-installer/locale string en_US.UTF-8 | |
| d-i localechooser/preferred-locale string en_US.UTF-8 | |
| d-i localechooser/supported-locales en_US.UTF-8 | |
| # Including keyboards | |
| d-i console-setup/ask_detect boolean false | |
| d-i keyboard-configuration/layout select USA | |
| d-i keyboard-configuration/variant select USA | |
| d-i keyboard-configuration/modelcode string pc105 | |
| # Just roll with it | |
| d-i netcfg/get_hostname string this-host | |
| d-i netcfg/get_domain string this-host | |
| d-i time/zone string UTC | |
| d-i clock-setup/utc-auto boolean true | |
| d-i clock-setup/utc boolean true | |
| # Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive | |
| d-i debconf debconf/frontend select Noninteractive | |
| d-i pkgsel/install-language-support boolean false | |
| tasksel tasksel/first multiselect standard, ubuntu-server | |
| # Stuck between a rock and a HDD place | |
| d-i partman-auto/method string lvm | |
| d-i partman-lvm/confirm boolean true | |
| d-i partman-lvm/device_remove_lvm boolean true | |
| d-i partman-auto/choose_recipe select atomic | |
| d-i partman/confirm_write_new_label boolean true | |
| d-i partman/confirm_nooverwrite boolean true | |
| d-i partman/choose_partition select finish | |
| d-i partman/confirm boolean true | |
| # Write the changes to disks and configure LVM? | |
| d-i partman-lvm/confirm boolean true | |
| d-i partman-lvm/confirm_nooverwrite boolean true | |
| d-i partman-auto-lvm/guided_size string max | |
| # No proxy, plx | |
| d-i mirror/http/proxy string | |
| # Default user, change | |
| d-i passwd/user-fullname string vagrant | |
| d-i passwd/username string vagrant | |
| d-i passwd/user-password password vagrant | |
| d-i passwd/user-password-again password vagrant | |
| d-i user-setup/encrypt-home boolean false | |
| d-i user-setup/allow-password-weak boolean true | |
| # No language support packages. | |
| d-i pkgsel/install-language-support boolean false | |
| # Individual additional packages to install | |
| d-i pkgsel/include string build-essential ssh | |
| #For the update | |
| d-i pkgsel/update-policy select none | |
| # Whether to upgrade packages after debootstrap. | |
| # Allowed values: none, safe-upgrade, full-upgrade | |
| d-i pkgsel/upgrade select safe-upgrade | |
| # Go grub, go! | |
| d-i grub-installer/only_debian boolean true | |
| d-i finish-install/reboot_in_progress note |