Building a Linux Desktop for Cloud Native Development

This post covers the building of my Linux Desktop PC for Cloud Native Development. I'll be covering everything from parts, to peripherals, to CLIs, to SaaS software with as many links and snippets as I can manage. I hope that you enjoy reading about my experience, learn something, and possibly go on to build your own Linux Desktop.

My primary use-case is for client work and development of open-source software as part of my business OpenFaaS Ltd. My work mainly covers talking with clients and community members over Zoom, working in an IDE (VSCode) with languages like Java, Go, Python and JavaScript. I also build infrastructure software for Kubernetes and cloud - tasks like testing Kubernetes controllers and building container images with Docker.

Business cards in 2020?

See also: Joining the CNCF Ambassadors

I needed the system to be fast, efficient, quiet and most importantly fit for purpose. The aim of this post is not to convince the world that Linux is the only system that a developer may need, most folks will prefer a Mac for general purpose computing.

The whole package

If you already have a Linux system, or a laptop running Linux, then you can skip over the "build" section and move onto the tools and workflow section.

It's a Linux system, I know this

I've always felt that using a Linux desktop and system gave me a faster response time than my Mac when opening a terminal, compiling a binary, or just navigating webpages. It could be entirely subjective, but if the placebo cures the lag of my Mac, then why not?

One of my primary use-cases is building code that is destined to run not on a Mac, but on a Linux host in the cloud. With the rise of cloud, microservices and serverless, who isn't shipping their applications to a Linux host somewhere?

compare-2

My Intel NUC Hades Canyon running silently as I edit this blog post. 2018 Mac Mini for scale.

It turns out that Kubernetes Go controllers are huge binaries, so large that the Go team had to add special extensions to the toolchain. In my experience cross-compiling a Go controller from a Mac to a Linux binary takes much longer and hurts the fast inner-loop that we crave as developers. If you take that one step further, and containerise the build with Docker for Mac, you're now having to run a much smaller Linux VM - perhaps with 1GB RAM and 2 CPU cores, which is going to adversely affect productivity.

Picking a Linux distribution

Just like comparing MacOS to a Linux OS, something designed for tha masses, but easy to get started with, picking a Linux distribution brings up similar tradeoffs. I am not quite of the opinion that all packages need to be built from source, so Gentoo is too hardcore for me. Arch Linux finds a nice balance for me, of having a fast system that can be finely-tuned to the absolute minimum of packages, but runs a rolling update. If something doesn't work out of the box, it could take days, if not weeks of investment to fix time. Over the years it's taken some convincing, but I'm now happy to recommend the LTS version of Ubuntu. It seems to largely just work and can be installed and reinstalled at great speed. Some folks may also enjoy CentOS and Fedora, but for various reasons the Ubuntu / Debian lineage aligns better for my usage.

Ubuntu offers a relatively small ISO download that can be flashed to a USB stick and installed onto a new system in a short period of time. I'm not sure when it was added, but the new "install a minimal system" option worked very well.

Failed attempts

Before deciding on the Intel NUC Skull Canyon, I did have a couple of false-starts.

First off, I bought something like this from eBay, as a "new old stock", with a 8th or 9th generation i5 CPU. I liked the form-factor and was quite pleased with using a 5th generation i5 NUC headless for a build server.

It had two cores, 16GB of RAM and a fast 120GB m.2 SSD, but had numerous issues. Ubuntu wouldn't boot if a USB device was plugged in, and the integrated graphics seemed to choke and lag when even doing modest scrolling. Since I couldn't return the hardware, I changed it over to a headless host which runs a Kubernetes cluster 24/7 for fast testing within my local network.

Intel BXNUC10i7FNK Core i7-10710U 6-Core NUC Mini PC (Slim Version)

This 6-core 10th gen NUC may provide a better experience than I had given that it has newer firmware and a 6 cores vs the 2 of the i5 I bought.

The second failed attempt was to "do things properly" and to buy a mini-PC from Lenovo. I was attracted to the AMD Ryzen range and knew that the CPU offered great value for money.

I bought the Lenovo ThinkCentre M715 Tiny M715q AMD Ryzen 5 Pro 2400GE but kitted out the RAM to 32GB and added a bigger NVMe.

Whilst the device did have a high upper clock-speed, its fans span-up for whatever I did, whether that was opening a Terminal window, or just opening a new tab in Chrome. It wasn't that the system was being stressed, it was just more than I could cope with to hear the CPU fan being PVM'd up and down over and over all day. Fortunately Lenovo facilitated a return, and I found from reading reviews on Amazon, that the Intel version of the mini-PC may be better at cooling.

