[步骤] 系统升级 (从 openSUSE Leap 15.3 升级到 openSUSE Leap 15.4)

步骤一:显示现在的系统版本

# cat /etc/*release*
NAME="openSUSE Leap"
VERSION="15.3"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.3"
PRETTY_NAME="openSUSE Leap 15.3"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.3"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

(注意:确保显示的系统版本是 openSUSE Leap 15.3)

步骤二:准备升级

2.1 确认已使用的软件库

# zypper ls -d
#  | Alias                     | Name                               | Enabled | GPG Check | Refresh | Priority | Type   | URI
---+---------------------------+------------------------------------+---------+-----------+---------+----------+--------+---------------------------------------------------------------------------------------------
1  | repo-non-oss              | Non-OSS Repository                                           | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.3/repo/non-oss/
2  | repo-oss                  | Main Repository                                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.3/repo/oss/
3  | repo-update               | Main Update Repository                                       | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.3/oss/
4  | repo-update-non-oss       | Update Repository (Non-Oss)                                  | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.3/non-oss/
5  | repo-backports-update     | Update repository of openSUSE Backports                      | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.3/backports/
6  | repo-sle-update           | Update repository with updates from SUSE Linux Enterprise 15 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.3/sle/


补充:
1) 确保以上软件库已处于 Enabled 状态
2) 手动启动这些软件库的命令如下

# zypper ar -fcg http://download.opensuse.org/distribution/leap/${releasever}/repo/non-oss/ Non-OSS Repository
# zypper ar -fcg http://download.opensuse.org/distribution/leap/${releasever}/repo/oss/ Main Repository
# zypper ar -fcg http://download.opensuse.org/update/leap/${releasever}/oss/ Main Update Repository
# zypper ar -fcg http://download.opensuse.org/update/leap/${releasever}/non-oss/ Update Repository (Non-Oss)
# zypper ar -fcg http://download.opensuse.org/update/leap/${releasever}/backports/ Update repository of openSUSE Backports
# zypper ar -fcg http://download.opensuse.org/update/leap/${releasever}/sle/ Update repository with updates from SUSE Linux Enterprise 15

2.2 刷新已使用的软件库

# zypper ref

(注意:确保刷新成功,否则请检查网络)

2.3 将所有 openSUSE Leap 15.3 软件包更新到最新版本

# zypper -n update

2.4 用 releasever 变量替换所有版本号

# sed -i 's/15.3/${releasever}/g' /etc/zypp/repos.d/*.repo

步骤三:升级系统

3.1 将版本号设置为 15.4 并刷新

# zypper --releasever=15.4 refresh

3.2 提前下载并安装 openSUSE Leap 15.4 所需的软件包

# zypper --releasever=15.4 dup --download-in-advance

3.3 升级系统

# zypper --releasever=15.4 dup

3.4 重启系统

# reboot

步骤四:后续检查

4.1 显示升级后的系统版本

# cat /etc/*release*
NAME="openSUSE Leap"
VERSION="15.4"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.4"
PRETTY_NAME="openSUSE Leap 15.4"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.4"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

4.2 显示升级后已使用的软件库

# zypper ls -d
#  | Alias                     | Name                                                         | Enabled | GPG Check | Refresh | Priority | Type   | URI
---+---------------------------+------------------------------------+---------+-----------+---------+----------+--------+---------------------------------------------------------------------------------------------
1  | repo-non-oss              | Non-OSS Repository                                           | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.4/repo/non-oss/
2  | repo-oss                  | Main Repository                                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.4/repo/oss/
3  | repo-update               | Main Update Repository                                       | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/oss/
4  | repo-update-non-oss       | Update Repository (Non-Oss)                                  | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/non-oss/
5  | repo-backports-update     | Update repository of openSUSE Backports                      | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/backports/
6  | repo-sle-update           | Update repository with updates from SUSE Linux Enterprise 15 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/sle/

[步骤] RHEL 系统的注册 (注册到 Red Hat 官网)

正文:

步骤一:清除旧有的注册信息

1.1 清除所有的旧有注册信息

# subscription-manager remove --all

1.2 取消注册

# subscription-manager unregister

1.3 清楚所有的就有数据

# subscription-manager clean

1.4 确保所有 satellite 客户端安装包已经删除

# yum remove katello-ca-consumer-*

步骤二:确保 RHEL 系统的注册网站指向 Red Hat 官网

# vim /etc/rhsm/rhsm.conf

确保部分内容如下:

......
hostname = subscription.rhsm.redhat.com
......
baseurl = https://cdn.redhat.com
......

步骤三:注册 RHEL 系统到 Red Hat 官网

3.1 非交互式

# subscription-manager register --username <username> --password <password> --auto-attach

(注意:如果完成了本文的 2.1 就不用再执行 本文的 2.2 了)

3.2 交互式注册 RHEL 系统到 Red Hat 官网

3.2.1 交互式注册 RHEL 系统到 Red Hat 官网
# subscription-manager register
3.2.2 在 Red Hat 官网上将相关订阅 (license) 分配给系统

登录 Red Hat 官网 –> Red Hat Customer Portal –> subscriptions –> systems –> <system name> –> 添加订阅

3.2.3 刷新订阅
# subscription-manager refresh

参考文献:

https://access.redhat.com/solutions/253273

[内容] Linux 软件指定版本的升级或降级 (CentOS Linux 7 版) (以系统版本作为指定维度)

内容一:将软件降级到某个版本

# yum --disablerepo='*' --enablerepo='C7.6*' update openssh

(补充:这里以将 openssh 软件升级到 CentOS Linux 7.6 系统版本里的最新版本为例为例)

或者:

# yum --disablerepo='*' --enablerepo='C7.6*' upgrade openssh

(补充:这里以将 openssh 软件升级到 CentOS Linux 7.6 系统版本里的最新版本为例为例)

内容二:将软件降级到某个版本

# yum --disablerepo='*' --enablerepo='C7.6*' downgrade openssh

(补充:这里以将 openssh 软件降级到 CentOS Linux 7.6 系统版本里的最新版本为例为例)

[步骤] Linux 系统指定版本的升级 (CentOS Linux 7 版)

步骤一:安装其他版本软件源

1.1 安装 centos-release

# yum install centos-release

1.2 查看当前所有软件源

# yum repolist all

或者:

# cat /etc/yum.repos.d/CentOS-Vault.repo

步骤二:清除 yum 缓存

2.1 除 yum 缓存

# yum clean all

2.2 删除 yum 缓存目录

# rm -rf /var/cache/yum

步骤三:将系统或软件升级到指定版本

3.1 方案一:将整个系统升级到指定版本

# yum --disablerepo='*' --enablerepo='C7.6*' update

(补充:这里以将整个系统升级到 CentOS Linux 7.6 版本为例)

(注意:系统中其他所有软件都会升级到 CentOS Linux 7.6 系统版本中的最新版本)

或者:

# yum --disablerepo='*' --enablerepo='C7.6*' upgrade

(补充:这里以将整个系统升级到 CentOS Linux 7.6 版本为例)

(注意:系统中其他所有软件都会升级到 CentOS Linux 7.6 系统版本中的最新版本)

3.2 方案二:只将系统内核或某个软件升级到指定版本

# yum --disablerepo='*' --enablerepo='C7.6*' update kernel

(补充:这里以只将系统内核 kernel 升级到 CentOS Linux 7.6 系统版本里的最新版本为例)

或者:

# yum --disablerepo='*' --enablerepo='C7.6*' upgrade kernel

(补充:这里以只将系统内核 kernel 升级到 CentOS Linux 7.6 系统版本里的最新版本为例)