Tdd Apps Blog

CoreOS baremetal server installation

Jan 16, 2017 2 minute read

CoreOS is a lightweight Linux distribution designed specifically to run containers. Unfortunately its installation on baremetal servers is not as streamlined as other Linux distributions. These are the steps I took to install CoreOS on a couple of physical machines.

Prerequisites

  1. Download and burn a CoreOS ISO

  2. Generate ssh keys to log into the boxes

  3. Generate a cloud-config.yml file

     cat > cloud-config.yaml <<EOL
     #cloud-config
     ssh-authorized-keys:
         - `cat id_rsa.pub`
     EOL
    

    This cloud-config.yaml can be reused to provision multiple computers

  4. Copy the cloud-config.yaml file to a flash drive
    Additional cloud-config.yaml help

Prepare the installation

  1. Connect the computer to the LAN

  2. Boot up from the CD

  3. Wait until a command prompt appears
    More information on the CoreOS installation to disk

Copy the cloud-config.yaml into the server

  1. Plug in the flash drive with the cloud-config.yaml

  2. List the physical disks

     lsblk
    
  3. Determine what is the first partition of the USB drive. In this example we’ll use /dev/sdb1 where /dev/sdb is the physical device

  4. Copy the cloud-config.yaml

     sudo su - root
     mkdir ~/flash
     mount -o ro /dev/sdb1 ~/flash
     cp ~/flash/cloud-config.yaml ~/
     umount /dev/sdb1
     rm -Rf ~/flash
    
  5. Unplug the flash drive

Run the installation

coreos-install -d /dev/sda -c ~/cloud-config.yaml
reboot

At this point the server should boot up using DHCP. Its console will display its IP and MAC address.

Remote into the server

ssh into the box using your private RSA key

ssh -i id_rsa [email protected]

Success!

BONUS: Configure the network to use a static IP

  1. List the Network Interfaces

     ifconfig
    
  2. Determine the name of the Ethernet Adapter. In this example we’ll use eno1

  3. Execute the following commands using the appropriate values for your network

     sudo su - root
    
     cat > /etc/systemd/network/static.network <<EOL
     [Match]
     Name=eno1
    
     [Network]
     Address=192.168.1.10/24
     Gateway=192.168.1.1
     DNS=8.8.8.8
     EOL
    
     reboot
    

    More information on CoreOS network configuration

At this point the server should boot up using the new IP.