Installing CoreOS

      2 Comments on Installing CoreOS

If you haven’t heard of CoreOS it’s pretty much a minimal Linux distro designed and optimized to run docker.  On top of that, it has some pretty cool services pre-installed that make clustering CoreOS pretty slick.  Before we go that far, let’s start with a simple system installation and get one CoreOS host online.  In future posts, we’ll bring up more hosts and talk about clustering. 

The easiest way to install CoreOS is to use the ‘coreos-install’ script which essentially downloads the image and copies it bit for bit onto the disk of your choosing.  The only real requirement here is that you can’t install to a disk you’re currently booted off of.  To make this simple, I used a ArchLinux lightweight bootable Linux distro.  So let’s download that ISO and get started…

Note: I use a mix of CoreOS VMs and physical servers in my lab.  In this walkthrough I’ll be doing the install on a VM to make screenshots easier.  The only real difference between the install on either side was how I booted the ArchLinux LiveCD.  On the virtual side I just mounted the ISO and booted it.  On the physical side, I had to make a bootable USB drive and boot the server with it.  After several failed attempts at booting off of USB I finally found the USBwriter tool ( which successfully wrote the ISO to USB and allowed me to boot into ArchLinux.  After that was fixed, the install process was identical.

As I mentioned I chose to use the ArchLinux distro which is available here…

Specifically, I used archlinux-2014.06.01-dual.iso but I don’t think it really matters which one you use.  We just need to be able to get to a Linux prompt and have network access.

Let’s get that booted up and make sure we can download the CoreOS install script…


Looks good!  We were able to download the install script.  At this point, we could run the install and reboot with a CoreOS image.  However, you can’t locally log into a CoreOS system.  So we need to provide a little bit of configuration to our CoreOS install script to make sure we can login through SSH.  This is done through what CoreOS refers to as a ‘cloud-config’.  In later posts we’ll add quite a bit more to the cloud-config, but for now, let’s just start with this…


The cloud-config file is written in YAML.  In this example, all we are really doing is providing a hostname and setting a couple of pubic SSH keys.  I struggled initially with the cloud-config syntax and then found out that they have a validator tool that can check your config before you try and use it.  Its located at…

As I mentioned earlier, you can’t log directly into the console of a CoreOS host.  You need to SSH in and even then you need to login by doing certificate authentication.  If you aren’t comfortable with how that works, see this post I wrote about it the other day…

So now that we have the cloud-config, lets get it over to the host…


I put the cloud-config file on a local web server and then just used wget to get it over to the host we’re building.  The next step is to run the installer.  We need to pass a couple of variables to the installer.  Namely, the device we want to install CoreOS on, which version of CoreOS to use, and where the cloud-config file is.  Let’s first check and see what drives we have available…


On this host the drive we want to use is ‘/dev/sda’.  Now let’s run the install command…


Here we pass the ‘-d’ flag to specify the device, the ‘-C’ flag to tell it down the latest stable release, and the ‘-c’ flag to specify the cloud-config file to use.  The server will download the CoreOS code and then begin imaging.  In my experience this entire process takes less than 4 minutes.  When done, you should see a success message at the bottom of the screen…


Now just reboot the host and we should be in CoreOS land!


After booting the console should tell you the IP address of the host.  Note that since we didn’t specify an IP, the CoreOS system will just use DHCP to get one off of the local LAN segment.  At this point, we should be able to SSH to the server.  Let’s try…


The client prompts you to add the RSA fingerprint to the local store and then I get prompted for my local private key’s passphrase that I had set when I generated the certificate.  If you didn’t set a passphrase you wouldn’t see this step.

So now we’re in!  Like I mentioned earlier, CoreOS is built to run Docker, so you’ll notice that it’s already installed…


To make sure things are working as expected, let’s try pulling down and spinning up a Docker container from a public repo…


Now that it’s downloaded, let’s kick off a container and map port 9000 on the CoreOS host to port 90 on the container…


We can see the container running so let’s see if it worked…


Sure enough!  So in this post we got a single CoreOS host up and running and made sure docker worked as expected.  In the next post we’ll talk more about working with the multiple CoreOS hosts and additional cloud-configuration options.

2 thoughts on “Installing CoreOS

  1. Fernando Oliveira

    Thank you very much, it is this kind of first step the most precious. It worked as posted.
    I have used a static network address at the cloud-config.yml file, it may be of use to readers
    of course enp0s25 is the network device name, one must change to the hardware’s

    – name:
    contents: |



Leave a Reply

Your email address will not be published. Required fields are marked *