Intel Clear Linux, like its namesake, is a distro of Linux developed by Intel Open Source designed for the hardware virtualization (Intel VT) features present on modern Intel CPUs. It’s a lightweight distribution, designed to boot-up quickly that requires only a minimum of 128 MB RAM. Performance benchmarks show that Clear Linux’s optimized kernel is faster than a general purpose distribution in many areas, especially graphics and data processing.
Intel Core processors, 2nd generation or newer, the E3, E5, E7 Xeon series, and certain Atom processors aimed at the data center market are listed as Intel recommended hardware for Clear Linux. Actually, any processor with VT-x down to the Pentium processor you might find in your homelab will be able to take advantage of the OS’ optimizations, with a performance edge over Ubuntu no less.
Clear Linux vs. Ubuntu, or other Linux distros
There are a few ways how Clear Linux differs from a standard Linux distribution. Instead of packages, installable binaries are distributed as bundles. You won’t find a standard package manager, such as apt or yum, at all.
Bundles are labelled with the Clear Linux build they run on, instead of the application version number. Administrators can be certain that a fleet of machines on the same Clear Linux build are running the same app versions. In other words, to update the software on a Clear Linux machine, you must also update the operating system.
Clear Linux uses Intel VT features to accelerate the spin-up of KVM instances, and supports a container runtime known as Intel Clear Containers. With Intel Clear Containers, each Docker container runs inside its own VM, providing strong security isolation from the host machine, while leveraging kernel features to sidestep the usual performance tradeoffs of a VM. With the optimized QEMU hypervisor, VMs spin up almost as quickly as a standalone container. This whitepaper discusses the underlying technology in detail.
Applications of Clear Linux in the Data Center
Since most data centers run on Intel hardware, Clear Linux has huge potential as a bare metal and/or container hypervisor for today’s cloud-based workloads. There are also optimized builds of Clear Linux designed as a guest OS for KVM or Hyper-V based hypervisors. If you want to use Clear Linux as the base image for your Docker container, you can have it that way too; clearlinux is an official image on the Docker Hub.
Although marketed much less than CoreOS Container Linux or RancherOS, Clear Linux is an interesting challenger against those container-focused distributions. With the engineering muscle of Intel behind it, the Clear Linux community can optimize against the features of the latest 4.x kernels and hardware-specific features of Intel processors to achieve high performance.
Try Clear Linux on your Laptop with VirtualBox
The easiest way to get hands-on with Clear Linux is by running it as a virtual machine on your workstation. In this walkthrough we’ll convert the Clear Linux live image into a VDI drive image for VirtualBox, although you could use VMware Player as well.
Note that the VirtualBox virtual machine isn’t designed for production use, with only 5 GB of disk space and no support for nested virtualization, but it’s a great way to familiarize yourself with Clear Linux.
1. Download the current live image named clear-XXXXX-live.img.xz from the official repository, where XXXXX is the build number.
3. Open a terminal where you extracted the .img file and run the following VirtualBox command:
VBoxManage convertfromraw --format VDI [filename].img [filename].vdi
4. Launch VirtualBox and create a New Virtual Machine.
Name: Clear Linux
Version: Linux 2.x / 3.x / 4.x (64-bit)
5. Proceed with the default amounts of RAM (1024 MB), select “Use an existing virtual disk file” and browse to the .vdi file you converted earlier.
6. Open the VM Settings, and check “Enable EFI” under System > Extended Features.
7. Boot up the VM and login as root. You’ll be prompted to create a root password.
8. Install the kernel-lts bundle, a 4.9 kernel that supports VirtualBox kernel modules. Each time you boot, you’ll be presented with a GRUB menu where you should select the 4.9 kernel entry.
swupd bundle-add kernel-lts
clr-boot-manager set-timeout 10
9. Install VirtualBox guest additions. Select “Insert Guest Additions CD Image” from the Devices drop-down menu in VirtualBox, then run the following command (still as root).
Install a Desktop Environment
By default, Clear Linux ships headless, that is without a GUI to keep it lightweight. That being said, you can install a desktop environment based on XFCE. Simply execute the following command:
swupd bundle-add os-utils-gui
To start the X window environment, type
startx at the prompt when you boot up.
Install support for Docker containers
Next, you’ll probably want to install support for Docker containers in Clear Linux. Because VirtualBox does not support virtualizing VT-x, unfortunately, you can’t try Intel Clear Containers with this Virtual Machine. You can however, run containers using the standard Docker runc runtime which will be installed as a fallback because Clear Linux cannot detect the host’s VT-x extensions.
swupd bundle-add containers-basic
A good practice is to create a non-root user to execute Docker commands from, and add it to the docker user group so you don’t need to type sudo each time. You can also add this user to the wheel (sudoers) group so it can run privileged commands if needed.
useradd -m exampleuser
usermod -aG docker exampleuser
usermod -aG wheel exampleuser
Now you can login as this user instead of root on startup. Try running a Docker container!
docker run docker/whalesay cowsay boo
In the output of the
docker version command, you can check that Clear Linux ships with a relatively recent version of Docker; In our case, on Clear Linux Build 18670 it was 17.05.0-ce.
Client: Version: 17.05.0-ce API version: 1.29 Go version: go1.9 Git commit: 7392c3b0ce0f9d3e918a321c66668c5d1ef4f689 Built: Mon Oct 2 08:52:46 2017 OS/Arch: linux/amd64 Server: Version: 17.05.0-ce API version: 1.29 (minimum version 1.12) Go version: go1.9 Git commit: 7392c3b0ce0f9d3e918a321c66668c5d1ef4f689 Built: Mon Oct 2 08:52:46 2017 OS/Arch: linux/amd64 Experimental: false