配置 CentOS 7 man 命令帮助显示简体中文

导读 如果英文不好,看 manual 手册会很吃力,本文档将详细介绍如何配置 CentOS 7 man 命令帮助显示简体中文。
将 manpages-zh-1.5.1.tar.gz 源码包下载到本地

http://pkgs.fedoraproject.org/repo/pkgs/man-pages-zh-CN/manpages-zh-1.5.1.tar.gz/13275fd039de8788b15151c896150bc4/

安装 lrzsz 工具
[root@centos7 ~]# cd /usr/local/src
[root@centos7 src]# yum install -y lrzsz
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 lrzsz.x86_64.0.0.12.20-36.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

========================================================================
 Package       架构           版本                   源            大小
========================================================================
正在安装:
 lrzsz         x86_64         0.12.20-36.el7         base          78 k

事务概要
========================================================================
安装  1 软件包

总下载量:78 k
安装大小:181 k
Downloading packages:
lrzsz-0.12.20-36.el7.x86_64.rpm                    |  78 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : lrzsz-0.12.20-36.el7.x86_64                         1/1 
  验证中      : lrzsz-0.12.20-36.el7.x86_64                         1/1 

已安装:
  lrzsz.x86_64 0:0.12.20-36.el7                                         

完毕!
[root@centos7 src]# ls
manpages-zh-1.5.1.tar.gz
[root@centos7 src]# sz manpages-zh-1.5.1.tar.gz 
rz
 zmodem trl+C ȡ
  100%       1 KB    1 KB/s 00:00:01       0 Errorsgz...
上传源码包
[root@centos7 src]# rm -rf *
[root@centos7 src]# ls
[root@centos7 src]# rz
rz waiting to receive.
 zmodem trl+C ȡ
  100%    1919 KB 1919 KB/s 00:00:01       0 Errorsgz...

[root@centos7 src]# ls
manpages-zh-1.5.1.tar.gz
[root@centos7 src]# file manpages-zh-1.5.1.tar.gz 
manpages-zh-1.5.1.tar.gz: gzip compressed data, from Unix, last modified: Thu Apr  3 23:29:16 2008, max compression
[root@centos7 src]# tar xf manpages-zh-1.5.1.tar.gz 
[root@centos7 src]# ls
manpages-zh-1.5.1  manpages-zh-1.5.1.tar.gz

[root@centos7 src]# cd manpages-zh-1.5.1
[root@centos7 manpages-zh-1.5.1]# ls
aclocal.m4  configure     DOCS        Makefile.am  NEWS    utils
AUTHORS     configure.in  INSTALL     Makefile.in  README
ChangeLog   COPYING       install-sh  missing      src
关闭 zhtw
[root@centos7 manpages-zh-1.5.1]# ./configure --disable-zhtw
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)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating DOCS/Makefile
config.status: creating src/Makefile
config.status: creating src/man1/Makefile
config.status: creating src/man1/zh_CN/Makefile
config.status: creating src/man1/zh_TW/Makefile
config.status: creating src/man2/Makefile
config.status: creating src/man2/zh_CN/Makefile
config.status: creating src/man2/zh_TW/Makefile
config.status: creating src/man3/Makefile
config.status: creating src/man3/zh_CN/Makefile
config.status: creating src/man3/zh_TW/Makefile
config.status: creating src/man4/Makefile
config.status: creating src/man4/zh_CN/Makefile
config.status: creating src/man4/zh_TW/Makefile
config.status: creating src/man5/Makefile
config.status: creating src/man5/zh_CN/Makefile
config.status: creating src/man5/zh_TW/Makefile
config.status: creating src/man6/Makefile
config.status: creating src/man6/zh_CN/Makefile
config.status: creating src/man6/zh_TW/Makefile
config.status: creating src/man7/Makefile
config.status: creating src/man7/zh_CN/Makefile
config.status: creating src/man7/zh_TW/Makefile
config.status: creating src/man8/Makefile
config.status: creating src/man8/zh_CN/Makefile
config.status: creating src/man8/zh_TW/Makefile
config.status: creating src/mann/Makefile
config.status: creating src/mann/zh_CN/Makefile
config.status: creating src/mann/zh_TW/Makefile
config.status: creating utils/Makefile

manpages-zh configure summary
=============================
UTF-8 : true
zh_CN : true
zh_TW : false
编译安装
[root@centos7 manpages-zh-1.5.1]# make && make install
设置环境变量
[root@centos7 manpages-zh-1.5.1]# vim /etc/profile.d/cman.sh  #新文件
#输入以下内容
alias cman='man -M /usr/local/share/man/zh_CN'
执行别名文件让该文件生效
[root@centos7 manpages-zh-1.5.1]# source /etc/profile.d/cman.sh
执行 man ls 或者 cman ls 查看配置结果是否成功
[root@centos7 manpages-zh-1.5.1]# cman ls
LS(1)                   General Commands Manual                  LS(1)

NAME
       ls, dir, vdir - 列目录内容

提要
       ls [选项] [文件名...]

       POSIX 标准选项: [-CFRacdilqrtu1]

GNU 选项 (短格式):
       [-1abcdfgiklmnopqrstuxABCDFGLNQRSUX]  [-w  cols]  [-T cols] [-I
       pattern]                                          [--full-time]
       [--format={long,verbose,commas,across,vertical,single-column}]
       [--sort={none,time,size,extension}]
       [--time={atime,access,use,ctime,status}]
       [--color[={none,auto,always}]] [--help] [--version] [--]

描述( DESCRIPTION )
总结

以上就是配置 CentOS 7 man 命令帮助显示简体中文的方法,最后用 cman 来测试,大家可以去尝试用 man 来测试一下,希望能给大家带来帮助。

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/123483.html

(0)
上一篇 2021年8月29日
下一篇 2021年8月29日

相关推荐

发表回复

登录后才能评论