Skip to content

Instantly share code, notes, and snippets.

@psammarco
Last active December 15, 2018 00:40
Show Gist options
  • Select an option

  • Save psammarco/75fa640576b1d5a29a6e8bc39e3cd27d to your computer and use it in GitHub Desktop.

Select an option

Save psammarco/75fa640576b1d5a29a6e8bc39e3cd27d to your computer and use it in GitHub Desktop.
Quick basic setup guide on linux container zones in OmniOSce illumos.
1. Install the lx package
> sudo pkg update
> sudo pkg install lx
2. Download a "container_native" rootfs from the following joynet's image repository: https://images.joyent.com/images
a. Look for the uuid of the image from the json template, for instance: {"uuid": "3dbbdcca-2eab-11e8-b925-23bf77789921"}, and add it to the download url as shown next;
b. Also note down the kernel version from the json template as it will be needed from zonecfg when setting up the zone;
> curl -o centOS7.4_container_native.zss.gz https://images.joyent.com/images/3dbbdcca-2eab-11e8-b925-23bf77789921/file
3. Create a dataset for the zone (optional)
> sudo zfs create zpool/zones/centos7-lx1
4. Create a new VNIC for the zone to use (optional)
> sudo dladm create-vnic -l e1000g0 mainsubnet0
5. Configure your new lx zone
> sudo zonecfg -z lx1
lx1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:lx1> create
zonecfg:lx1> set zonepath=/zpool/zones/centos7-lx1
zonecfg:lx1> set autoboot=true
zonecfg:lx1> set ip-type=exclusive
zonecfg:lx1> set brand=lx
zonecfg:lx1> add net
zonecfg:lx1:net> set physical=mainsubnet0
zonecfg:lx1:net> add property (name=gateway,value="172.12.0.1")
zonecfg:lx1:net> add property (name=ips,value="172.12.0.169/24")
zonecfg:lx1:net> add property (name=primary,value="true")
zonecfg:lx1:net> end
zonecfg:lx1> add attr
zonecfg:lx1:attr> set name=lxz1
zonecfg:lx1:attr> set type=string
zonecfg:lx1:attr> set value=lx1.lan
zonecfg:lx1:attr> end
zonecfg:lx1> add attr
zonecfg:lx1:attr> set name=resolvers
zonecfg:lx1:attr> set type=string
zonecfg:lx1:attr> set value=172.12.0.1
zonecfg:lx1:attr> end
zonecfg:lx1> add attr
zonecfg:lx1:attr> set name=kernel-version
zonecfg:lx1:attr> set type=string
zonecfg:lx1:attr> set value=3.10.0
zonecfg:lx1:attr> end
zonecfg:lx1> set max-lwps=2200
zonecfg:lx1> exit
6. Deploy it
> sudo zoneadm -z lx1 install -s /home/admin/centOS7.4_container_native.zss.gz
7. Boot it up
> sudo zoneadm -z lx1 boot
8. Verify
> sudo zoneadm list -v
ID NAME STATUS PATH BRAND IP
0 global running / ipkg shared
1 nfsd1 running /zpool/zones/nfsd1 ipkg excl
2 lx1 running /zpool/zones/centos7-lx1 lx excl
> sudo zlogin lx1
[Connected to zone 'lx1' pts/2]
[root@lx1 ~]# uname -a
Linux lx1 3.10.0 BrandZ virtual linux x86_64 x86_64 x86_64 GNU/Linux
[root@lx1 ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[root@lx1 ~]#
~Profit. Now go use lxadm ;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment