当前版本是leap 15.1
tonixtom:~ # sudo hostnamectl
Static hostname: tonixtom
Icon name: computer-vm
Chassis: vm
Machine ID: 2ec419bbf6bb4bb18edb3d4fb0e0dbbc
Boot ID: ce5c3476f8694b66884b9b6dfce23497
Virtualization: vmware
Operating System: openSUSE Leap 15.1
CPE OS Name: cpe:/o:opensuse:leap:15.1
Kernel: Linux 4.12.14-lp151.28.91-default
Architecture: x86-64
tonixtom:~ # zypper repos --uri | grep -i update
4 | repo-debug-update | Update Repository (Debug) | No | ---- | ---- | http://download.opensuse.org/debug/update/leap/15.1/oss/
5 | repo-debug-update-non-oss | Update Repository (Debug, Non-OSS) | No | ---- | ---- | http://download.opensuse.org/debug/update/leap/15.1/non-oss/
10 | repo-update | Main Update Repository | Yes | (r ) Yes | Yes | http://download.opensuse.org/update/leap/15.1/oss/
11 | repo-update-non-oss | Update Repository (Non-Oss) | Yes | (r ) Yes | Yes | http://download.opensuse.org/update/leap/15.1/non-oss/
tonixtom:~ # zypper ref
Repository 'Non-OSS Repository' is up to date.
Repository 'Main Repository' is up to date.
Repository 'Main Update Repository' is up to date.
Repository 'Update Repository (Non-Oss)' is up to date.
All repositories have been refreshed.
tonixtom:~ # sudo zypper up
Loading repository data...
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...
Nothing to do.
tonixtom:~ # zypper lr -u #查看链接
Repository priorities are without effect. All enabled repositories share the same priority.
# | Alias | Name | Enabled | GPG Check | Refresh | URI
---+---------------------------+------------------------------------+---------+-----------+---------+-------------------------------------------------------------------------------------
1 | openSUSE-Leap-15.1-1 | openSUSE-Leap-15.1-1 | No | ---- | ---- | cd:/?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001
2 | repo-debug | Debug Repository | No | ---- | ---- | http://download.opensuse.org/debug/distribution/leap/15.1/repo/oss/
3 | repo-debug-non-oss | Debug Repository (Non-OSS) | No | ---- | ---- | http://download.opensuse.org/debug/distribution/leap/15.1/repo/non-oss/
4 | repo-debug-update | Update Repository (Debug) | No | ---- | ---- | http://download.opensuse.org/debug/update/leap/15.1/oss/
5 | repo-debug-update-non-oss | Update Repository (Debug, Non-OSS) | No | ---- | ---- | http://download.opensuse.org/debug/update/leap/15.1/non-oss/
6 | repo-non-oss | Non-OSS Repository | Yes | (r ) Yes | Yes | http://download.opensuse.org/distribution/leap/15.1/repo/non-oss/
7 | repo-oss | Main Repository | Yes | (r ) Yes | Yes | http://download.opensuse.org/distribution/leap/15.1/repo/oss/
8 | repo-source | Source Repository | No | ---- | ---- | http://download.opensuse.org/source/distribution/leap/15.1/repo/oss/
9 | repo-source-non-oss | Source Repository (Non-OSS) | No | ---- | ---- | http://download.opensuse.org/source/distribution/leap/15.1/repo/non-oss/
10 | repo-update | Main Update Repository | Yes | (r ) Yes | Yes | http://download.opensuse.org/update/leap/15.1/oss/
11 | repo-update-non-oss | Update Repository (Non-Oss) | Yes | (r ) Yes | Yes | http://download.opensuse.org/update/leap/15.1/non-oss/
tonixtom:/home/tom # zypper rr openSUSE-Leap-15.1-1 #删除最初的安装盘源
Removing repository 'openSUSE-Leap-15.1-1' ...............................................................................................................................................................................................................[done]
Repository 'openSUSE-Leap-15.1-1' has been removed.
tonixtom:/home/tom # zypper lr -u
Repository priorities are without effect. All enabled repositories share the same priority.
# | Alias | Name | Enabled | GPG Check | Refresh | URI
---+---------------------------+------------------------------------+---------+-----------+---------+-------------------------------------------------------------------------
1 | repo-debug | Debug Repository | No | ---- | ---- | http://download.opensuse.org/debug/distribution/leap/15.1/repo/oss/
2 | repo-debug-non-oss | Debug Repository (Non-OSS) | No | ---- | ---- | http://download.opensuse.org/debug/distribution/leap/15.1/repo/non-oss/
3 | repo-debug-update | Update Repository (Debug) | No | ---- | ---- | http://download.opensuse.org/debug/update/leap/15.1/oss/
4 | repo-debug-update-non-oss | Update Repository (Debug, Non-OSS) | No | ---- | ---- | http://download.opensuse.org/debug/update/leap/15.1/non-oss/
5 | repo-non-oss | Non-OSS Repository | Yes | (r ) Yes | Yes | http://download.opensuse.org/distribution/leap/15.1/repo/non-oss/
6 | repo-oss | Main Repository | Yes | (r ) Yes | Yes | http://download.opensuse.org/distribution/leap/15.1/repo/oss/
7 | repo-source | Source Repository | No | ---- | ---- | http://download.opensuse.org/source/distribution/leap/15.1/repo/oss/
8 | repo-source-non-oss | Source Repository (Non-OSS) | No | ---- | ---- | http://download.opensuse.org/source/distribution/leap/15.1/repo/non-oss/
9 | repo-update | Main Update Repository | Yes | (r ) Yes | Yes | http://download.opensuse.org/update/leap/15.1/oss/
10 | repo-update-non-oss | Update Repository (Non-Oss) | Yes | (r ) Yes | Yes | http://download.opensuse.org/update/leap/15.1/non-oss/
tonixtom:/home/tom #
#源更新脚本
tonixtom:~ # cat update.sh
#!/bin/bash
files="$(zypper lr -u | awk -F'|' '$4 ~ /Yes/ { gsub (" ", "", $2); r="/etc/zypp/repos.d/"$2".repo"; print r }')"
for f in $files
do
echo "Backup of $f saved to /root/ before patching it up ..."
cp -f "$f" /root/tom
sed -i 's+/leap/15.1+/leap/$releasever+' "$f"
sed -i 's+15.1.1+15.3+' "$f"
sed -i 's+15.1+15.3+' "$f"
done
tonixtom:~ #
tonixtom:~ # ./update.sh
Backup of /etc/zypp/repos.d/repo-non-oss.repo saved to /root/ before patching it up ...
Backup of /etc/zypp/repos.d/repo-oss.repo saved to /root/ before patching it up ...
Backup of /etc/zypp/repos.d/repo-update.repo saved to /root/ before patching it up ...
Backup of /etc/zypp/repos.d/repo-update-non-oss.repo saved to /root/ before patching it up ...
tonixtom:~ # ls
tonixtom:/home/tom # sudo zypper ar -cfp 90 http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_15.3/ packman #安装packman源
Adding repository 'packman' ..............................................................................................................................................................................................................................[done]
Repository 'packman' successfully added
URI : http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_15.3/
Enabled : Yes
GPG Check : Yes
Autorefresh : Yes
Priority : 90 (raised priority)
Repository priorities in effect: (See 'zypper lr -P' for details)
90 (raised priority) : 1 repository
99 (default priority) : 4 repositories
tonixtom:/home/tom #
tonixtom:/home/tom # zypper mr -d packman
Repository 'packman' has been successfully disabled.
tonixtom:/home/tom #
更新zypper
zypper patch --updatestack-only
tonixtom:/home/tom # zypper --releasever=15.3 refresh
Warning: Enforced setting: $releasever=15.3
Retrieving repository 'Non-OSS Repository' metadata ......................................................................................................................................................................................................[done]
Building repository 'Non-OSS Repository' cache ...........................................................................................................................................................................................................[done]
Retrieving repository 'Main Repository' metadata .........................................................................................................................................................................................................[done]
Building repository 'Main Repository' cache ..............................................................................................................................................................................................................[done]
Retrieving repository 'Main Update Repository' metadata ..................................................................................................................................................................................................[done]
Building repository 'Main Update Repository' cache .......................................................................................................................................................................................................[done]
Retrieving repository 'Update Repository (Non-Oss)' metadata .............................................................................................................................................................................................[done]
Building repository 'Update Repository (Non-Oss)' cache ..................................................................................................................................................................................................[done]
All repositories have been refreshed.
tonixtom:/home/tom #
tonixtom:/home/tom # zypper --releasever=15.3 dup --force-resolution
Warning: Enforced setting: $releasever=15.3
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...
tonixtom:/home/tom # rpmconfigcheck #检查配置文件变化
Searching for unresolved configuration files
Please check the following files (see /var/adm/rpmconfigcheck):
/etc/chrony.conf.rpmnew
/etc/nsswitch.conf.rpmnew
/etc/postfix/main.cf.rpmnew
/etc/postfix/master.cf.rpmnew
/etc/pulse/client.conf.d/50-system.conf.rpmsave
Executing %posttrans scripts ......................................................................[done]
There are running programs which still use files and libraries deleted or updated by recent upgrades. They should be restarted to benefit from the latest updates. Run 'zypper ps -s' to list these programs.
Core libraries or services have been updated.
Reboot is required to ensure that your system benefits from these updates.
....
tonixtom:~ # reboot
升级到leap 15.3
tom@tonixtom:~> sudo hostnamectl
[sudo] password for root:
Static hostname: tonixtom
Icon name: computer-vm
Chassis: vm
Machine ID: 2ec419bbf6bb4bb18edb3d4fb0e0dbbc
Boot ID: 3791127d7d534bb4b3aab8604281f75f
Virtualization: vmware
Operating System: openSUSE Leap 15.3
CPE OS Name: cpe:/o:opensuse:leap:15.3
Kernel: Linux 5.3.18-59.10-default
Architecture: x86-64
tom@tonixtom:~>