The parts-list

Let's cover the hardware.

Given my poor experience with the integrated graphics in the cheapest version of the NUC, I had my eyes set on the Hades Canyon range. There were two versions on offer - one suited to Gaming (NUC8i7HNK) and one for VR (NUC8i7HVK), but with AMD graphics.

I went for the cheaper NUC8i7HNK model, which was around 150-200 USD less, one of the reasons was the lower power requirements.

You can get a pre-built version from Amazon, or shop around.

Intel NUC 8 VR NUC8I7HVK Gaming Mini PC - 8th Gen Intel Quad-Core i7-8809G Processor up to 4.20 GHz, 32GB DDR4 Memory, 512GB NVMe Solid State Drive, AMD Radeon RX Vega M GH Graphics, Windows 10 Pro

The great thing about building with the Intel Hades Canyon, is that we're basically done. We don't have to worry about picking a motherboard, an energy-efficient PSU, or what kind of graphics card to buy. Intel has made all those decisions already and we just have to pick the "fast" or "faster" model of NUC, then add RAM and storage.

The Intel NUC kit comes with an allen key to unscrew 6 individual keys on the top plate, once open, a small flat ribbon connector needs to be unplugged, and a Phillips screw undone. Then you can simply slot in any supported configuration of RAM and storage.

I also upgraded my Mac Mini 2018 model to 32GB of RAM and the experience was terrifying in comparison and involved buying 50 USD worth of tools.

I bought this system purely for business purposes for use with my ongoing client and OSS work. If you are self-employed, or have a business, you could look into whether a system like this is partially deductible against income tax. Check with your accountant.

Installation and first boot

I also own the previous generation Intel Hades Canyon, which is much smaller and slimmer in comparison. It was good to see the cooling reworked for this version. The first thing I did was to head into the BIOS with F2 and find the "quiet" CPU cooling setting. You may notice louder than expected CPU noise, but rather than the whine of a cheap CPU cooler, we hear a steady blow of hot air out of the generous rear vents.

SanDisk 32GB Ultra Fit USB 3.1 Low-Profile Flash Drive (2 Pack Bundle) SDCZ430-032G-G46 Pen Drive with (1) Everything But Stromboli (TM) Lanyard

I downloaded Ubuntu Desktop 18.04.3 LTS and flashed it to a small USB pen-drive.

On my first attempt of installing Ubuntu, with an earlier kernel, I couldn't get into the installer due to issues with the AMD graphics driver. The work-around was lengthy and frustrating, and meant I put off finishing the built. The good news is that the 5.x Kernel which is now included has full support for the AMD graphics.

The trick I got to get into the installer was to hit ESC on the Grub menu, and then add nomodeset to the end of the kernel options. My understanding is that the nomodeset prevents the hardware graphics drivers from being loaded, it is not ideal and puts additional strain on the CPU, but can get you past this road-block.

I recommend going with a minimal install to conserve space, it will result in a system that is missing simple things like git, but we can add them back in a single command. Tracking down and removing unnecessary packages is much harder.

Get some system packages

Run sudo apt update and sudo apt install

  • tmux - a terminal multiplexer - run commands and then detach and reattach later.

    See my video tutorial you need to know tmux

  • curl - yes, this may not be installed, add it back in to make HTTP requests

  • git - absolutely essential for any commercial or OSS work

    If you have 2FA (2-factor auth) enabled for your GitHub account (and I hope that you have), then you should start cloning git repos using ssh instead of using HTTPS, otherwise you'll have to mess about with personal access tokens.

    If you don't have an SSH key, then generate one:

    ssh-keygen
    

    Now log into your GitHub profile and add a new public SSH key, paste in the contents of ~/.ssh/id_rsa.pub.

    Now, you can use the ssh link available in the GitHub UI, or you can replace a HTTPS git remote with the SSH equivalent.

    clone-ssh

    If you need to remove an existing HTTPS "remote", run git remote rm origin then git remote add origin git@github.com:alexellis/k3sup.git for instance.

  • htop - a beautiful way to look at system usage

  • vim - my preferred editor for system files, if you learn some of the shortcuts, you can speed up your workflow

  • gimp - when writing blog posts, I use gimp to resize images and to crop them, such as for the screenshot of htop you'll see later

htop

No surprises that when sorting by memory, it's Kubernetes that's using up the most resources.

sudo apt update && \
  sudo apt install -qy tmux curl git htop vim gimp

Get your graphical apps

