Is there any way to install Nano on CoreOS?
To do this on a CoreOS box, following the hints from the guide here:
- Boot up the CoreOS box and connect as the
core
user - Run the
/bin/toolbox
command to enter the stock Fedora container. - Install any software you need. To install nano in this case, it would be as simple as doing a
dnf -y install nano
(dnf has replaced yum) - Use nano to edit files. "But wait -- I'm in a container!" Don't worry -- the host's file system is mounted at
/media/root
when inside the container. So just save a sample text file at/media/root/home/core/test.txt
, thenexit
the container, and finally go list the files in/home/core
. Notice your test.txt file?
If any part of this is too cryptic or confusing, please ask follow up questions. :-)
While the Dan's answer is basically correct, it seems that yum isn't working anymore in the latest CoreOS installation (installed yesterday from the latest coreos_production_vmware_ova.ova from http://stable.release.core-os.net/amd64-usr/current into a VMWare Workstation on Windows).
The cited yum command aborts at the end. So replace step (3) with the command
/usr/bin/dnf install nano
which successfully installs nano in the fedora container.
Do your edits with nano inside this fedora container (accessible from CoreOS prompt by /bin/toolbox), while obeying the mounting advise of Dan's post. Leaving the fedora container can be done by the 'exit' command.
There is a simpler option that I found on a reddit post
First connect as the core
user and then, make sure /opt/bin
exists (sudo mkdir -p /opt/bin
) before executing the following command:
docker run -d --name nano base/archlinux:latest sleep && sudo docker cp nano:/usr/bin/nano /opt/bin && docker rm nano
Hopefully /opt/bin
is already in the PATH
so as soon as it worked, you will have nano
available.