Skip to content

Templates for Packer.io to build CentOS Vagrant base boxes, taken from Chef/Bento project to preserve 'obsolete' versions for posterity.

License

Notifications You must be signed in to change notification settings

grtjn/centos-packer-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

centos-packer-templates

Templates for Packer.io to build CentOS Vagrant base boxes, taken from Chef/Bento project to preserve 'obsolete' versions for posterity.

Full credits for the templates, and base boxes go to https://github.com/chef/bento.

Background

Vagrant is a very convenient way of creating and managing VMs. I was depending on chef/centos base boxes for my mlvagrant project (related to my work for MarkLogic). In August 2015 they were taken down, because the Chef organisation decided to stop publishing older versions, and moved from chef/ to bento/. The bento boxes include only latest release of each major version of the OS types they support (quite a lot of them). This was inconvenient for my mlvagrant project, and for anyone else that was depending on those base boxes. Next to this, I think it makes sense to preserve the older versions, to be able to run tests against old kernels as well.

Luckely all the good work for Bento is on github (https://github.com/chef/bento), and you can rebuild the VM images from the packer templates published in that project. I took the liberty to copy them (focussing on centos 64-bit), and also searched git history to pull up a number of the 'obsolete' versions of the CentOS templates.

Building yourself

You will need to install Packer.io. If you are running MacOS with Homebrew you can run this:

After that, grab the templates from this project, and run packer with a command like this:

  • packer build -only=virtualbox-iso centos-6.7-x86_64.json

Or you could leverage the bento project (git clone https://github.com/chef/bento.git) itself:

This will take a while. It will help using a mirror that is near to you:

http://isoredirect.centos.org/centos/6/isos/x86_64/

Recovering from local vagrant cache

In the end I didn't need to rebuild them at all. Instead I was able to take them from my local Vagrant cache. That is actually pretty simple. It comes down to taking these few steps for each basebox:

  • vagrant init bento/centos-6.5

  • add these lines to the Vagrantfile:

      if Vagrant.has_plugin?("vagrant-vbguest")
          config.vbguest.no_install = true
      end
      
      config.vm.provider :virtualbox do |vb|
          vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
          vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
          # to make sure ssh won't timeout because of a regression in VBox
          vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
          vb.customize ["modifyvm", :id, "--cableconnected2", "on"]
      end
    
  • vagrant up --provider virtualbox

  • vagrant package --output 1.0.0/virtualbox/packer-centos-6.5-x86_64-disk1.box

  • vagrant destroy

Once you have .box files, you can upload these to vagrantup cloud (previously atlas.hashicorp.com) with following steps:

  • Login or Sign up at https://app.vagrantup.com/account/new (previously https://atlas.hashicorp.com/account/new)
  • Click "Create a Vagrant Box with the Web UI"
  • Pick a name for the box, check the private flag, and create new box
  • Create new version
  • Create new provider
  • Select 'virtualbox' (or whatever is appropriate)
  • And upload the .box file that you just created
  • Once uploaded go back to the version page
  • Edit version details, and click Release version there
  • You can then test the box with vagrant using:
    • vagrant login
    • vagrant init {login/boxname}
    • vagrant up --provider virtualbox

Available baseboxes

I republished the 4 Chef baseboxes I was using myself (only virtualbox unfortunately) on hashicorp.com for posterity, and have include newer bento boxes there as well:

https://app.vagrantup.com/grtjn (previously https://atlas.hashicorp.com/grtjn):

  • grtjn/centos-5.11 (bento 2.2.0)
  • grtjn/centos-6.5 (chef 1.0.0)
  • grtjn/centos-6.6 (chef 1.0.0)
  • grtjn/centos-6.7 (bento 2.2.0)
  • grtjn/centos-6.8 (bento 2.3.0)
  • grtjn/centos-6.9 (bento 2.3.5)
  • grtjn/centos-7.0 (chef 1.0.0)
  • grtjn/centos-7.1 (chef 1.0.0/bento 2.2.0)
  • grtjn/centos-7.2 (bento 2.3.0)
  • grtjn/centos-7.3 (bento 201708.22.0)
  • grtjn/centos-7.4 (bento 201803.24.0)

About

Templates for Packer.io to build CentOS Vagrant base boxes, taken from Chef/Bento project to preserve 'obsolete' versions for posterity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published