Build and Install OpenLens on Linux

We are migrating from Lens to OpenLens.

OpenLens provides insight into everything that runs in Kubernetes. If you use Kubernetes on a day-to-day basis, OpenLens is for you.

The Problem

Lens is no longer open to everyone by demanding users to create a Lens ID, which was not a requirement before.

More info can be found on GitHub: https://github.com/lensapp/lens/issues/5444

The Solution

Build and install OpenLens from source.

OpenLens is based on MIT license and is same as Lens IDE but without proprietary components.

Install Dependencies

Install build dependencies for a Debian-based OS:

$ sudo apt-get install -y curl g++ make tar

Install NVM

$ curl -sS -o install_nvm.sh https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh
$ bash ./install_nvm.sh
$ export NVM_DIR="${HOME}/.nvm"
$ source "${NVM_DIR}/nvm.sh"

Get OpenLens Source Code

Download the OpenLens source code:

$ curl -sL -o openlens.tgz https://github.com/lensapp/lens/archive/refs/tags/v6.1.0.tar.gz
$ tar xf ./openlens.tgz
$ mv ./lens-* ./lens

Since we’re building for a Debian-based OS, we do not need to build .rpm:

$ sed -i '/\"rpm\"\,/d' ./lens/package.json

Build and Install OpenLens

Compile the package:

$ cd ./lens
$ nvm install 16 && nvm use 16 && npm install -g yarn
$ make build

Install the binary:

$ find ./dist/ -type f -name "*.deb" -exec sudo apt-get install {} \;

Clean up:

$ cd ../ 
$ rm -rf ./lens
$ rm -f ./install_nvm.sh ./openlens.tgz

Enjoy OpenLens!

Automate the Process

Install git:

$ sudo apt-get install -y git

Download the build script from GitHub and compile the OpenLens package:

$ git clone https://github.com/lisenet/openlens-linux-install.git
$ cd ./openlens-linux-install
$ ./install_openlens.sh

Leave a Reply

Your email address will not be published.