升级Centos

升级Centos

参考

	https://www.cnblogs.com/configure/p/10918189.html
	https://blog.csdn.net/weixin_41970237/article/details/108128768

1.查看旧版本

cat /etc/redhat-release

在这里插入图片描述

2.查看原始 Vault 库文件

vim /etc/yum.repos.d/CentOS-Base.repo

# 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
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

3.将此文件备份

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

4.修改CentOS-Base.repo

可根据自己的需求替换

编辑模式
:%s/7.6.1810/xxx/g
# 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.
#
#
# C7.6.1810
[C7.6.1810-base]
name=CentOS-7.6.1810 - Base
baseurl=http://vault.centos.org/7.6.1810/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
 
[C7.6.1810-updates]
name=CentOS-7.6.1810 - Updates
baseurl=http://vault.centos.org/7.6.1810/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
 
[C7.6.1810-extras]
name=CentOS-7.6.1810 - Extras
baseurl=http://vault.centos.org/7.6.1810/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
 
[C7.6.1810-centosplus]
name=CentOS-7.6.1810 - CentOSPlus
baseurl=http://vault.centos.org/7.6.1810/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
 
[C7.6.1810-fasttrack]
name=CentOS-7.6.1810 - Fasttrack
baseurl=http://vault.centos.org/7.6.1810/fasttrack/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

5.清空本地缓存

yum clean all
rm -rf /var/cache/yum

6.版本升级

yum -y update

#跳过有冲突的依赖
#yum -y update --skip-broken


