How to build a Colo-in-a-Box

We're going to start with a mac mini, because they're cheap, and they support ESXi 6 (For reference: VirtuallyGhetto). There are a lot of steps. Later, hopefully, some of these steps will be downloadable images either from Docker Hub, Github, or similar. Until then there are a lot of manual steps. So let's get started...

  1. Buy a Mac Mini (duh). Make sure it's at least "macmini4,1". You can find out by booting it, clicking on the Apple in the upper left corner, going to "About this Mac", clicking on "System Report...", then look at the Model Identifier.
  2. Make sure the Mac Mini has at least 4Gs of RAM. Most likely, if it only has 4Gs of RAM it doesn't have enough! It has to be 4Gs of usable space or else you'll get the error "out of safe memory" when you attempt to install ESXi.
  3. Create a USB with ESXi 6.0 of maximum revision
  4. Plug the USB stick into the Mac Mini, boot it up and hold the option key to select the boot volume. Select your ESXi USB stick.
  5. The ESX installation is straightforward. My suggestion is to install ESX onto the USB stick. This leaves the entire Mac Mini disk as usable space, and means if the hypervisor dies you don't lose any VMs. It also means that ESX is more likely to die, and will require more care and maintenance. It's up to you.
  6. The first thing to do is make your ESX server available via network. Assign it a static IP address. Make a note of this IP address. You can always get back here via monitor, but it's much easier to remember how to get here without having to drag a monitor and keyboard to wherever the Mac Mini might be stuck. If you're not planning on using IPv6, now's the time to turn it off, before you've gotten deep into the process and have VMs that you'll lose.
  7. It's time to attach to the Mac Mini! Grab a network cable and plug it either directly into your computer, or plug it into a switch that allows the same IPs that the ESX management network is on.
  8. First, browse directly to the IP address to make sure the site is active. If you're not seeing a "welcome" page, something's wrong. Make sure you're on the correct subnet, that you have access to the proper subnet, etc.
  9. I suggest to download the vSphere client for Windows while you're here. There are times when it's convenient to have available. But for now, click on the "Open the VMWare Host Client", which just appends "/ui" onto the URL.
  10. First you need to create a volume...
    1. Click on "Storage"
    2. Select "Devices"
    3. Click on "New Datastore"
    4. Enter the name for the volume, for partitioning scheme "use full disk", and click "Finish"
  11. Now click on "Storage" again, and then click on the "Datastore Browser" link.
  12. Create a new directory "ISOs".
  13. Click on "Upload" and Upload your favorite linux distro ISOs into the ISOs folder. If you think you'll need a Windows VM as well, now's the time. If you want to have virtualized Macs, since it is Mac hardware under the hood, you can upload an ISO for that as well.
  14. Now click on "Virtual Machines" on the left, and click "Create / Register VM", it's time to create your first VM
    This VM will be the "core", it will be hosting a LOT of things. PXE, DNS, and Puppet, to begin with. It'll help to have at least 8Gs of RAM in this machine.
    1. It's generally best to name the VM it's eventual domain name, and my favorite is to add a number so that if it needs to be replaced later, it's easy to do.
    2. Make sure to choose your correct O/S.
    3. Select your newly created storage volume.
    4. Select a reasonable amount of disk, CPU, and memory. Depending on your Mac Mini you may not have much available.
    5. Finish the VM
  15. Refresh your list of VMs if your new VM doesn't show.
  16. This being the first VM, we need to install it from scratch.
    1. Right click on the VM on the left and select "Edit Settings".
    2. On the CD/ROM section, select "Datastore ISO file".
    3. Select one of the ISOs that you uploaded earlier. For my purposes I'll be using CentOS 7 because it's not uncommon to find CentOS in Enterprise environments.
    4. Save your changes
  17. Start the VM. It should boot right into the ISO. Go through the linux distros normal server creation process.
  18. Once everything's installed, reboot and log in. The first thing you'll want to do is update all packages. On CentOS this will be roughly "yum update"
  19. Set the host's hostname. On CentOS, run "hostname " and update the /etc/hostname file with the same .
  20. After updating, you'll want to install some basic materials. On CentOS this will be roughly: yum install docker git vim-enhanced

Whew. Ok. We now have a single VM on an ESX server. For this to be fully-fledged, we want to be able to stand up anything quickly, easily, and however makes the most sense. To make sure we don't lose anything, we'll start with a gitolite master, create a repo, and use this to create a dockerized name server. From there we'll be setting up a PXE server to help us springboard any other VMs. All of this will occur on this one opening VM so that we squeeze as much as possible as small as possible.


Setting up a gitolite server

  • Firstly, the rough instructions are here: http://gitolite.com/gitolite/install.html
  • Start by creating your own user (if you haven't yet), since you'll be the admin, and create an ssh key for your user: ssh-keygen -t rsa -b 4096
  • Follow the quick install instructions referenced above. You may have to yum install perl-Data-Dumper (as appropriate for your platform).
  • Once done, there are a couple changes you'll probably want to make, so the first order of business is to checkout the gitolite-admin repo. If you can't, you've already gone wrong!