[Task time 2 hours]

Use Atlas, a recently released product of Hashicorp, to host virtualbox images. I already created an account, which was easy and free. I’ve also created my first box “abrooke/centos-7” from the web GUI at atlas. However, I need to now create a “box” for vagrant to upload it after configuring a “virtualbox” provider in my new box’s configuration in Atlas and that is where the blog post is picking up the story…

  1. Download a minimal ISO from centos.
  2. Create a new VirtualBox VM and use the ISO to install centos.
    • Use “Nat” for the first network adapter.
    • Note the MAC address for later.
    • The minimal install doesn’t come with dhclient running, so no IP. So addition setup instructions:
      1. List the interfaces with “nmcli d”
      2. Set the disconnected interface to automatically connect with “nmtui”
      3. Then finally restart the network “systemctl restart network”
  3. Then follow the instructions for createing a base box and Virtual Box specifics:
    • Set root password to “vagrant”
    • Add “vagrant” user using command: “adduser vagrant”
    • Set “vagrant” password to “vagrant” using command: “passwd vagrant”
    • Give “vagrant” user sudo permissions:
      1. Run “visudo”
      2. Add to the file “vagrant ALL=(ALL) NOPASSWD: ALL”
      3. Remove “requiretty” so that sudo can run without a tty.
    • Add insecure key to authorized_keys file of the vagrant user.
      1. Install wget as root: “yum install wget”
      2. Wget the public key from vagrant on github and put it in the “authorized_keys” file of the “vagrant” user in the “~/.ssh/” directory.
      3. Set modes for ssh files:
        1. “chmod 600 ~/.ssh/authorized_keys”
        2. “chmod 700 ~/.ssh”
    • Install Virtual Box guest additions:
      1. REQUIRES bzip2, kernel-devel, kernel-headers, gcc:
        1. “yum install bzip2”
        2. “yum install kernel-devel-$(uname -r)”
        3. “yum install kernel-headers-$(uname -r)”
        4. “yum install gcc”
      2. Troubleshooting: you might need to reboot.
        1. Mount the Virtualbox guest additions:
        2. Make sure the virtual cd with the additions is loaded.
        3. Make mount point “/media/cdrom”
        4. Now mount the “mount /dev/cdrom /media/cdrom”
    • Set “UseDNS no” in the “/etc/ssh/sshd_config” to speed up the box when not connected to the internet.
  4. HACK Vagrant version 1.7.1 to actually package the Vagrant Box:
    • Modify “/opt/vagrant/embedded/gems/gems/vagrant-1.7.1/lib/vagrant/machine.rb”
      • Remove “**” from line 153, next to “opts”
  5. Package box in current working directory with “vagrant package –base [name of VM]”.

After the Vagrant box has been created, the testing of the box can be done by loading it into vagrant’s box list using: “vagrant add box [box name] [box path from package process]

After testing the box, the box can be uploaded to Atlas. Then subsequently a “Vagrantfile” can be configured to use it. Then “vagrant up” will use the “Vagrantfile” and download the box from Atlas. If the box is private in Atlas, then “vagrant login” will be necessary.

Run Docker Without Sudo

Update the /etc/docker/daemon.json as follow (will require root priveleges):``` json title:"/etc/docker/daemon.json"{"live-restore": tru...… Continue reading

Vagrantfile Modifications

Published on October 13, 2018

Add GUI to Dev VM

Published on October 13, 2018