-
Notifications
You must be signed in to change notification settings - Fork 1
Custom Box for Vagrant
If you want to create a custom box for vagrant installation for PuPHPet with pre installed stuff, you have a lot of options but we will cover two of those.
#Packer
Homepage: https://www.packer.io/
Download
Open https://www.packer.io/downloads.html and get packer for Windows.
Extract content of downloaded archive to C:\packer
Packer templates for PuPHPet
Open https://github.com/puphpet/packer-templates and download repository
Extract content of downloaded archive to C:\packer\packer-templates
##Customize
Open C:\packer\packer-templates\ubuntu-14.04-x86_64\template.json
with your editor and at builders array you could edit settings for type virtualbox-iso
(Basically change only disk_size if you need. Memory and cpus you could later increase in your vagrant configuration file.)
First of all, check if you get last ubuntu server version.
Open http://releases.ubuntu.com/trusty/ and locate ubuntu-14.04.[version]-server-amd64.iso
Copy link location and update it in iso_url setting.
Open http://releases.ubuntu.com/trusty/SHA256SUMS locate and copy checksum code for ubuntu-14.04.[version]-server-amd64.iso
Replace checksum on iso_checksum setting.
Preinstall
-
In top of template.json file, at the provisioners, scripts config, before scripts/zerodisk.sh add
"scripts/preinstall.sh",
-
In C:\packer\packer-templates\ubuntu-14.04-x86_64\scripts create scripts/preinstall.sh
-
Open Command Prompt with Admin Rights and run
C:\packer\packer.exe build -only=virtualbox-iso C:\packer\packer-templates\ubuntu-14.04-x86_64\template.json
A VirtualBox window will be oppened and starting configuration
- When a login prompt in VirtualBox, just login with
user: vagrant
pass: vagrant
and wait build process to continue.
After done, you will see in Command Prompt:
Build 'virtualbox-iso' finished.
==> Builds finished. The artifacts of successful builds are:
--> virtualbox-iso: 'virtualbox' provider box: packer_virtualbox-iso_virtualbox.box
- Add new Box to Vagrant
vagrant box add packer-ubuntu64 C:\packer\packer-templates\ubuntu-14.04-x86_64\packer_virtualbox-iso_virtualbox.box
Where packer-ubuntu64 - name as you want
- PuPHPet
Open https://puphpet.com/ and create your configuration
Save content of archive to F:\servers\project-name and open puphpet/config.yaml in your editor. Change box and box_url with packer-ubuntu64 or how you named when you added to vagrant with box add.
In F:\servers\project-name run vagrant up
to start build your Virtual Machine.
Then enter in ssh mode with vagrant ssh