CentOS update yum source
What is a repo file?
repo 文件是 Linux 中yum源(软件仓库)的配置文件,通常一个 repo 文件定义了一个或者多个软件仓库的细节内容,例如我们将从哪里下载需要安装或者升级的软件包,repo文件中的设置内容将被yum读取和应用!
1. Make a backup, in order to switch back when the update fails
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
When there are multiple, use the following command to back up
mv /etc/yum.repos.d/CentOS* /etc/yum.repos.d/CentOS-Base.repo.backup
2. Enter the yum source configuration folder
cd /etc/yum.repos.d/
3. Download the corresponding new source according to the centos version
Here is CentOS7 as an example
```java
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
``
If the wget command does not take effect, it means that the wget tool has not been installed, enter yum -y install wget and press Enter to install, or use
curl -O http://mirrors.aliyun.com/repo/Centos-7.repo
download
4. Clear the cache and create a new cache
yum clean all(清除缓存)
`yum makecache 生成缓存`
Note: The newly downloaded CentOS-Base.repo source will take effect.
A certain aliyun timeout will be reported during the update, and he will automatically try other Alibaba mirrors, and finally he will use the basic mirror, and then automatically update part of it. Because the base image is out of date.
5. Execute yum source update command
yum clean all
yum makecache
yum -y update
Try to update the system yum -y update (not root plus sudo), this time you can install docker or update the system smoothly.
yum install docker
systemctl start docker
You can use docker
Commonly used yum commands
Common commands
yum install softwarename #install
yum remove softwarename #Uninstall software
yum list softwarename #Check if there is this software in the software source
yum list all #List all software names
yum list installed #List the names of installed software
yum list available #List the software that can be installed with yum
yum clean all #empty yum cache
yum search softwareinfo #Search software name according to software information (for example, use search web to search web browser)
yum whatprovides filename #Find the software package containing the filename file in the yum source (for example, whatprovides rm searches for the software containing rm, the command is essentially a file)
yum update #Update software, there will be unknown problems, generally do not upgrade the server
yum history
#View system software change history yum reinstall softwarename #Reinstall
yum info softwarename #View software information
yum groups list #View software group information
yum groups info softwarename #View the software contained in the software group
yum groups install softwarename #Install components
yum groups remove softwarename #Uninstall components
yum clean all #Clean up the cache