修改YUM源
修改成阿里源
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
wget -o /etc/yum.repos.d/CenOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
阿里源中的内容
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
yum命令
命令 | 含义 |
---|---|
list | 列出一个或一组软件包 |
yum选项
选项 | 含义 |
---|---|
–downloadonly | 仅下载而不更新 |
–downloaddir=DLDIR | 指定一个其他文件夹用于保存软件包 |
常用命令
显示已经安装的软件包
yum list installed
显示可以安装的软件包
yum list java
卸载安装包
yum remove java
列出包的依赖
yum deplist java
显示包的概要信息
yum info curl
如何下载一个包的所有依赖
安装一个包的时候,包可能会有依赖,如何把这些依赖保存下来,可以用如下命令,这个命令只会下载依赖,不会安装
yum install --downloadonly --downloaddir=/opt/wget_dir wget
如果环境上已经安装了表,上述命令会下载不下来,更换命令如下:
yum reinstall --downloadonly --downloaddir=/opt/wget_dir wget
依赖下载好之后再进行安装
rpm -ivh *.rpm
rpm -Uvh update/*.rpm
参考资料
- 提取yum安装的rpm软件包
https://blog.csdn.net/a407931774/article/details/112972166 - 离线环境安装包
https://www.cnblogs.com/wangbaobao/p/6674272.html - 163镜像
http://mirrors.163.com/.help/centos.html - 配置yum源
https://www.cnblogs.com/renpingsheng/p/7845096.html - Yum 安装、卸载软件
https://blog.csdn.net/weixin_43025071/article/details/108464547 - 阿里源
https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/