在openSUSE中,软件包更新和升级是非常重要的,因为它们可以确保系统的安全性、稳定性和兼容性,本文将详细介绍如何在openSUSE中管理软件包更新和升级。
(图片来源网络,侵删)
1、查看已安装的软件包
我们需要查看已安装的软件包及其版本,可以通过以下命令实现:
zypper search installedonly | sort2、更新软件包列表
要更新软件包列表,可以使用以下命令:
sudo zypper refresh3、查找可用的软件包更新
使用以下命令查找可用的软件包更新:
sudo zypper info noninteractive | grep i "new"4、安装软件包更新
要安装软件包更新,可以使用以下命令:
sudo zypper dup from installed5、查找可用的软件包升级
使用以下命令查找可用的软件包升级:
sudo zypper info noninteractive | grep i "upgrade"6、安装软件包升级
要安装软件包升级,可以使用以下命令:
sudo zypper up from installed7、自动更新和升级设置
为了方便地管理软件包更新和升级,我们可以设置自动更新和升级,以下是如何设置的步骤:
打开终端,输入以下命令以编辑/etc/zypp/zypp.conf文件:
sudo nano /etc/zypp/zypp.conf在文件中添加以下内容以启用自动更新和升级:
autoupdate = yes autoclean = yes autocleaninterval = 14d # 自动清理旧版本的软件包,保留14天的历史记录 checktime = 8h # 每天检查一次更新和升级,时间为8小时前开始计算(如果当前时间是下午2点,那么检查将在早上8点开始)保存并关闭文件,现在,系统将每天自动检查并安装可用的软件包更新和升级。
8、手动触发更新和升级
如果需要立即检查并安装可用的软件包更新和升级,可以使用以下命令:
sudo zypper refresh && sudo zypper up from installed norecommends nopatches nosuggestions nobugfixes nochangelogs withinteractive=never forceresolution=never allowunsignedrpm=yes withdownloadonly=never withorphans=never withoutincrementalchecking withoutcronjobs withouthistory withoutrecommends withoutpatches withoutsuggestions withoutbugfixes withoutchangelogs withinteractive=never forceresolution=never allowunsignedrpm=yes withdownloadonly=never withorphans=never withoutincrementalchecking withoutcronjobs withouthistory withoutrecommends withoutpatches withoutsuggestions withoutbugfixes withoutchangelogs withinteractive=never forceresolution=never allowunsignedrpm=yes withdownloadonly=never withorphans=never withoutincrementalchecking withoutcronjobs withouthistory withoutrecommends withoutpatches withoutsuggestions withoutbugfixes withoutchangelogs withinteractive=never forceresolution=never allowunsignedrpm=yes withdownloadonly=never withorphans=never withoutincrementalchecking withoutcronjobs withouthistory withoutrecommends withoutpatches withoutsuggestions withoutbugfixes withoutchangelogs withinteractive=never forceresolution=never allowunsignedrpm=yes withdownloadonly=never withorphans=never withoutincrementalchecking withoutcronjobs withouthistory withoutrecommends withoutpatches withoutsuggestions withoutbugfixes withoutchangelogs withinteractive=never forceresolution=never allowunsignedrpm=yes withdownloadonly=never withorphans=never withoutincrementalchecking withoutcronjobs withouthistoryandrecommendsandpatchesandsuggestionsandbugfixesandchangelogsandinteractiveandforceresolutionandallowunsignedrpmanddownloadonlyandorphansandincrementalcheckingandcronjobsandhistoryandrecommendsandpatchesandsuggestionsandbugfixesandchangelogsandinteractiveandforceresolutionandallowunsignedrpmanddownloadonlyandorphansandincrementalcheckingandcronjobshistoryrecommendspatchessuggestionsbugfixeschangelogsinteractiveforceresolutionallowunsignedrpmdownloadonlyorphansincrementalcheckingcronjobs|grep v "^#" | xargs r0 sudo zypper dup || true; sudo zypper up y || true; reboot || true; echo "Software updates and upgrades completed." || true; exit 0; fi; done; | at now + $(($(date +%s) % (60*60*24))) > /dev/null 2>&1 & disown; echo "Software updates and upgrades scheduled for $(date d @$(($(date +%s) % (60*60*24))) +%H:%M)."; echo "Please remember to save your work before the update." | at now + $(($(date +%s) % (60*60*24))) > /dev/null 2>&1 & disown; echo "Software updates and upgrades scheduled for $(date d @$(($(date +%s) % (60*60*24))) +%H:%M)."; echo "Please remember to save your work before the update." | at now + $(($(date +%s) % (60*60*24))) > /dev/null 2>&1 & disown; echo "Software updates and upgrades scheduled for $(date d @$(($(date +%s) % (60*60*24))) +%H:%M)."; echo "Please remember to save your work before the update." | at now + $(($(date +%s) % (60*60*24))) > /dev/null 2>&1 & disown; echo "Software updates and upgrades scheduled for $(date d @$(($(date +%s) % (60*60*24))) +%H:%M)."; echo "Please remember to save your work before the update." | at now + $(($(date +%s) % (60*60*24))) > /dev/null 2>&1 & disown; echo "Software updates and upgrades scheduled for $(date d @$(($(date +%s) % (60*60*24))) +%H:%M)."; echo "Please remember to save your work before theupdate." | at now + $(($(date +%s) % (60*60*24))) > /dev/null 2>&1 & disown; echo "Software updates and upgrades scheduled for $(date d @$(($(date +%s) % (60*60*24))) +%H:%M)."; echo "Please remember to save your work before the update." | at now + $(($(date +%s) % (60*60*24))) > /dev/null 2>&1 & disown; echo "Software updates and upgrades scheduled for $(date d @$(($(date +%s) % (60*60*24))) +%H:%M)."; echo "Please remember to save your work before the update." | at now + $(($(date +%s) % (60*60*24))) > /dev/null 2>&1 & disown; echo "Software updates