Date: 2016-10-04 Version: 1.2
Author: s1lvester@bockhacker.me
This is my short documentation on how to install RancherOS on FreeNAS.
Versions used:
- RancherOS v.0.6.1
- FreeNAS 9.10-stable
- iohyve v0.7.5 2016/04/14
Gav wrote a comprehensive blog-post about this. Find it here: Gav's Tech Blog
We're going to differ from Gav's tutorial right bevore he installs Ubuntu. So we're going to instead download RancherOS:
[root@freenas ~]$ iohyve fetch https://releases.rancher.com/os/latest/rancheros.iso
[root@freenas ~]$ iohyve renameiso rancheros.iso rancheros-v0.6.1.iso
[root@freenas ~]$ iohyve isolist
The last command is only to make sure we did everything right. So now we create and setup the guest:
[root@freenas ~]$ iohyve create rancheros 100G
[root@freenas ~]$ iohyve set rancheros loader=grub-bhyve ram=8G cpu=1 con=nmdm0 os=debian
[root@freenas ~]$ iohyve list
I'm not really sure if we're going to need os=debian or if other parameters work better. That's just what I used first and it worked. Obviously you should modify the parameters to your liking.
[root@freenas ~]$ iohyve install rancheros rancheros-v0.6.1.iso
RancherOS doesn't boot on its own, so we need to do this manually via grub-console. Attaching to the console should be done in a seperate ssh-session.
[user@freenas ~]$ sudo iohyve console rancheros
# press ENTER, you should see the grub-prompt
grub> set root=(cd0,msdos1)
grub> linux /boot/vmlinuz ro
grub> initrd /boot/initrd
grub> boot
This should get you to the login-prompt of RancherOS (login: rancher). No password is needed for login or sudo. Next we'll need to create the cloud-config.yml file to store our ssh-keys. Now see references from the RancherOS docs: here and here too
[rancher@rancher ~]$ vi cloud-config.yml
-----
# cloud-config.yml
ssh_authorized_keys:
- <your pubkey here>
CAVE: Don't forget the leading dash before your pubkey!
[rancher@rancher ~]$ sudo ros install -c cloud-config.yml -d /dev/sda
The reboot doesn't actually happen. Now quit the console via ~~.
.
Finally start RancherOS via iohyve start rancheros
and try to ssh into the
machine using ssh rancher@rancher
. If wanted/needed you can enable RancherOS
to auto-start at boottime via iohyve set rancheros boot=1
. From here on continue your adventures.
The latest version of rancher os is now 1.0.4. When I try to follow your instructions:
famewolf@freenas:/mnt/volume1/iohyve/ISO % sudo iohyve fetch https://releases.rancher.com/os/latest/rancheros.iso
Fetching https://releases.rancher.com/os/latest/rancheros.iso...
cannot create 'volume1/iohyve/ISO/rancheros.iso': dataset already exists
fetch: https://releases.rancher.com/os/latest/rancheros.iso: Authentication error
So as a workaround I downloaded the iso manually and did a sudo iohyve install rancheros ./rancheros.iso which appeared to work.
When at the grub menu and typing "set root=cd0,msdos1" it returns me to the grub command line however when I try to add the next line it tells me that cd0 does not exist. See following:
famewolf@freenas:~ % sudo iohyve create rancheros 100G
Creating rancheros...
famewolf@freenas:~ % sudo iohyve set rancheros loader=grub-bhyve ram=8G cpu=1 con=nmdm0 os=debian
Setting rancheros loader=grub-bhyve...
Setting rancheros ram=8G...
Setting rancheros cpu=1...
Setting rancheros con=nmdm0...
Setting rancheros os=debian...
famewolf@freenas:~ % iohyve list
Guest VMM? Running rcboot? Description
debvm NO NO NO Mon Feb 27 23:43:28 EST 2017
rancheros YES NO NO Tue Aug 29 14:31:35 EDT 2017
ubu1604 NO NO NO Wed Mar 1 00:10:57 EST 2017
famewolf@freenas:~ % sudo iohyve install rancheros ./rancheros-v1.0.4.iso
Installing rancheros...
GRUB Process does not run in background....
If your terminal appears to be hanging, check iohyve console rancheros in second terminal to complete GRUB process...
/usr/local/sbin/iohyve: cannot create /iohyve/rancheros/device.map: No such file or directory
/usr/local/sbin/iohyve: cannot create /iohyve/rancheros/device.map: No such file or directory
moving to 2nd window
famewolf@freenas:~ % sudo iohyve console rancheros
Password:
Starting console on rancheros...
~~. to escape console [uses cu(1) for console]
Connected
grub> set root=(cd0,msdos1)
grub> [Aisk
cd0,msdos1' not found. grub> grub> linux /boot/vmlinuz ro error: disk
cd0,msdos1' not found.grub>