Get started with CoreOS and VirtualBox

12 Nov 2015

Managing and scaling infrastructure is one of the biggest Enterprise concerns all over the world. The new wave of containerization led by Docker has made things a little easier. Applications can now be deployed on almost any system. You just need the appropriate Dockerfile and Docker installation.

But what if you have hundreds of containers and you need to scale them frequently? CoreOS helps you address this. Designed for security, consistency, and reliability, CoreOS is a Linux based operating system for clusters.

It is important to mention here that CoreOS doesn’t ship a package manager. Rather, it comes with Docker pre-installed and CoreOS lets you use containers to manage your services instead of installing packages. So, for every service that you need (e.g. web server, database, cache, and so on) just create and use a container. CoreOS uses systemd and fleet to manage the containers and connects the containers together using etcd.

CoreOS is supported on almost any platform. That includes bare metal cloud providers like Amazon EC2, Azure, DigitalOcean, and Google Compute Engine. It also includes virtualization platforms like VMware, VirtualBox, and even cloud based operating systems like OpenStack.

In this post we will focus on installing CoreOS on your laptop (using VirtualBox) and we’ll learn some CoreOS basics while we’re at it. We’ll look at systemd, fleet, and etcd in future posts.



One of the most well known virtualization tools, VirtualBox lets you install different operating systems on top of your current operating system. We will use VirtualBox to install CoreOS. If you don’t have it installed already, download it from Virtualbox official website and follow the installation instructions.

CoreOS ISO File

Download the CoreOS ISO file. We need it to mount on VirtualBox.

Cloud-Config File

The cloud-config file provides a way to customize various OS level items like user accounts, network configurations, systemd services, and so on. This file is processed every time the system boots up. We’ll use this file to create the username and password during CoreOS installation. Note that the cloud-config file can only be created once we have live CoreOS running. So, we will create it during the installation process.


Follow these steps to install CoreOS on a VirtualBox virtual machine.

Create CoreOS virtual machine

Start VirtualBox on your local system.

"new virtualbox machine"

Click the New button to create a new virtual machine. Select the type as Linux and the version as "Linux 2.6 / 3.x (64 Bit)".

"set virtualbox memory"

On the next page, set the memory size as 2 GB. Then set the hard drive file type as VDI (Virtual Disk Image) and the storage on physical hard drive as dynamically allocated.

Finally, hit the Create button. This creates a virtual machine with the specifications we set.

Mount ISO

Next step is to mount the CoreOS ISO image we have.

Right click on the CoreOS virtual machine on the left hand panel of VirtualBox and select settings. Then click on the Storage tab, and associate the CoreOS ISO file to the IDE controller. Then boot up the CoreOS virtual machine.

You should see something like this:

"coreos running"

This means, right now, we have the live version of CoreOS running on VirtualBox, with the default core user logged in.

There are two important things to note here.

Firstly, we still haven’t installed the CoreOS standalone version. What we have now is similar to a live CD of the OS running.

Secondly, we haven’t still created a user to login to the OS. The core user automatically logs in for the first time, but you must create a user to login when CoreOS boots up the next time.

So, let’s first create a user account and password, using the cloud-config file.

Create Cloud-Config File

The cloud-config file uses YAML. We need follow the file format to make sure CoreOS recognizes and processes the file.

Our first step is creating the header. It should either be #cloud-config (for processing as cloud-config file) or #! (for processing as shell script).

The header should be followed by an associative array with zero or more of the following keys: coreos, ssh_authorized_keys, hostname, users, write_files, and manage_etc_hosts.

We’ll focus on the users entry for now.

The users entry has three sub-fields: name, passwd and groups.

These fields are self-explanatory, except for one catch: the passwd field holds the password hash and not the actual password. This is good for security, but adds another step for creating the cloud-config file.

You need to create the hash manually, and add it to the cloud-config file.

One option is to use the openssl utility (available with CoreOS) to create the hash.

Just run:

sudo openssl passwd -1

The system prompts you for password and then asks to verify it. Once done successfully, you get the hash for your password. You can then add this hash to the cloud-config file.

With all the entries properly added to the cloud-config file, it should look like this:

$ cat cloud_config.yml
- name: nitish
  passwd: $1$yxV9YDKT$s.fAj5dlFyrPwrH0xAQJy/
  - sudo
  - docker

You can even use above text as the cloud-config for your set-up. Just remember to change the passwd field to a value that corresponds with your password.

We are now ready to install CoreOS.

Install CoreOS

The final installation step is to download and install the CoreOS image on your VirtualBox.

To do this, run:

sudo coreos-install -d /dev/sda -C stable -c cloud_config.yml

This will download and install the latest stable CoreOS release on your virtual machine.

It should look a bit like this:

"coreos update"

The success message at the end confirms the CoreOS installation.

Cross Check the Installation

Unmount the ISO image from the IDE controller and reboot the virtual machine. If everything’s right, the virtual machine should reboot and you should be able to login using the username and password set in the cloud-config file.


CoreOS offers a new approach towards packaging and deployment of software: everything is a container. Not only does this make the OS relatively lightweight, it makes it easy to deploy and scale in the cloud.

In this article we learnt how to install CoreOS on a virtual machine. Though the official minimum cluster size is 3 nodes, we installed it on one virtual machine so you can learn the CoreOS basics.

Along with the installation process, we also covered the basics of the cloud-config file, and how it can be used to configure core functionality like users, networking, and so on.

In future articles we’ll take a look at how to deploy your software on CoreOS using Docker and CoreOS features like systemd, fleet, and etcd.

Posted in CoreOS, VirtualBox

triangle square circle

Did you enjoy this post?