How to Install Coreos on Virtualbox from ISO Image

November 30, 2016 | By
| Reply More

In this article I am going to show how to install install CoreOS on VirtualBox. CoreOS is Linux distribution that is completely about containers. Idea behind CoreOS is that OS itself doesn't have any package manager, instead when some software is needed you make a container for it and install it in that container. For now CoreOS supports Docker and rkt containers, and more formats might get added in future. Installation process is pretty different that your normal Linux distribution, so in this article we will do a detailed walk-through with screenshots. First thing to do would be to download CoreOS ISO

Installing Virtual Box and making a VM

We are going to use Virtual Box imageLets first install Virtual Box

sudo apt install virtualbox

After installing VirtualBox move start it from the Ubuntu menu and create new VM.

Make CoreOS vm

You can name the VM however you want but Version should Other Linux. After that we need to set the size of memory and diskmemory

disk size

Minimum memory is 1GB but generally more is better. After making the VM, we need to go to settings and mount ISO of CoreOS on the virtual DVD drive.

mount the coreos ISO

After this have been set up you can boot the VM and you will get something like this:

CoreOS prodiction image

Preparing for the install

Before the CoreOS can be installed, we need to make some preparations. Moving to host computer, logged in as root, we need to take the public key and copy it to some place where our VM can fetch it with wget. This is needed becasuse after install, only ssh login with public key will be allowed, and not with password. My place of choice will be Dropbox, so from my Thinkpad I will copy to dropbox like this:

 cat ~/.ssh/id_rsa.pub > ~/Dropbox/cloud-config.yml

After copying it to Drobox, good idea would be to shorten the url with tinyurl, because we will need to type that url manually in CoreOS.

Back to CoreOS, we need to fetch this file with wget.

wget tinyurl.com/yoururl

Then we need to add password and create the config file

sudo openssl passwd -1 > cloud_config.yml

After this command enter your password and this password will show up in cloud_config.yml file in encrypted form. We also need to add public key to this file that we got from dropbox earlier

cat dropboxfile >> cloud_config.yml

Now we edit cloud_config.yml and there we already have two long hashes, one for password and one even longer that is public key. We would need to put rest of the context for those files there

vi cloud_config.yml

And there we need to set up the file to look like this:

#cloud-config
users:
- name: miki
passwd: yourencryptedpassword2121wdeksda
groups:
- sudo
- docker
ssh-autorized-keys:
- "ssh-rsa AAAdadasadadaxvnazxcfgaxcbzxzgzcxApublickey...."

After editing the file, we need to validate it:

coreos-cloudinit -validate --from-file cloud_config.yml

If it doesn't show any error line, means file is formatted ok and you can move to installation part

Installing CoreOS and logging with SSH to the system

When all preparations have been done, we can move to installing the CoreOS:

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

This will download and install latest sable image of CoreOS. After this is finished, unmounted the ISO of CoreOS from the drive, and reboot the VM. You would also need to set up the Bridge network on Virtual Box, like on picture bellow:

Bridge network

After rebooting you can either log in Virtual Box

coreOS first boot

Or you can ssh from your host computer

miki@ThinkPad-X220T:~$ ssh 192.168.1.6
The authenticity of host '192.168.1.6 (192.168.1.6)' can't be established.
ECDSA key fingerprint is SHA256:8g/RnlQ0Gs1XsT99jnblbfuCnNXjHHH25DevN0dmUXY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.6' (ECDSA) to the list of known hosts.
Last login: Sat Nov 26 13:58:42 UTC 2016 on tty1
CoreOS stable (1185.3.0)

miki@localhost ~ $

Like you see there is no prompt for password, the public key SSH login is working.

Run below commands to check coreos, docker and rkt version of stack.

miki@localhost ~ $ rkt version
rkt Version: 1.14.0
appc Version: 0.8.7
Go Version: go1.7.1
Go OS/Arch: linux/amd64
Features: -TPM +SDJOURNAL
miki@localhost ~ $ docker -v
Docker version 1.11.2, build bac3bae
miki@localhost ~ $ uname -r
4.7.3-coreos-r2
miki@localhost ~ $ cat /etc/motd
CoreOS stable (1185.3.0)
miki@localhost ~ $

Commands are in bold letters, first two commands are for rkt and docker version, uname -r gives you kernel version and /etc/motd is where CoreOS version is stored.

Conclusion

We have successfully installed container-only operating system called CoreOS on Virtual Box. In my case Virtual Box was running on top of Ubuntu, but you can install it anywhere where Virtual Box is running, in including macOS, Windows and Solaris. With minimum changes to procedure CoreOS can be installed on bare metal as well. Since everything in CoreOS is a container, the OS is really lightweight and scalable which makes it pretty good choice for your private cloud. That is all for this article, thank you for reading.

Filed Under : DISTROS

Tagged With : ,

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.