Building and Installing OpenLens for Linux

·

·

Introduction

OpenLens, otherwise known as Lens Desktop Core, is the open source foundation of the semi-proprietary Lens Desktop. The application is a sort of Kubernetes browser and IDE with a GUI interface, used for configuring, deploying, and managing Kubenetes clusters, regardless of what platform they run on (OVH, Azure, Google, AWS, self-hosted, or otherwise).
 

Recent versions of Lens Desktop include some proprietary components, and require users to log in with an account on the publisher’s web site. Users of the completely open source OpenLens need no such account, and can use the software for free, but no official binaries of the open source “distribution” of the software are available. Unofficial builds of OpenLens can be found on the web and in the Linux FlatHub repository, but it is hard to determine how much one can trust them. Trust is extremely important in this case, because a malicious actor could potentially see and manipulate all data, and cause incredible damage with unfettered access to others’ infrastructure. For these reasons, we choose to build OpenLens ourselves.
 

It may be a challenge to find instructions on building OpenLens, so we wrote our own instructions for doing so here, and fortunately, the process is quite simple! 🙂
 

These instructions have been tested on Ubuntu and Fedora Linux, though they will likely work on any Linux distribution, as well as on MacOS.
 


Requirements

node v16+ (but less than version 17, as of 8 August 2023) and yarn are required to build OpenLens. I recommend installing node via nvm (Node Version Manager).

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
export
nvm install v16.9
nvm install yarn

Build and installation steps

git clone https://github.com/lensapp/lens.git
cd lens/
npm install
yarn run build:app


Next, I put the executable binary for OpenLens in a more suitable place to regularly run from.

sudo mkdir /opt/openlens/
sudo mv packages/open-lens/dist/OpenLens-*.AppImage /opt/openlens/openlens.AppImage
sudo chown -R your_user_name:your_user_name /opt/openlens/
chmod +x /opt/openlens/openlens.AppImage
cp packages/core/build/icon.png /opt/openlens/


Make a Gnome launcher for OpenLens

Paste the following into ~/.local/share/applications/OpenLens.desktop:

[Desktop Entry]
Comment[en_GB]=
Comment= Kubernetes Client
Exec=/opt/openlens/openlens.AppImage
GenericName[en_GB]=
GenericName=
Icon=/opt/openlens/icon.png
Name[en_GB]=OpenLens
Name=OpenLens
NoDisplay=false
Path=/opt/openlens/
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
MimeType=x-scheme-handler/lens;text/html;

That’s it! Now you’re ready to connect to your Kubernetes clusters and use OpenLens!