CentOS7にnkfをインストールする
普通にyum install nkfじゃインストールできなかったので記事化。
普通にやるとこうなりました。
[takuya@localhost kabu]$ sudo yum install nkf [sudo] password for takuya: 読み込んだプラグイン:fastestmirror Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast base | 3.6 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 (1/2): extras/7/x86_64/primary_db | 166 kB 00:00 (2/2): updates/7/x86_64/primary_db | 9.1 MB 00:13 Determining fastest mirrors * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp パッケージ nkf は利用できません。 エラー: 何もしません [takuya@localhost kabu]$ cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
『利用できません。』だけじゃなくてなんで利用できないのかも教えて欲しいですね。
まあ答えを言ってしまうとCentOS7のデフォルトbaseリポジトリにはnkfが入っていないんだそうで。
どっかからソースコードを拾ってきてコンパイルしてもいいんですが、CentOS6用のパッケージが利用できるようなので利用できるものは使っていく方針で。
yum localinstall -y http://mirror.centos.org/centos/6/os/x86_64/Packages/nkf-2.0.8b-6.2.el6.x86_64.rpm でインストールできます。
[takuya@localhost kabu]$ sudo yum localinstall -y http://mirror.centos.org/centos/6 /os/x86_64/Packages/nkf-2.0.8b-6.2.el6.x86_64.rpm [sudo] password for takuya: 読み込んだプラグイン:fastestmirror nkf-2.0.8b-6.2.el6.x86_64.rpm | 110 kB 00:12 /var/tmp/yum-root-t93DBp/nkf-2.0.8b-6.2.el6.x86_64.rpm を調べています: 1:nkf-2.0.8b-6.2.el6.x86_64 /var/tmp/yum-root-t93DBp/nkf-2.0.8b-6.2.el6.x86_64.rpm をインストール済みとして 設定しています 依存性の解決をしています --> トランザクションの確認を実行しています。 ---> パッケージ nkf.x86_64 1:2.0.8b-6.2.el6 を インストール --> 依存性解決を終了しました。 依存性を解決しました ================================================================================ Package アーキテクチャー バージョン リポジトリー 容量 ================================================================================ インストール中: nkf x86_64 1:2.0.8b-6.2.el6 /nkf-2.0.8b-6.2.el6.x86_64 241 k トランザクションの要約 ================================================================================ インストール 1 パッケージ 合計容量: 241 k インストール容量: 241 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction インストール中 : 1:nkf-2.0.8b-6.2.el6.x86_64 1/1 検証中 : 1:nkf-2.0.8b-6.2.el6.x86_64 1/1 インストール: nkf.x86_64 1:2.0.8b-6.2.el6 完了しました! [takuya@localhost kabu]$
で、無事インストールができたのでコマンドとして利用できます。
[takuya@localhost kabu]$ nkf --guess 1301-T Shift_JIS (CR)