Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing CoreOS on VirtualBox
  • Download and install VirtualBox.

  • Download the CoreOS ISO

  • Create a new VM in VirtualBox

    • For the OS, Other Linux, 64-bit should be fine
    • Give the VM 1gb of memory, like your physical hardware has.
    • Create a disk of whatever size you want. I made a VMDK file that could expand dynamically up to 8gb.
  • Mount the ISO in the VM

    • Right click on the VM and click settings
    • Go to the storage tab
    • Click on the empty disk on the left
    • Click the disk icon next to IDE Secondary on the right
    • Choose the ISO
    • Check the Live CD/DVD box
    • Go to the network tab
    • Make sure NAT is selected
    • Edit the port forwarding settings and add a rule for:
      • Host IP: 127.0.0.1
      • Host Port: 22022
      • Guest IP: 10.0.2.15
      • Guest Port: 22
  • Start the VM. It should boot into CoreOS to a core@localhost prompt.

  • Run sudo fdisk -l. You should have a /dev/sda device. That's the VM's disk.

  • Upload your SSH public key to an HTTP server somewhere that the VM can access.

  • Use curl to download your SSH public key to the box.

  • Rename the file to cloud-config.yaml.

  • Edit the file with vim and make it look something like:

    #cloud-config
    ssh_authorized_keys:
      - ssh_rsa AAAAB3NzaC1...snip
  • Use coreos-install to install to the VM's disk with your keys:

    sudo coreos-install -d /dev/sda -C stable -c ~/cloud-config.yaml
  • Use VirtualBox to gracefully power off the machine.

  • Edit the VM settings again and remove the ISO from the machine.

  • Power it up again. You should end up at a login prompt.

  • SSH into the VM:

    $ ssh -p 22022 core@127.0.0.1
    Last login: Thu Apr 23 15:50:31 2015 from 192.168.59.3
    CoreOS stable (633.1.0)
    core@localhost ~ $
@karthik-sivadas

This comment has been minimized.

Copy link

karthik-sivadas commented May 19, 2016

Thanks a lot

@luanzhu

This comment has been minimized.

Copy link

luanzhu commented Jun 3, 2016

Thank you, thank you!

@edify42

This comment has been minimized.

Copy link

edify42 commented Dec 14, 2016

1GB memory is a must else it won't boot

@syscools

This comment has been minimized.

Copy link

syscools commented Jan 16, 2017

Thanks. I have installed it like this as described. Just curious, why is the CoreOS official site describe the installation procedure differently at https://coreos.com/os/docs/latest/booting-on-virtualbox.html is there a reason for such difference?

@lvidarte

This comment has been minimized.

Copy link

lvidarte commented Aug 31, 2017

Thanks

@ghost

This comment has been minimized.

Copy link

ghost commented Sep 7, 2017

thanks a lot!

@DevBadger

This comment has been minimized.

Copy link

DevBadger commented Oct 10, 2017

CoreOS ISO link hits a 404 (https://gist.github.com/noonat/coreos-iso)

@truthadjustr

This comment has been minimized.

Copy link

truthadjustr commented Nov 29, 2017

Helped me a lot. I will add some tips:

  • python -m SimpleHTTPServer or python3 -m http.server as my webserver
  • Inside the initial coreos shell, do wget http://192.168.1.69:8000/id_rsa.pub to copy the public key into coreos. Varies with your ipaddr.
  • Use 2 spaces instead of TAB to indent content in cloud-config.yaml.
  • Not sure if it was a glitz, but when i sudo coreos-install -d /dev/sda -C stable -c ~/cloud-config.yaml i encountered an error. But when i downloaded a new iso, it went fine.
@YDD9

This comment has been minimized.

Copy link

YDD9 commented Dec 26, 2017

I always have some problem after reboot.
I see coreos-install finished with success

Installing cloud-config...
Success! CoreOS Container Linux stable 1576.4.0 is intalled on /dev/sda

my cloud-config.yml has add one user as well.

#cloud-config
users:
  - name: test
    passwd: $1$POcl1vGO$z
    groups: 
      - sudo
      - docker
ssh_authorized_keys: 
  - "ssh-rsa AAAAB3Nz..."    

After remove the ISO, reboot the machine, the login prompt ask for a user and password, it's no longer user core auto login. So I type in my added user test and password, it doesn't work... Then I tried

λ ssh -i 'C:\Users\ydd9\.ssh\id_rsa' -p 22022 core@127.0.0.1
The authenticity of host '[127.0.0.1]:22022 ([127.0.0.1]:22022)' can't be established.
ECDSA key fingerprint is SHA256:cNXuzz1IINElX/fhbDA2A6Xbq5qMZlAwOWshB0MT+ds.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
Password:
Password:
Password:
core@127.0.0.1's password:

Any helps ? I didn't set password for core, I want to use SSH only as in my cloud-config.yml

@tabascoterrier

This comment has been minimized.

Copy link

tabascoterrier commented Mar 14, 2018

@YDD9 - it looks like things have changed a bit:

Create an ignition.json file instead of the config.yaml

{
  "ignition": {
    "config": {},
    "timeouts": {},
    "version": "2.1.0"
  },
  "networkd": {},
  "passwd": {
    "users": [
      {
        "name": "core",
        "sshAuthorizedKeys": [
          "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGdByTgSVHq......."
        ]
      }
    ]
  },
  "storage": {},
  "systemd": {}
}

And install via coreos-install -d /dev/sda -C stable -i ignition.json

Ref: https://coreos.com/os/docs/latest/installing-to-disk.html

@anttilinno

This comment has been minimized.

Copy link

anttilinno commented Mar 22, 2018

As link to iso is not working, got one from coreos official. Downloaded beta 1688.3.0. It does not boot with 1GB. The official documentation also mentions, that minimum is 2GB. Changed to 2GB and it booted :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.