How to add a vagrant box with pre-installed libraries using 'config-vm.box' in Vagrantfile? for e.g. I want to configure my vm with CentOS 6 + Tomcat 8 + java 8 to be installed, and don't want to do it manually.
2 Answers
You must use a provisionning technology like packer : PACKER
With this you can configure provisionning with json file and run a script bash file for launch command linux like 'apt-get'
EDIT :
OK you can find a lot of Vagrant boxes with this two url :
With this, you have a lot of boxes available by simple name (with config.vm.box) or URL (with config.vm.box_url)
Also you can find a lot of boxes built by anyone into the community with gitHub (eg : Personnal Vagrant boxes community

- 4,416
- 11
- 42
- 76
-
Thank you very much, I get it now ;) – kate Jan 26 '16 at 12:56
-
if it's good for you please vote for this response for help others with the same issue in the futur. – miltone Jan 26 '16 at 13:09
-
would like to but stackoverflow still does not allow me to vote :( need more reputation! – kate Jan 26 '16 at 13:11
You can use the :shell provisioner, providing commands inline or providing the path to your custom script.
config.vm.provision "shell", inline: "echo Hello, World"
OR
config.vm.provision "shell", path: "script.sh"
where script.sh would contain commands to install the required software packages.
For more information, look here https://www.vagrantup.com/docs/provisioning/shell.html

- 1,097
- 6
- 10