有没有办法在 CoreOS 上安装 Nano?

cod*_*boy 36 software-installation nano coreos

CoreOS 不包含包管理器,但我首选的文本编辑器是nano, notvivim. 有没有办法解决?

gcc 不可用,因此无法从源代码编译:

core@core-01 ~/nano-2.4.1 $ ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking for style of include used by make... none
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/core/nano-2.4.1':
configure: error: no acceptable C compiler found in $PATH
Run Code Online (Sandbox Code Playgroud)

为了把这一背景下,我在下面的这个指南的时候,我发现我想使用nano

小智 60

要在 CoreOS 机器上执行此操作,请遵循此处指南中的提示:

  1. 启动 CoreOS box 并以core用户身份连接
  2. 运行/bin/toolbox命令进入Fedora 容器。
  3. 安装您需要的任何软件。在这种情况下要安装nano,就像做一个一样简单dnf -y install nano(dnf已经取代了yum)
  4. 使用 nano 编辑文件。“但是等等——我在一个容器里!” 不用担心 - 主机的文件系统/media/root在容器内时挂载。因此,只需将示例文本文件保存在/media/root/home/core/test.txt,然后exit是容器,最后在/home/core. 注意到你的 test.txt 文件了吗?

如果其中的任何部分过于神秘或令人困惑,请提出后续问题。:-)

在最近的 CoreOS 47.83.202103292105-0 中,主机被放置在/host而不是/media/root.


小智 7

虽然丹的回答基本上是正确的,但似乎 yum 在最新的 CoreOS 安装中不再工作(昨天从http://stable.release.core-os.net/amd64-usr/的最新 coreos_production_vmware_ova.ova 安装)当前进入 Windows 上的 VMWare 工作站)。

引用的 yum 命令在最后中止。所以用命令替换步骤(3)

/usr/bin/dnf install nano
Run Code Online (Sandbox Code Playgroud)

它成功地在 Fedora 容器中安装了 nano。

在这个 Fedora 容器中使用 nano 进行编辑(可从 CoreOS 提示中通过 /bin/toolbox 访问),同时遵守 Dan 帖子的安装建议。可以通过“exit”命令离开 Fedora 容器。


小智 6

我在reddit 帖子上找到了一个更简单的选项

首先以core用户身份连接,然后在执行以下命令之前确保/opt/bin存在 ( sudo mkdir -p /opt/bin):

docker run -d --name nano base/archlinux:latest sleep && sudo docker cp nano:/usr/bin/nano /opt/bin && docker rm nano

希望/opt/bin它已经在,PATH所以只要它工作,你就可以nano使用。