YUM命令详解及YUM源配置

yum 命令详解及yum源配置
YUM( Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。
基於RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包。
一:yum语法
options:可选,选项包括-h(帮助),-y(当安装过程提示选择全部为"yes"),-q(不显示安装的过程),-v(显示版本信息)等。
command:要进行的操作。
package:操作的对象
[root@localhost ~]# yum --help
Loaded plugins: fastestmirror
Usage: yum [options] COMMAND

List of Commands:

check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase Remove a package or packages from your system
groupinfo Display details about a package group
groupinstall Install the packages in a group on your system
grouplist List available package groups
groupremove Remove the packages in a group from your system
help Display a helpful usage message
history Display, or use, the transaction history
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
load-transaction load a saved transaction from filename
makecache Generate the metadata cache
provides Find what package provides the given value
reinstall reinstall a package
repolist Display the configured software repositories
resolvedep Determine which package provides the given dependency
search Search package details for the given string
shell Run an interactive yum shell
update Update a package or packages on your system
upgrade Update packages taking obsoletes into account
version Display a version for the machine and/or available repos.
......................................................................................................................
二:yum常用命令
1.列出所有可更新的软件清单命令:yum check-update
2.更新所有软件、系统版本和内核命令:yum update(比yum upgrade常用)
3.更新所有软件、系统版本命令:yum upgrade
4.仅安装指定的软件包命令:yum -y install <package_name>
5.仅更新指定的软件包命令:yum update <package_name>
6.列出所有可安裝的软件清单命令:yum list
7.删除软件包命令:yum remove <package_name>
8.查找软件包 命令:yum search <keyword>
9.查看yum仓库列表:yum repolist
10.清除缓存命令:
yum clean packages: 清除缓存目录下的软件包
yum clean headers: 清除缓存目录下的 headers
yum clean all:清除缓存目录下的所有软件包及旧的headers
11.建立本地缓存命令
yum makecache
12.列出包的依赖关系
yum deplist <package_name>
13.安装中文支持的软件包(安装一类或者一组包要在install前加group,卸载install换为remove即可)
yum -y groupinstall "Chinese Support"
14.安装用于开发的软件包(安装一类或者一组包要在install前加group,卸载install换为remove即可)
yum -y groupinstall "Development Tools"
yum -y groupinstall "Development Libraries"
15.安装yum插件,提高速度
yum -y install yum-fastestmirror
三:添加yum源
1.添加网易源
网易yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的不错。将yum源设置为163yum,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。
1)先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2)下载对应版本repo文件, 放入/etc/yum.repos.d/
CentOS6 :http://mirrors.163.com/.help/CentOS6-Base-163.repo
在命令行中:cd /etc/yum.repos.d/ && wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
CentOS7 :http://mirrors.163.com/.help/CentOS7-Base-163.repo
在命令行中:cd /etc/yum.repos.d/ && wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
2.添加epel源
EPEL是企业版 Linux 附加软件包的简称,EPEL的软件包通常不会与企业版 Linux 官方源中的软件包发生冲突,或者互相替换文件。EPEL 项目与 Fedora 基本一致,包含完整的构建系统、升级管理器、镜像管理器等。
在CentOS6和CentOS7都可以执行下面的命令安装epel仓库
yum -y install epel-release
这条命令好处是可以自动安装不同版本的epel,比如在CentOS6上面安装的就是epel6,在CentOS7上面安装的就是epel7。
3.添加atomic源
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
一路输入yes就可以了
在安装php的一些包时特有用( 例如php-mcrypt libmcrypt libmcrypt-devel )
4.无论添加那种yum源,需运行以下命令清除旧缓存生成新的缓存
1)yum clean all
2)yum makecache或者rpm --rebuilddb
四:帮助文档
中科大yum源:https://lug.ustc.edu.cn/wiki/mirrors/help/centos
清华大学epel源:https://mirrors.tuna.tsinghua.edu.cn/help/epel/
CentOS官网: http://www.centos.org/
CentOS镜像: http://www.centos.org/modules/tinycontent/index.php?id=32
关于ubuntu更换apt源,请参考我的另一篇博客 https://blog.51cto.com/12943999/2055572

转载于:https://blog.51cto.com/12943999/2054025

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值