#前提条件
OS
MacOS Monterey 12.0.1
CPU
Apple M1(arm64)
Docker
Docker Desktop 4.2.0 (70708)
CentOS
CentOS Linux release 7.9.2009 (AltArch)
#やりたいこと
Dockerコンテナで動かすCentOS7で、lessコマンドを使いたい
#つまづいた話
[root@0a412e1af0a1 ~]# less -N bunsyo2.txt
bash: less: command not found
lessコマンド自体が使えない模様
bash: less: command not found
#解決策
yum(※)でlessコマンドをインストール
yum install less
なんやかんやでインストール成功
(何度か Is this ok [y/d/N]: と訊かれるので、全てy(Yes)で答えます)
※ -yオプションをつければ、全て「Yes」で答えるものとして進められます
[root@0a412e1af0a1 ~]# yum install less
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: ftp.yz.yamagata-u.ac.jp
* extras: ftp.yz.yamagata-u.ac.jp
* updates: ftp.yz.yamagata-u.ac.jp
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): base/7/aarch64/group_gz | 153 kB 00:00:00
(2/4): base/7/aarch64/primary_db | 4.9 MB 00:00:02
(3/4): extras/7/aarch64/primary_db | 246 kB 00:00:06
(4/4): updates/7/aarch64/primary_db | 2.1 MB 00:00:07
Resolving Dependencies
--> Running transaction check
---> Package less.aarch64 0:458-9.el7 will be installed
--> Processing Dependency: groff-base for package: less-458-9.el7.aarch64
--> Running transaction check
---> Package groff-base.aarch64 0:1.22.2-8.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
less aarch64 458-9.el7 base 115 k
Installing for dependencies:
groff-base aarch64 1.22.2-8.el7 base 920 k
Transaction Summary
==================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 1.0 M
Installed size: 4.1 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/aarch64/7/base/packages/groff-base-1.22.2-8.el7.aarch64.rpm: Header V4 RSA/SHA1 Signature, key ID 305d49d6: NOKEY
Public key for groff-base-1.22.2-8.el7.aarch64.rpm is not installed
(1/2): groff-base-1.22.2-8.el7.aarch64.rpm | 920 kB 00:00:01
(2/2): less-458-9.el7.aarch64.rpm | 115 kB 00:00:06
----------------------------------------------------------------------------------------------------------------------------------
Total 169 kB/s | 1.0 MB 00:00:06
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-9.2009.0.el7.centos.aarch64 (@instCentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
Importing GPG key 0x305D49D6:
Userid : "CentOS AltArch SIG - AArch64 (http://wiki.centos.org/SpecialInterestGroup/AltArch/AArch64) <security@centos.org>"
Fingerprint: ef8f 3ca6 6efd f32b 36cd adf7 6c7c b6ef 305d 49d6
Package : centos-release-7-9.2009.0.el7.centos.aarch64 (@instCentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : groff-base-1.22.2-8.el7.aarch64 1/2
Installing : less-458-9.el7.aarch64 2/2
Verifying : less-458-9.el7.aarch64 1/2
Verifying : groff-base-1.22.2-8.el7.aarch64 2/2
Installed:
less.aarch64 0:458-9.el7
Dependency Installed:
groff-base.aarch64 0:1.22.2-8.el7
Complete!
無事、lessコマンドが使えるようになりました。
もちろん、他に使えないコマンドがあれば、同様の手順で使えるようになります。
(私はコマンドのマニュアルを表示する「manコマンド」も使えなかったので、
yum install man
で使えるようになりました。)
※補足
yumは
Yellowdog Updater Modified
の略だそうです。
参考ページ