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.
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 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.
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 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:
After rebooting you can either log in Virtual Box
Or you can ssh from your host computer
[email protected]:~$ 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)
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.
[email protected] ~ $ 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
[email protected] ~ $ docker -v
Docker version 1.11.2, build bac3bae
[email protected] ~ $ uname -r
[email protected] ~ $ cat /etc/motd
CoreOS stable (1185.3.0)
[email protected] ~ $
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.