升级cenos7.5到指定版本
==========硬件准备=========== 1核2G 不少于 10G 磁盘空余空间 安装centos7.9以下版本 配置内网互通和IP地址 ================系统安装好 docker======= yum -y install yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum -y install docker-ce systemctl start docker systemctl enable docker docker version (客户端到此结束) ============sp安装======================= docker run -d \ --privileged \ --restart=unless-stopped \ --name=kuboard-spray \ -p 80:80/tcp \ -v /var/run/docker.sock:/var/run/docker.sock \ -v ~/kuboard-spray-data:/data \ eipwork/kuboard-spray:latest-amd64 ========升级到centos7.9==CentOS升级到指定小版本==== #备份原来源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak cat /etc/redhat-release yum clean all yum update init 6 ==========升级====== yum clean all #清除 Yum 在本机的缓存 yum repolist #查看仓库信息 yum update #更新,系统会自动更新你源配置的版本 ================== 参考 https://blog.csdn.net/SmithYan/article/details/104779272 https://www.csdn.net/tags/MtTaMg0sMzc1NjktYmxvZwO0O0OO0O0O.html https://blog.csdn.net/qq_34208660/article/details/120216328 ===================== 一,修改yum源 [root@bogon yum.repos.d]# cat 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= baseurl= gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist= baseurl= 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= #baseurl= 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= #baseurl= gpgcheck=1 enabled=0 gpgkey= 二。执行命令将7.5更新为7.6,完成后重启即可 yum update -y ====================== 操作记录如下: [root@jwbdb alpha]# chkconfig –list yum-updatesd yum-updatesd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭 [root@jwbdb alpha]# service yum-updatesd stop 停止 yum-updatesd: [确定] [root@jwbdb alpha]# service yum-updatesd status yum-updatesd 已停 [root@jwbdb alpha]# chkconfig –level 35 yum-updatesd off [root@jwbdb alpha]# chkconfig –list yum-updatesd yum-updatesd 0:关闭 1:关闭 2:启用 3:关闭 4:启用 5:关闭 6:关闭 ----------------------------------- http://olcentchan.chinacloudapp.cn/centos/7.8.2003/ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo ======================== # vim /etc/yum.repos.d/CentOS-Base.repo [base] name=CentOS-7.6.1810 - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://olcentchan.chinacloudapp.cn/centos/7.6.1810/os/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/os/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/os/$basearch/ gpgcheck=1 gpgkey=http://olcentchan.chinacloudapp.cn/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-7.6.1810 - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://olcentchan.chinacloudapp.cn/centos/7.6.1810/updates/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/updates/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/updates/$basearch/ gpgcheck=1 gpgkey=http://olcentchan.chinacloudapp.cn/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-7.6.1810 - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://olcentchan.chinacloudapp.cn/centos/7.6.1810/extras/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/extras/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/extras/$basearch/ gpgcheck=1 gpgkey=http://olcentchan.chinacloudapp.cn/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-7.6.1810 - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://olcentchan.chinacloudapp.cn/centos/7.6.1810/centosplus/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/centosplus/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://olcentchan.chinacloudapp.cn/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users [contrib] name=CentOS-7.6.1810 - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://olcentchan.chinacloudapp.cn/centos/7.6.1810/contrib/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/contrib/$basearch/ http://olcentchan.chinacloudapp.cn/centos/7.6.1810/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://olcentchan.chinacloudapp.cn/centos/RPM-GPG-KEY-CentOS-7 ===更换yum========================== # 对于 CentOS 7 sudo 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 # 对于 CentOS 8 sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \ -e 's|^#baseurl=http://mirror.centos.org/$contentdir|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos|g' \ -i.bak \ /etc/yum.repos.d/CentOS-*.repo ============================================= 更换yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 更换epel源 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo ———————————————— #更新缓存 sudo yum makecache yum clean all #重启 init 6 更新源 #yum update #升级 yum upgrade =========== # 此条不用 yum --disablerepo='*' --enablerepo='C7.5*' upgrade #检查内核版本 yum info kernel -q #查看现在可用仓库列表 yum repolist # 查看现在可用仓库版本 yum list updates | grep "centos-release" #清空本地缓存 yum clean all rm -rf /var/cache/yum # 版本升级 yum -y update # 查看更新后的版本 cat /etc/redhat-release 备份过渡的repo仓库文件,启用新版的仓库文件 # mv /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/backup/ # mv /etc/yum.repos.d/CentOS-Vault.repo.rpmnew /etc/yum.repos.d/CentOS-Vault.repo 清空本地缓存,更新版本库文件 # yum clean all # yum makecache