docker(centos 系统) 安装 vim 工具
目录
问题
利用纯净的 centos 镜像起了一个容器,运行 vim 命令的时候,提示没有该命令?这都没有,太过分了吧!!!
提示报错如下:
bash: vim: command not found
报错截图:
无奈,只有自己安装了。
其实,我一直认为 vim 是系统最基础的工具之一呢,就像 windows 系统的记事本。
没想到 centos 系统镜像里居然连 vim 都不带。
解决
既然提示没有 vim 工具,那就安装吧。
等等,不会连包管理工具 yum 都没有吧???
幸好,是有的,那就安装命令走起吧:
[root@0f49e35e0a46 config]# yum install vim-enhancedLoaded plugins: fastestmirror, ovlLoading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.bfsu.edu.cn * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.comResolving Dependencies--> Running transaction check---> Package vim-enhanced.x86_64 2:7.4.629-8.el7_9 will be installed--> Processing Dependency: vim-common = 2:7.4.629-8.el7_9 for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64--> Processing Dependency: which for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64--> Running transaction check---> Package gpm-libs.x86_64 0:1.20.7-6.el7 will be installed---> Package vim-common.x86_64 2:7.4.629-8.el7_9 will be installed--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-8.el7_9.x86_64---> Package which.x86_64 0:2.20-7.el7 will be installed--> Running transaction check---> Package vim-filesystem.x86_64 2:7.4.629-8.el7_9 will be installed--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================== Package Arch Version Repository Size======================================================================================================================Installing: vim-enhanced x86_64 2:7.4.629-8.el7_9 updates 1.1 MInstalling for dependencies: gpm-libs x86_64 1.20.7-6.el7 base 32 k vim-common x86_64 2:7.4.629-8.el7_9 updates 5.9 M vim-filesystem x86_64 2:7.4.629-8.el7_9 updates 11 k which x86_64 2.20-7.el7 base 41 k
Transaction Summary======================================================================================================================Install 1 Package (+4 Dependent packages)
Total download size: 7.1 MInstalled size: 23 MIs this ok [y/d/N]: yDownloading packages:(1/5): gpm-libs-1.20.7-6.el7.x86_64.rpm | 32 kB 00:00:00(2/5): vim-enhanced-7.4.629-8.el7_9.x86_64.rpm | 1.1 MB 00:00:01(3/5): which-2.20-7.el7.x86_64.rpm | 41 kB 00:00:00module.exports = {(4/5): vim-common-7.4.629-8.el7_9.x86_64.rpm | 5.9 MB 00:00:01(5/5): vim-filesystem-7.4.629-8.el7_9.x86_64.rpm | 11 kB 00:00:01----------------------------------------------------------------------------------------------------------------------Total 2.3 MB/s | 7.1 MB 00:00:03Running transaction checkRunning transaction testTransaction test succeededRunning transaction Installing : 2:vim-filesystem-7.4.629-8.el7_9.x86_64 1/5 Installing : 2:vim-common-7.4.629-8.el7_9.x86_64 2/5 Installing : which-2.20-7.el7.x86_64 3/5install-info: No such file or directory for /usr/share/info/which.info.gz Installing : gpm-libs-1.20.7-6.el7.x86_64 4/5 Installing : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 5/5 Verifying : gpm-libs-1.20.7-6.el7.x86_64 1/5 Verifying : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 2/5 Verifying : which-2.20-7.el7.x86_64 3/5 Verifying : 2:vim-common-7.4.629-8.el7_9.x86_64 4/5 Verifying : 2:vim-filesystem-7.4.629-8.el7_9.x86_64 5/5
Installed: vim-enhanced.x86_64 2:7.4.629-8.el7_9
Dependency Installed: gpm-libs.x86_64 0:1.20.7-6.el7 vim-common.x86_64 2:7.4.629-8.el7_9 vim-filesystem.x86_64 2:7.4.629-8.el7_9 which.x86_64 0:2.20-7.el7
Complete!
出现下图的信息,表示安装成功。
查看 vim 版本号信息,进一步确认。
[root@localhost ~]# vim -versionVIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 15 2020 16:44:08)Garbage after option argument: "-version"More info with: "vim -h"
嗯,版本是 7.4,应该是可以用了。
打开我刚才想编辑的 auth.js 文件:
哈哈,修改信息(用户名和密码)并保存,完美!
收工!!!
如果文章对你有帮助,欢迎点赞评论+关注!3ks 支持!
版权声明: 本文为 InfoQ 作者【liuzhen007】的原创文章。
原文链接:【http://xie.infoq.cn/article/65f442c0008723157d5788610】。文章转载请联系作者。
评论