How to perform a bare metal installation of CoreOS Linux

This article will describe how to load a CoreOs Linux on a bare metal server. There are more ways on how to get CoreOS Linux installed on your machine. In this article we will first boot some Live Linux distro eg. Fedora from USB or CDROM and then use CoreOS’s installation script to perform the actual CoreOS Linux on a given hard drive. What you will need:

  • Internet connection
  • USB stick

Bootable Media Preparation

First, we need to create a bootable media with Live Linux distribution such as USB stick. This simple procedure is described in guide How to create a Fedora Linux Live bootable USB key . Please note that any Live Linux distro will be good for this job so if you have Ubuntu or Knoppix CD or USB ready you can skip this step at completely. If your target computer is unable to boot from USB simply use CD-ROM to boot.

Boot to Live Linux

Now we are ready to put our bootable Live Linux media into the test. Change your BIOS if needed, boot your LIve Linux distro and open a terminal.

CoreOS preparation before installation

At this stage we first need to download a CoreOS installation script:

[root@localhost liveuser]# wget https://raw.githubusercontent.com/coreos/init/master/bin/coreos-install

Next, we need to prepare our cloud-config.yaml cofing file which will be used to modify a default CoreOS installation process. At the very least minimum the cloud-config.yaml should contain a ssh-rsa from of the machine you will use to connect to your new CoreOS server after a first reboot. The CoreOS installer does not create any passwords nor will ask you for a username and password during the installation. it is important to get this step right otherwise you will not be able to SSH login once the CoreOS installation is completed. First, locate your ssh-rsa key. Normally, you should be able to find at this location:

$ ls ~/.ssh/id_rsa.pub

Once you have the key move it across to you target box using SSH, USB etc. and place it into a cloud-config.yaml file using a following format:

#cloud-config
ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAA  ........ tester@localhost.localdomain

The cloud-config file allows for more configuration options so feel free to include more if required. The default user created will be named core.

CoreOS installation

Now, we are ready to perform the actual CoreOS installation. Our target installation block device is /dev/sda. Make sure that you are connected to the Internet and start the installation:

[root@localhost liveuser]# chmod +x coreos-install 
[root@localhost liveuser]# ./coreos-install -d /dev/sda -c cloud-config.yaml -C stable

The above coreos-install command will download CoreOS and preconfigure our installation based on the cloud-config.yaml config file.
After a successful installation you should see a message similar to the one below:

...
Installing cloud-config...
Success! CoreOS stable current is installed on /dev/sda

Reboot your computer as it should boot directly to CoreOS.

Login to CoreOS using SSH

If all went well we would now should be able to login to our fresh CoreOS installation box using SSH from the client computer we used its ssh-rsa to include into cloud-config.yaml config file used during the CoreOS installation as user core. Fro example:

$ ssh core@coreoshost

coreos ssh login after instalation