Inspired by :
Date: 2016-10-04 Version: 1.2
Author: [email protected]
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
As described on iohyve issue 228
[root@freenas ~]$ ln -s /mnt/iohyve /iohyve
As described on roonlabs, set them in GUI.
ng_ther_load=“YES”
iohyve_enable="YES"
iohyve_flags="kmod=1 net=em0"
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-v1.5.5-rc2.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=3G cpu=1 con=nmdm0 kmod=1 net=bge0 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-v1.5.5-rc2.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-4.14.138-rancher ro rancher.password=rancher
grub> initrd /boot/initrd-v1.5.5-rc2
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
[user@freenas ~]$ sudo ros config set rancher.network.dns.nameservers "['8.8.8.8','8.8.4.4']"
[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.
Now, you can change console to ubuntu console (tips, remind logout is ~.)
[user@freenas ~]$ sudo ros console switch ubuntu
And merge yaml to sysctl params as says Rancher Documentation Let's play to install FlexTV
[rancher@rancher ~]$ docker create \
--name=flextv \
-e PUID=1101 \
-e PGID=1101 \
-e TZ=Europe/Paris \
-p 80:80 \
-v /home/docker/flextv/config:/config \
--restart unless-stopped \
digitalhigh/flextv