更新完毕:
  GeoIP.x86_64 0:1.5.0-13.el7                                           NetworkManager.x86_64 1:1.12.0-10.el7_6                                           
  NetworkManager-libnm.x86_64 1:1.12.0-10.el7_6                         NetworkManager-team.x86_64 1:1.12.0-10.el7_6                                      
  NetworkManager-tui.x86_64 1:1.12.0-10.el7_6                           alsa-lib.x86_64 0:1.1.6-2.el7                                                     
  bash.x86_64 0:4.2.46-31.el7                                           bind-libs-lite.x86_64 32:9.9.4-74.el7_6.2                                         
  bind-license.noarch 32:9.9.4-74.el7_6.2                               binutils.x86_64 0:2.27-34.base.el7                                                
  ca-certificates.noarch 0:2018.2.22-70.0.el7_5                         centos-release.x86_64 0:7-6.1810.2.el7.centos                                     
  coreutils.x86_64 0:8.22-23.el7                                        cronie.x86_64 0:1.4.11-20.el7_6                                                   
  cronie-anacron.x86_64 0:1.4.11-20.el7_6                               cryptsetup-libs.x86_64 0:2.0.3-3.el7                                              
  curl.x86_64 0:7.29.0-51.el7_6.3                                       dbus.x86_64 1:1.10.24-13.el7_6                                                    
  dbus-libs.x86_64 1:1.10.24-13.el7_6                                   dhclient.x86_64 12:4.2.5-68.el7.centos.1                                          
  dhcp-common.x86_64 12:4.2.5-68.el7.centos.1                           dhcp-libs.x86_64 12:4.2.5-68.el7.centos.1                                         
  dmidecode.x86_64 1:3.1-2.el7                                          docker-ce-cli.x86_64 1:20.10.8-3.el7                                              
  dracut.x86_64 0:033-554.el7                                           dracut-config-rescue.x86_64 0:033-554.el7                                         
  dracut-network.x86_64 0:033-554.el7                                   elfutils-default-yama-scope.noarch 0:0.172-2.el7                                  
  elfutils-libelf.x86_64 0:0.172-2.el7                                  elfutils-libs.x86_64 0:0.172-2.el7                                                
  ethtool.x86_64 2:4.8-9.el7                                            file.x86_64 0:5.11-35.el7                                                         
  file-libs.x86_64 0:5.11-35.el7                                        findutils.x86_64 1:4.5.11-6.el7                                                   
  firewalld.noarch 0:0.5.3-5.el7                                        firewalld-filesystem.noarch 0:0.5.3-5.el7                                         
  freetype.x86_64 0:2.8-12.el7_6.1                                      fuse.x86_64 0:2.9.2-11.el7                                                        
  fuse-libs.x86_64 0:2.9.2-11.el7                                       glib2.x86_64 0:2.56.1-4.el7_6                                                     
  gnupg2.x86_64 0:2.0.22-5.el7_5                                        gobject-introspection.x86_64 0:1.56.1-1.el7                                       
  grub2-common.noarch 1:2.02-0.76.el7.centos.1                          grub2-pc.x86_64 1:2.02-0.76.el7.centos.1                                          
  grub2-pc-modules.noarch 1:2.02-0.76.el7.centos.1                      grubby.x86_64 0:8.28-25.el7                                                       
  hwdata.x86_64 0:0.252-9.1.el7                                         initscripts.x86_64 0:9.49.46-1.el7                                                
  iproute.x86_64 0:4.11.0-14.el7_6.2                                    iprutils.x86_64 0:2.4.16.1-1.el7                                                  
  ipset.x86_64 0:6.38-3.el7_6                                           ipset-libs.x86_64 0:6.38-3.el7_6                                                  
  iptables.x86_64 0:1.4.21-28.el7                                       iwl100-firmware.noarch 0:39.31.5.1-69.el7                                         
  iwl1000-firmware.noarch 1:39.31.5.1-69.el7                            iwl105-firmware.noarch 0:18.168.6.1-69.el7                                        
  iwl135-firmware.noarch 0:18.168.6.1-69.el7                            iwl2000-firmware.noarch 0:18.168.6.1-69.el7                                       
  iwl2030-firmware.noarch 0:18.168.6.1-69.el7                           iwl3160-firmware.noarch 0:22.0.7.0-69.el7                                         
  iwl3945-firmware.noarch 0:15.32.2.9-69.el7                            iwl4965-firmware.noarch 0:228.61.2.24-69.el7                                      
  iwl5000-firmware.noarch 0:8.83.5.1_1-69.el7                           iwl5150-firmware.noarch 0:8.24.2.2-69.el7                                         
  iwl6000-firmware.noarch 0:9.221.4.1-69.el7                            iwl6000g2a-firmware.noarch 0:17.168.5.3-69.el7                                    
  iwl6000g2b-firmware.noarch 0:17.168.5.2-69.el7                        iwl6050-firmware.noarch 0:41.28.5.1-69.el7                                        
  iwl7260-firmware.noarch 0:22.0.7.0-69.el7                             iwl7265-firmware.noarch 0:22.0.7.0-69.el7                                         
  kbd.x86_64 0:1.15.5-15.el7                                            kbd-legacy.noarch 0:1.15.5-15.el7                                                 
  kbd-misc.noarch 0:1.15.5-15.el7                                       kernel-tools.x86_64 0:3.10.0-957.27.2.el7                                         
  kernel-tools-libs.x86_64 0:3.10.0-957.27.2.el7                        kexec-tools.x86_64 0:2.0.15-21.el7_6.4                                            
  kmod.x86_64 0:20-23.el7                                               kmod-libs.x86_64 0:20-23.el7                                                      
  kpartx.x86_64 0:0.4.9-123.el7                                         libblkid.x86_64 0:2.23.2-59.el7_6.1                                               
  libcroco.x86_64 0:0.6.12-4.el7                                        libcurl.x86_64 0:7.29.0-51.el7_6.3                                                
  libdrm.x86_64 0:2.4.91-3.el7                                          libfastjson.x86_64 0:0.99.4-3.el7                                                 
  libicu.x86_64 0:50.1.2-17.el7                                         libmount.x86_64 0:2.23.2-59.el7_6.1                                               
  libmspack.x86_64 0:0.5-0.6.alpha.el7                                  libssh2.x86_64 0:1.4.3-12.el7_6.3                                                 
  libteam.x86_64 0:1.27-6.el7_6.1                                       libuuid.x86_64 0:2.23.2-59.el7_6.1                                                
  libzstd.x86_64 0:1.5.0-1.el7                                          linux-firmware.noarch 0:20180911-69.git85c5d90.el7                                
  logrotate.x86_64 0:3.8.6-17.el7                                       man-db.x86_64 0:2.6.3-11.el7                                                      
  mariadb-libs.x86_64 1:5.5.60-1.el7_5                                  microcode_ctl.x86_64 2:2.1-47.5.el7_6                                             
  nspr.x86_64 0:4.19.0-1.el7_5                                          nss.x86_64 0:3.36.0-7.1.el7_6                                                     
  nss-pem.x86_64 0:1.0.3-5.el7_6.1                                      nss-softokn.x86_64 0:3.36.0-5.el7_5                                               
  nss-softokn-freebl.x86_64 0:3.36.0-5.el7_5                            nss-sysinit.x86_64 0:3.36.0-7.1.el7_6                                             
  nss-tools.x86_64 0:3.36.0-7.1.el7_6                                   nss-util.x86_64 0:3.36.0-1.1.el7_6                                                
  open-vm-tools.x86_64 0:10.2.5-3.el7                                   openldap.x86_64 0:2.4.44-21.el7_6                                                 
  polkit.x86_64 0:0.112-18.el7_6.1                                      postfix.x86_64 2:2.10.1-7.0.1.el7.centos                                          
  procps-ng.x86_64 0:3.3.10-23.el7                                      python.x86_64 0:2.7.5-80.el7_6                                                    
  python-firewall.noarch 0:0.5.3-5.el7                                  python-libs.x86_64 0:2.7.5-80.el7_6                                               
  python-linux-procfs.noarch 0:0.4.9-4.el7                              python-perf.x86_64 0:3.10.0-957.27.2.el7.centos.plus.bug16242                     
  python-urlgrabber.noarch 0:3.10-9.el7                                 rpm.x86_64 0:4.11.3-35.el7                                                        
  rpm-build-libs.x86_64 0:4.11.3-35.el7                                 rpm-libs.x86_64 0:4.11.3-35.el7                                                   
  rpm-python.x86_64 0:4.11.3-35.el7                                     rsyslog.x86_64 0:8.24.0-34.el7                                                    
  setup.noarch 0:2.8.71-10.el7                                          sg3_utils.x86_64 0:1.37-17.el7                                                    
  sg3_utils-libs.x86_64 0:1.37-17.el7                                   shadow-utils.x86_64 2:4.1.5.1-25.el7_6.1                                          
  sudo.x86_64 0:1.8.23-3.el7                                            systemd.x86_64 0:219-62.el7_6.9                                                   
  systemd-libs.x86_64 0:219-62.el7_6.9                                  systemd-sysv.x86_64 0:219-62.el7_6.9                                              
  tar.x86_64 2:1.26-35.el7                                              teamd.x86_64 0:1.27-6.el7_6.1                                                     
  tuned.noarch 0:2.10.0-6.el7_6.4                                       tzdata.noarch 0:2019b-1.el7                                                       
  util-linux.x86_64 0:2.23.2-59.el7_6.1                                 vim-minimal.x86_64 2:7.4.160-6.el7_6                                              
  wpa_supplicant.x86_64 1:2.6-12.el7                                    xfsprogs.x86_64 0:4.5.0-19.el7_6                                                  
  yum.noarch 0:3.4.3-161.el7.centos                                     yum-plugin-fastestmirror.noarch 0:1.1.31-50.el7                                   

跳过(依赖问题):
  docker-ce.x86_64 3:20.10.8-3.el7                                     docker-ce-rootless-extras.x86_64 0:20.10.8-3.el7                                    

替代:
  grub2.x86_64 1:2.02-0.65.el7.centos.2                                     grub2-tools.x86_64 1:2.02-0.65.el7.centos.2  

7.查看版本

[root@hadoop104 yum.repos.d]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core) 
[root@hadoop104 yum.repos.d]# 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值