yum与apt命令比较,yum安装出现No package vim available解决办法

yum (Yellowdog Updater Modified)是一个集与查找,安装,更新和删除程序的Linux软件。它运行在RPM包兼容的Linux发行版本上,如:RedHat, Fedora, SUSE, CentOS, Mandriva。

今天我在用CentOS 5.5的yum命令安装的时候出现如下错误:

[root@malu2 ~]# yum install vim
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.hosting90.cz
* extras: mirror.hosting90.cz
* updates: mirror.hosting90.cz
Setting up Install Process
No package vim available.
Nothing to do

 

对于此错误,我一般习惯性先去更新一下yum仓库:

#yum -y update

再次运行安装,发现错误依旧,看来这种猜包名的方法不适用;所以接下来可以通过yum的查找参数来列出vim相关的包名:

[root@malu2 yum.repos.d]# yum search vim
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.hosting90.cz
* extras: mirror.hosting90.cz
* updates: mirror.hosting90.cz
===================== Matched: vim ===================
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System.
vim-common.x86_64 : The common files needed by any version of the VIM editor.
vim-enhanced.x86_64 : A version of the VIM editor which includes recent
: enhancements.
vim-minimal.x86_64 : A minimal version of the VIM editor.

 

通过查看,我们可以看到,yum列出了详细的vim相关的包名,这样就可以顺利的安装vim了:

#yum -y install vim-enhanced.x86_64

以上命令就能执行成功了。当然不仅仅vim安装,其他程序比如mysql我们也同样只要先进行yum查找,再通过匹配详细包名来进行安装,就不会出现上述错误了


Yum的更新及安装操作

更新及安装:
yum install package 安装指定的安装包package
yum localinstall package 本地安装软件包
yum update 全部更新 
yum update package 更新指定程序包package 
yum check-update 检查可更新的程序

查找和显示
yum info <package> 显示安装包信息 
yum list 显示所有已经安装和可以安装的程序包 
yum list <package> 显示指定程序包安装情况 
yum search <keyword>查找软件包

Yum和Apt-get对比

TaskRed Hat/FedoraUbuntu/Debian
Adding, Removing and Upgrading Packages
Refresh list of available packagesYum refreshes each time it’s usedapt-get update
Install a package from a repositoryyum installpackage_nameapt-get installpackage_name
Install a package fileyum installpackage.rpmrpm -ipackage.rpmdpkg –install package.deb
Remove a packagerpm -e package_nameapt-get removepackage_name
Check for package upgradesyum check-updateapt-get -s upgradeapt-get -s dist-upgrade
Upgrade packagesyum updaterpm -Uvh [args]apt-get dist-upgrade
Upgrade the entire systemyum upgradeapt-get dist-upgrade
Package Information
Get information about an available packageyum searchpackage_nameapt-cache searchpackage_name
Show available packagesyum list availableapt-cache dumpavail
List all installed packagesyum list installedrpm -qadpkg –list
Get information about a packageyum info package_nameapt-cache showpackage_name
Get information about an installed packagerpm -qi package_namedpkg –statuspackage_name
List files in an installed packagerpm -ql package_namedpkg –listfilespackage_name
List documentation files in an installed packagerpm -qd package_name-
List configuration files in an installed packagerpm -qc package_name-
Show the packages a given package depends onrpm -qR package_nameapt-cache depends
Show other packages that depend on agiven package (reverse dependency)rpm -q -whatrequires [args]apt-cache rdepends
Package File Information
Get information about a package filerpm -qpi package.rpmdpkg –info package.deb
List files in a package filerpm -qpl package.rpmdpkg –contentspackage.deb
List documentation files in a package filerpm -qpd package.rpm-
List configuration files in a package filerpm -qpc package.rpm-
Extract files in a packagerpm2cpio package.rpm | cpio -viddpkg-deb –extractpackage.deb dir-to-extract-to
Find package that installed a filerpm -qf filenamedpkg –search filename
Find package that provides a particular fileyum provides filenameapt-file search filename
Misc. Packaging System Tools
Show stats about the package cache-apt-cache stats
Verify all installed packagesrpm -Vadebsums
Remove packages from the local cache directoryyum clean packagesapt-get clean
Remove only obsolete packages from the local cache directory-apt-get autoclean
Remove header files from the local cache directory(forcing a new download of same on next use)yum clean headersapt-file purge
General Packaging System Information
Package file extension.rpm.deb
Repository location configuration/etc/yum.conf

/etc/apt/sources.list


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值