[root@localhost ~]# mkdir /etc/yum.repos.d/repo.bak
[root@localhost ~]# mv /etc/yum.repos.d/* /etc/yum.repos.d/repo.bak
2、下载网络YUM源(以下三种选一即可)
1)阿里源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base-aliyun.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
2)网易源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
3)清华源
[root@localhost ~]# sed -e 's|^mirrorlist=|#mirrorlist=|g' \
> -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
> -i.bak \
> /etc/yum.repos.d/CentOS-*.repo
3、验证配置
[root@localhost ~]# yum clean all 清理缓存
[root@localhost ~]# yum makecache 重新生成缓存
[root@localhost ~]# yum repolist 查看yum源信息
五、命令讲解
1、查看软件信息
1)命令
yum list
功能:查看软件列表
格式:yum list [软件名]
2)实例
[root@localhost ~]# yum list firefox
... ... ...
Installed Packages
firefox.x86_64 52.7.0-1.el7.centos @anaconda
Available Packages
firefox.i686 91.6.0-1.el7.centos updates
firefox.x86_64 91.6.0-1.el7.centos updates
2、检索软件及相关信息
1)命令
yum search 关键词
yum info 软件名… 查看软件详细描述
yum provides 文档路径… 查看安装那些软件提供该文件
2)实例
[root@localhost ~]# yum search vim
... ... ...
================================== N/S matched: vim ===================================
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
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-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor
[root@localhost ~]# yum info vim-common
... ... ...
Installed Packages
Name : vim-common
Arch : x86_64
Epoch : 2
Version : 7.4.629
Release : 8.el7_9
Size : 21 M
Repo : installed
From repo : updates
Summary : The common files needed by any version of the VIM editor
URL : http://www.vim.org/
License : Vim
Description : VIM (VIsual editor iMproved) is an updated and improved version of the
: vi editor. Vi was the first real screen-based editor for UNIX, and is
: still very popular. VIM improves on vi by adding new features:
: multiple windows, multi-level undo, block highlighting and more. The
: vim-common package contains files which every VIM binary will need in
: order to run.
:
: If you are installing vim-enhanced or vim-X11, you'll also need
: to install the vim-common package.
[root@localhost ~]# yum provides /usr/bin/vim
2:vim-enhanced-7.4.160-4.el7.x86_64 : A version of the VIM editor which includes recent
: enhancements
Repo : media
Matched from:
Filename : /usr/bin/vim
2:vim-enhanced-7.4.629-7.el7.x86_64 : A version of the VIM editor which includes recent
: enhancements
Repo : base
Matched from:
Filename : /usr/bin/vim
2:vim-enhanced-7.4.629-8.el7_9.x86_64 : A version of the VIM editor which includes
: recent enhancements
Repo : updates
Matched from:
Filename : /usr/bin/vim
2:vim-enhanced-7.4.629-8.el7_9.x86_64 : A version of the VIM editor which includes
: recent enhancements
Repo : @updates
Matched from:
Filename : /usr/bin/vim
3、安装卸载
1)命令
yum -y install
功能:安装软件
格式:yum -y install [软件名]
-y 当安装过程提示选择全部为"yes"
Install 安装指定软件包,类似“rpm -i”
yum remove
功能:卸载软件
格式:yum remove [软件名]
为避免误删,故一般不加-y选项
remove 安装指定软件包,类似“rpm -e”
2)实例
[root@localhost ~]# yum -y install vim
... ... ...
=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Installing:
vim-enhanced x86_64 2:7.4.629-8.el7_9 updates 1.1 M
Transaction Summary
... ... ...
Running transaction
Installing : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 1/1
Verifying : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 1/1
Installed:
vim-enhanced.x86_64 2:7.4.629-8.el7_9
Complete!
[root@localhost ~]# yum remove vim
... ... ...
=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Removing:
vim-enhanced x86_64 2:7.4.629-8.el7_9 @updates 2.2 M
Transaction Summary
=======================================================================================
Remove 1 Package
Installed size: 2.2 M
Is this ok [y/N]: y
... ... ...
Running transaction
Erasing : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 1/1
Verifying : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 1/1
Removed:
vim-enhanced.x86_64 2:7.4.629-8.el7_9
Complete!
4、清楚缓存
1)命令
yum clean all
功能:清除本地yam缓存
2)实例
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base extras media updates
Cleaning up everything
... ... ...
5、生成缓存
1)命令
yum makecache
功能:生成本地yum缓存
2)实例
[root@localhost ~]# yum makecache
Loaded plugins: fastestmirror, langpacks
![img](https://img-blog.csdnimg.cn/img_convert/e13944179c7055663ab337ae02efab48.png)
![img](https://img-blog.csdnimg.cn/img_convert/bf579146f207326fd4c59383f3f1b53c.png)
![img](https://img-blog.csdnimg.cn/img_convert/b46d3313afe9affb6ff252b888ad96bb.png)
**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!**
**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**
**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618545628)**
例
[root@localhost ~]# yum makecache
Loaded plugins: fastestmirror, langpacks
[外链图片转存中…(img-6vlH9rvV-1714413864568)]
[外链图片转存中…(img-IeyWVAzt-1714413864569)]
[外链图片转存中…(img-uszYCShj-1714413864570)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新