Now we need some graphical apps, you'll download the .deb file and then double click it. Start with Chrome and work down.

Once you've installed VSCode, you will want to add the spelling plugin. It's essential given the pace of life, typos happen, better catch them before publishing.

Istio, k3sup and Kubernetes example

View the tweet

4k provides a decent amount of space, and the Terminal is gorgeous against a high-res landscape.

Get your other Linux apps

Not every app is best installed via a downloaded .deb or a package manager.

  • docker - to build, run and push images

    curl -sSLf https://get.docker.com | sudo sh
    
    sudo usermod -aG docker $(whoami)
    
  • docker-compose - compose is a favourite with developers for local development, it can be installed with pip and requires python

    sudo apt install -qy python3 python3-pip
    
    sudo pip3 install docker-compose
    
  • inletsctl - inlets is your Cloud Native tunnel to get a public IP when it counts, sharing work with clients, your team, or the community. It's like Ngrok, but for 2020, and free

    curl -sSLf https://inletsctl.inlets.dev | sudo sh
    inletsctl download
    inletsctl download --pro
    

    If you'd like a free trial for inlets-pro, that can tunnel pure L4 TCP traffic, apply here. Quote this blog post and I'll double the length of your license key trial for free.

  • k3d - to run an entire Kubernetes cluster in a docker container, the fastest option available and smallest footprint, built on k3s

    curl -s https://raw.githubusercontent.com/rancher/k3d/master/install.sh | bash
    
  • k3sup - k3sup can be used to install k3s on remote VMs, your Raspberry Pi cluster. The second use-case for k3sup is to install apps like the Kubernetes Dashboard, Minio, Postgresql, OpenFaaS, cert-manager and more, using their helm charts.

    curl -sSLf https://get.k3sup.dev | sudo sh
    
  • kubectx - kubectx is a bash script which switches quickly between Kubernetes contexts. You'll need this for pointing at either a local or a remote cluster.

    cd /tmp/
    git clone https://github.com/ahmetb/kubectx
    chmod +x ./kubectx/kubectx
    sudo cp ./kubectx/kubectx /usr/local/bin/
    
  • hub - if you're a maintainer, or ever test PRs on OSS projects, then you'll want the "Hub" CLI by GitHub.

    curl -sSL https://github.com/github/hub/releases/download/v2.14.1/hub-linux-amd64-2.14.1.tgz > /tmp/hub.tgz
    sudo tar -xvf /tmp/hub.tgz -C /usr/local/ --strip-components=1
    

    My favourite commands are hub pr list/checkout and hub issue

    hub-cli

  • Golang - installing Go is a key part of my workflow, if you want to contribute to cloud native tooling, you should install it so that you're ready.

    sudo mkdir -p /usr/local/go/
    curl -sSL https://dl.google.com/go/go1.13.7.linux-amd64.tar.gz > go1.13.7.linux-amd64.tar.gz
    sudo tar -xvf go1.13.7.linux-amd64.tar.gz -C /usr/local/go --strip-components=1
    

    Now edit ~/.bashrc:

    export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
    export GOPATH=$HOME/go
    

    Then make a GOPATH folder, mkdir -p $HOME/go

    Check it worked: go version

    Now head over to VSCode and install the "Go" plugin, followed by running the install step, which downloads each Go static analysis tool and installs it locally into your $PATH.

  • Node.js - even if you're not a JavaScript developer, it can be very useful having node available, even as a calculator in your CLI

    curl -sSL https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.gz > node-v12.14.1-linux-x64.tar.gz
    sudo tar -xvf node-v12.14.1-linux-x64.tar.gz -C /usr/local --strip-components=1
    

    Here's a little example of how you can use node as a quick calculator:

    alex@nuc7:~$ node
    Welcome to Node.js v12.14.1.
    Type ".help" for more information.
    > day_rate=2500
    2500
    > day_rate*1.1
    2750
    >
    ```
    
    

The whole package

For the whole package you'll need some additional hardware. This section is less prescriptive, and you may already own everything else you need like a monitor, keyboard and mouse.

The whole package

I used to own a Dell Ultrasharp 27" monitor, which I really liked, but wanted a cheaper alternative. That's where I met the BenQ range, which appears to use the same electronics and a different casing.

BenQ PD2700U 27 inch 4K UHD IPS Monitor | HDR | 100% sRGB and Rec. 709 | AQColor Tech for Accurate Reproduction

The scaling in Ubuntu worked well for everything I tried, with a standard HDMI cable plugged in directly. The IPS panel is beautiful and has an anti-glare coating.

USB C to DisplayPort Cable 4K@60Hz

The monitor comes with three graphics inputs: HDMI, DisplayPort and Mini DisplayPort. I connect the NUC via HDMI and my Mac Mini via a USB-C-DisplayPort cable, both of which enable full 4k at 60Hz.

Now onto input methods - mechanical keyboard and professional mouse.

Logitech MX Master 3 Advanced Wireless Mouse - Graphite

I have the MX Master 2 mouse which runs over Bluetooth, fortunately the NUC packs a bluetooth chip and there was no lag in use. Today, if I bought again, I'd upgrade to the MX Master 3 which is a refresh for 2019/2020.

One of my most coveted possessions is my mechanical keyboard. I've tried many of the switches and am now convinced that the MX Silver key is the best for me - it's quiet, tacticle and fast.

Durgod Taurus K320 TKL Mechanical Gaming Keyboard - 87 Keys - Double Shot PBT - NKRO - USB Type C

Upgrading your keyboard is one of the single best things you can do for your workflow.

Logitech C922x Pro Stream Webcam – Full 1080p HD Camera

The final piece of hardware I wouldn't do without is a powered USB hub, but one with enough power behind it to take a number of peripherals and support fast phone charging via iQ.

Anker 10 Port 60W Data Hub with 7 USB 3.0 Ports and 3 PowerIQ Charging Ports

The USB hub also allows me to switch between a Mac or the Linux host in a very short period of time with my keyboard, mouse, webcam, microphone all seamlessly appearing on either device.

Remote work and taking calls

My webcam is from Logitech and I use it for all client calls, so that I can position it where I like it. You'll find new models come out on a regular basis, so don't use my older choice as a guide.

Many developers recommend the Blue Yeti microphone. I'm not a fan of it given that it has a very sensitive pick-up for background noise.

I went for the Audio-Technica AT2020+ Cardioid Condenser USB Microphone, Black, which comes with a tripod and a carry-case. That has meant that when travelling for conferences or away for client-work, I can still record high-quality audio for a screencast. It plugs in over USB and so it is also easy to switch between computers.

When working remote, it's important to be able to get out for fresh air, or to get out of the home office. The newer generation of Apple AirPods Pro include excellent noise cancellation and work well over Bluetooth with my phone, my laptop, or the NUC. I'll cover "working on the go" more in a follow-up blog post.

One final piece of software that's worth mentioning is an office, or productivity suite.

Gsuite

I opted to use GSuite which I've bound to the company's domain name openfaas.com. I use it in the following way:

  • Google Docs - to write proposals and Statements of Work (SoW) for clients or for conference CfPs / abstracts - the collaboration features are very intuitive and helpful for async work. I also track OSS meeting notes using a shared doc.
  • Google Sheets - for tracking hours / days / project progress when appropriate. If you're new to consulting, do explore value vs. time-based pricing.
  • Google Mail - bound to openfaas.com this allows for various inboxes like sales@ and support@ - whether as aliases or as separate user accounts. You could have a separate email address for your business accountant to log into.
  • Google Calendar - for scheduling meetings and calls. I also use this to block out time for time off and product R&D.

Checkout GSuite pricing and feel free to use my referral codes: UAE7QWH7XPQRG3C for basic, and V9VKLERQ3E3TDQG for the business plan.

The added benefit of the Gsuite apps is that they're accessible from any device at any time and are enough to get most work done.

Wrapping up

I hope you've enjoyed this post where I covered my experiences and reasoning for building a Linux Desktop machine in 2020. I tried to cover the build in detail and to also cover my workflow and software preferences, particularly around "Cloud Native" tooling.

What would you like to know next? What surprised you? What did I forget to include?

If you have questions, comments, or suggestions, feel free to reach out over Twitter @alexellisuk.

You can find my OSS projects on GitHub, and if you're interested in using or contributing to them, or just connecting with like-minded community, then join OpenFaaS Slack

If you enjoyed this post, you can subscribe to regular email digests (Insiders Updates) on all my OSS projects, work and tutorials via GitHub Sponsors 🍻

You may also like:

Alex Ellis

Read more posts by this author.

Subscribe to Alex Ellis' Blog

Subscribe to keep in touch. By providing your email, you agree to receive marketing emails from OpenFaaS Ltd

or subscribe via RSS with your favourite RSS reader

Learn Go with my new eBook

eBook cover

"Everyday Go" is the fast way to learn tools, techniques and patterns from real tools used in production based upon my experience of building and running OpenFaaS at scale.

Buy a copy on Gumroad