Is it possible to upgrade the OS on GCP Compute Engine VM? Can I just run dist-upgrade or do I have to follow a different steps like taking a snapshot of the Disk and spin a new upgraded VM and mount the Disk?
Is it possible to upgrade the OS on GCP Compute Engine VM? Can I just run dist-upgrade or do I have to follow a different steps like taking a snapshot of the Disk and spin a new upgraded VM and mount the Disk?
You can perform a full inplace OS upgrade but it's not recommended. If for example there's a need to confirm anything during the reboot process you won't be able to do it remotely. You may try to use serial console interaction but it's always a risk.
It's best to clone the VM an try the upgrade on the copy first.
For the test purposes I've tested upgrading from
Debian 9 Stretch
toDebian 10 Buster
. Here's how:First I've created a new GCP instance running Debian 9 (default settings); then I logged in via SSH and ran fallowing commands:
First I've changed
/etc/apt/sources.list
allstretch
tobuster
occurences (necessary to go from 9 to 10) withsudo sed -i 's/stretch/buster/g' /etc/apt/sources.list
and next ran:
lsb_release -a
- check current OS versionsudo apt update
sudo apt upgrade -y
lsb_release -a
- verify after upgradeIf everything's OK you should see:
I was able to SSH into my instance using GCP console with no issues. As you can see I've used just "apt upgrade" since it will just upgrade installed packages. You can check the difference between
upgrade
vsdist-upgrade
in this answer.I can't say if it's possible with Red Hat or CentOS but I can make and educated guess and say it's possible in the same way as with Debian.