First, mount the local yum source
1, the contents of the CD to a local directory scp, here is my directory / home / sda5 / cdrom
2, modify the configuration file, the local copies of source points to the directory
cd / etc / yum .repos.d / mkdir -p / etc / yum .repos.d / Backup mv * / etc / yum .repos.d / Backup # yum other sources will move to the backup directory, conflict prevention vim / etc / yum .repos.d / local.repo
1 [local] 2 name=local 3 baseurl=file:///home/sda5/cdrom 4 gpgcheck=0 5 enabled=1 6 gpgkey=file:///home/sda5/RPM-GPG-KEY-CentOS-7
Which, baseurl is a copy of the directory. file: // expressed Yum source file, gpgkey as gpg key file.
3, Yum update source
If you want to make local.repo take effect, you can create a backup directory under /etc/yum.repos.d directory and other .repo files are moved to the backup directory.
Execute the following command to update Yum Source:
yum clean all yum makecache
4, view the source on the machine now Yum
yum repolist all
Note: The status is enabled (enabled), the number is not zero is loaded successfully.
If the [Insufficient space in download directory] error occurs after yum
Methods:
1: # yum yum Clean All command clears the cache files, but there are consequences ......
2: Manually delete some unnecessary things, this simple bar ......
3: Manually delete the log files, this is also simple it ......
4: the disk expansion operation, this is a bit complicated and dangerous ......
Second, the upgrade version
1, upgrade core
yum update --skip-broken
After upgrading to see whether the upgrade is successful
CAT / etc / redhat- Release # View core is upgraded successfully uname - r # view the kernel is upgraded successfully uname -a # View kernel is upgraded successfully
Note, kernel and core must be upgraded.
2, upgrade the kernel
If the kernel was not upgraded successfully, first check the system default kernel version:
awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
如果已存在,在通过修改配置指向我们需要的kernel即可:
grub2-set-default 0
如果不存在,则要安装:
yum install -y kernel
再修改配置信息,指向我们需要的kernel,然后重启使之生效。
注:kernel升级后重启完不生效,是配置信息修改有误导致的。
升级前:
最终: