In this article I am going to show how to install CoreOS on VirtualBox. CoreOS is Linux distribution that is completely about containers. The 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. The installation process is pretty different that your normal Linux distribution, so in this article we will do a detailed walk-through with screenshots. The first thing to do would be to download CoreOS ISO
Installing Virtual Box and making a VM
We are going to use Virtual Box image. Lets first install Virtual Box
sudo apt install virtualbox
After installing VirtualBox move start it from the Ubuntu menu and create new 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 disk
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.
After this have been set up you can boot the VM and you will get something like this:
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 because 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 Dropbox, 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.
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
And there we need to set up the file to look like this:
- name: miki
- "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 the 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 stable 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 below:
After rebooting you can either log in Virtual Box
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
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.
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.