rpm -q yum
rpm -qc yum
查看已经有的yum源
yum repolist
一共有三个源base/7/x86_64 extras/7/x86_64 updates/7/x86_64 右边三个是软件包数量
更新yum源
http://mirrors.163.com/
https://developer.aliyun.com/mirror/
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all 清理本地缓存
yum makecache生成缓存
yum repolist(查看更新的源)
安装EPEL源,它是基础源中的扩展源
yum list nginx(没安装前,是没有这个软件包的)
安装epel源
yum install epel-release.noarch ease
里面会多一个
yum list nginx 可以看到刚才没有的软件包
使用国内源
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
看不到原来的repo源了
下载
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
软件官方源
yum list |grep Zabbix
rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
yum list |grep zabbix
List:显示程序包
yum list | less 有@表示已经安装过了
yum list httpd(表示软件没有安装过)
yum list wget(表示软件已经安装过)
yum list php* 使用通配符(以什么开头的)
yum list installed 已经安装的包
yum deplist php(查看软件包的依赖)包名
yum deplist php-5.4.16-46.el7.x86_64(写个全名)
Search:查询,可以查询到描述
yum search chinese
yum search web server 没加引号
yum search “web server”(加了引号)
查找命令是属于哪个包
也可以查找文件
yum provides */httpd.conf
yum provides /etc/httpd/conf/httpd.conf
查看软件包的信息
yum info php
安装软件
yum install httpd
不提示y进行安装
yum -y install wget 安装后,不能在安装了。已安装并且是最新版本
yum -y reinstall wget(重新安装)
yum groups list
查看包组中的包
yum group info “开发工具”
yum groups install “开发工具”
查看安装相关的历史
yum history
查看安装的内容
回滚包
yum history undo 3
回滚后,httpd就被删除了
yum history
还可以把撤消的软件包,在撤消。等于在安装上
yum history undo 5
yum list httpd
删除软件包,有时只会删除一个,不会删除依赖
yum remove httpd
Yum相关命令
最新推荐文章于 2024-04-02 18:08:54 发布