
LunarVim in Distrobox
Tuesday, 25th October, 2022
You're missing that one program that isn't available in your Linux distro? With Distrobox, the 'Linux Subsystem for Linux,' you can install it anyways. This article explains how to do that with the example of installing LunarVim on Red Hat.
LunarVim's dependencies aren't part of Red Hat's official repositories. But with Docker you can run any program in containers, similar to a virtual machine. These containers can be based on any distribution, regardless of your host's distro. So you can use Docker to create for example an Arch container and install LunarVim in it. To allow LunarVim to access your host's files, you have to mount your host's root directory. To make these mounts, starting the container and launching its programs from your host easier, Distrobox has been created.
Installing Requirements on Host
Distrobox requires Docker or Podman (a fork of Docker that runs containers rootlessly). Both Distrobox and Podman are part of the Extra Packages for Enterprise Linux (EPEL), an official repository you can add to Red Hat. Follow the instructions on the official page linked above to install the repo. Now you can install what you need:
yum install podman-docker
yum install distrobox
Creating the Container
First you have to create an Arch container using Distrobox. Because LunarVim installs many files in the home directory, you should create such a directory specifically for your Arch container. Otherwise your host's home directory would get bloated.
mkdir -p ~/.distrobox/arch`
distrobox-create --name arch --image archlinux --home ~/.distrobox/arch
Now you can attach your terminal to the container's stdin and stdout:
distrobox enter arch
Inside the Container
Now you're inside your container's shell.
In this article, all commands that start with a $ are to be run in your container, not your host.
If you like, you can install all your dotfiles at this point.
# requires https://gitub.com/christopher-besch/configs in your host's ~/.custom_configs
$ /home/$(whoami)/.custom_configs/install.sh server && source ~/.bashrc
Let's use pacman, the Arch package manager, to install what Red Hat's yum can't provide:
# if you're asked what repos to use, the defaults are fine
$ sudo pacman -S git make python-pip cargo neovim vim xclip
LunarVim requires node;
this is best done with nvm.
You should check the current version of the installation script in the official nvm install docs and change the curl command accordingly:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash && source ~/.bashrc
$ nvm install node
Once that is done, you can finally install LunarVim.
# answer yes to all questions
$ bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)
Now a little bit of work has to be done on your containers ~/.bashrc (located at ~/.distrobox/arch/.bashrc on your host):
- Add
export PATH=/home/$(whoami)/.distrobox/arch/.local/bin:$PATHand - remove the line
[[ $- != *i* ]] && return. Otherwisenvm's installation paths don't get loaded when starting LunarVim from your host.
In order for those paths to get loaded, we have to source the just edited ~/.bashrc every time LunarVim starts.
This can be done with a little wrapper script you should put into ~/lvim in your container.
#!/bin/bash
source ~/.bashrc
lvim "$@"
Mark this file executable
$ chmod +x ~/lvim
and export it to be usable from your host using Distrobox (still from within your container).
$ distrobox-export --bin "/home/$(whoami)/.distrobox/arch/lvim" --export-path "/home/$(whoami)/.local/bin"
This creates the file ~/.local/bin/lvim on your host.
When you run it from your host, Distrobox starts the container (if not already done so) and launches LunarVim with the PATH variable and all mounts properly configured.
Finalizing
You need to export PATH=/home/$HOME/.local/bin:$PATH in your host's ~/.bashrc but then you can run lvim from your host and use LunarVim just as if it were natively installed.
Since all the language servers used by LunarVim are installed in the container, all programming languages you use need to be installed in both your host and your container.
Other Articles

Docker: Breathing Life into Decades old Fortran
Sunday, 6th April, 2025
Bringing decades old Fortran code to life with Docker and animating it with Python. Now you get to see Fig.3.5. from "Introduction to Conventional Transmission Electron Microscopy" by Prof. Marc De Graef at 30 frames a second.

The Bitter Feeling of Technical Compromises
Thursday, 25th September, 2025
My very personal troubles dealing with compromises, explained at an example of docker_cron with Renovate. Sometimes you really don't have to worry as much and trust your previous, careful considerations.

reveal.js your Presentation
Friday, 24th June, 2022
reveal.js is a PowerPoint alternative. With it you programmatically define your presentation via HTML. This article shows how you can use reveal.js for your own presentation.

When You Don't Take the Shot
Wednesday, 10th December, 2025
I list the things I realized to improve my photos. There are the technical abilities (equipment, exposure, post processing, ...) and the surrounding conditions (time, location, ...). And sometimes, photography means letting the shutter rest.