使用命令行升级Ubuntu系统更新包(update, upgrade, full-upgrade, dist-upgrade)
Ubuntu系统会经常提示有新的软件升级可以使用
When I log into my web server via SSH I see the information:
88 packages can be updated.
80 updates are security updates
I tried apt-get update
then apt-get upgrade
but each time I log in I still see the message about updates. How do I install them?
升级或更新这些Ubuntu系统更新的方法
Use this:
sudo apt update # Fetches the list of available updates
sudo apt upgrade # Installs some updates; does not remove packages
sudo apt full-upgrade # Installs updates; may also remove some packages, if needed
sudo apt autoremove # Removes any old packages that are no longer needed
Documentation about each apt
option can be found in the the manpages for apt. These are also available by running man apt
in your terminal.
Use of both upgrade
and full-upgrade
together is usually not needed, but it may help in some cases: see Debian documentation about Upgrades from Debian 9.
命令行说明2
Execute all the commands by typing sudo
once:
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get full-upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'
or:
sudo -s -- <<EOF
apt-get update
apt-get upgrade -y
apt-get full-upgrade -y
apt-get dist-upgrade -y
apt-get autoremove -y
apt-get autoclean -y
EOF
or even shorter in a for loop (thanks @dessert!):
sudo bash -c 'for i in update {,full-,dist-}upgrade auto{remove,clean}; do apt-get $i -y; done'
You can optionally run dist-upgrade
command, which will perform any additional upgrades that involve changing dependencies by adding or removing new packages as necessary.
See the package management with APT maintenance commands documentation for more details.
本文文字及图片出自 出处