Skip to content

Instantly share code, notes, and snippets.

@DaffyDuke
Forked from s1lvester/rancheros_on_freenas.md
Last active January 11, 2020 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaffyDuke/902186658adb40e035f12ae35ffcab8a to your computer and use it in GitHub Desktop.
Save DaffyDuke/902186658adb40e035f12ae35ffcab8a to your computer and use it in GitHub Desktop.
Installing RancherOS on FreeNAS using iohyve

RancherOS on FreeNAS

Inspired by : 
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

Setup iohyve

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

Setup tunables

As described on roonlabs, set them in GUI.

ng_ther_load=“YES”
iohyve_enable="YES"
iohyve_flags="kmod=1 net=em0"

Preparing bhyve (iohyve) guest

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.

Installing RancherOS

[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment