Table of contents
2.1How to download the corresponding instructions in yum
2.2. How to delete the corresponding instructions in yum
3.1 Why update the yum source?
1. First enter the directory cd /etc/yum.repos.d
2. Make a backup of our original yum source
3. Download the domestic yum source to CentOs-Base.repo in the current directory
What should we do if we want to change back to the original yum in the future?
Note: The following operations must be run under the root user
What is 1yum?
When we buy a mobile phone or a computer, there will usually be an xx application market on it. When we want to download software, we just download it directly in the application market and install it directly.
The application market here can be vividly compared to the yum command, which can be used to quickly download the corresponding command (software) in the Linux environment.
How to use 2yum?
2.1How to download the corresponding instructions in yum
Let’s quickly use a yum command first
yum install -y sl
yum: Download the corresponding command (software)
install: Install the corresponding instructions (software)
sl: corresponding command
-y: Confirm download and installation
The role of -y
Without -y:
2.2. How to delete the corresponding instructions in yum
If one day we find that we have insufficient disk space and I want to delete the sl command, what should I do?
yum remove -y sl
remove: delete the corresponding instruction
sl: corresponding command
-y: confirm deletion
3. Update yum source
3.1 Why update the yum source?
When installing Centos7 on a virtual machine, the default yum source is foreign, which causes the speed of downloading software to be unsatisfactory. At this time, we need to update yum to the domestic one.
3.2 How to update yum source
Note: It is recommended to use copy and paste first. If that doesn’t work, then use manual input.
1. First enter the directory cd /etc/yum.repos.d
cd /etc/yum.repos.d
2. Make a backup of our original yum source
mv CentOS-Base.repo CentOS-Base.repo.backup
3. Download the domestic yum source to CentOs-Base.repo in the current directory
Here we recommend using Alibaba Cloud (personal recommendation)
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4. Clear yum cache
yum clean all
Can free up disk space and clear old caches
5. Generate a new yum cache
yum makecache
In this way, our yum source has been updated.
What should we do if we want to change back to the original yum in the future?
mv CentOS-Base.repo.backup CentOS-Base.repo
yum clean all
yum makecache
Just execute the above three commands in sequence