-1

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.

kate
  • 1,769
  • 1
  • 11
  • 10

2 Answers2

1

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

miltone
  • 4,416
  • 11
  • 42
  • 76
0

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

greenhorn
  • 1,097
  • 6
  • 10