On Compute Engine you can manage the operating systems that are running on your virtual machines (VMs) by using VM Manager .
This page describes how to upgrade an existing setup of VM Manager . Google recommends that you use the latest version of the agent.
Before you begin
- If you haven't already, set up authentication 
.
  Authentication verifies your identity for access to Google Cloud services and APIs. To run
  code or samples from a local development environment, you can authenticate to
  Compute Engine by selecting one of the following options: 
-  
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .
 - Set a default region and zone .
 
 -  
 
Overview
To update your VM Manager setup, complete the following steps:
-  Check the current version 
of the OS Config agent that is installed
on your VMs. For more information about the OS Config agent versions,
see the GoogleCloudPlatform/osconfig 
GitHub repository. 
- To use OS inventory management, your VM must be running an
OS Config agent version dated 
20201110or later - To use OS policies, your VM must be running an
OS Config agent version dated 
20210427or later. 
 - To use OS inventory management, your VM must be running an
OS Config agent version dated 
 - If the version of your OS config agent does not support the new features, update the OS Config agent .
 
View OS Config agent version
If you have OS inventory management (earlier version) running on your VMs, you can check the OS Config agent version by running the following command:
gcloud compute instances os-inventory describe VM-NAME \ --zone= ZONE
Replace the following:
-  
VM-NAME: the name of your VM -  
ZONE: the zone where the VM is located 
In the output, search for OSConfigAgentVersion 
.
OSConfigAgentVersion: 20210316.00-g1
In the preceding output snippet, the OS Config agent version is dated 20210316 
(2021-03-16).
Update the OS Config agent
To update the OS Config agent, do one of the following:
- Update the package for your operating system
 - Run a patch job
 
Update OS packages
One method of updating the OS Config agent is to update the package for your operating system.
CentOS/RHEL/Rocky
To update the agent on CentOS, Rocky Linux, and RHEL operating systems, run the following command:
sudo yum update google-osconfig-agent
Debian
To update the agent on Debian operating systems, run the following commands:
sudo apt update sudo apt install google-osconfig-agent
SLES
To update the agent on SLES, run the following command:
sudo zypper -n update google-osconfig-agent
To update the agent on SLES VMs, you can also do a reinstall of the agent using the Google-provided packages. To do an install using Google-provided packages, see Install the OS Config agent .
Ubuntu
To update the agent on Ubuntu operating systems, run the following commands:
sudo apt update sudo apt install google-osconfig-agent
To update the agent on Ubuntu VMs, we recommend that you do a reinstall of the agent using the Google-provided packages. To do an install using Google-provided packages, see Install the OS Config agent .
Windows
To update the agent on Windows operating systems, run the following command:
googet install google-osconfig-agent
Run a patch job
Another method of updating the OS Config agent is by running a patch job and
specifying the exclusive_packages 
flag. This patch job only updates the OS
Config agent on the target VMs.
To set the target VMs, you need to specify an  INSTANCE_FILTER 
 
.
For more information about instance filters,
see instance filters 
.
CentOS/RHEL/Rocky
To update the agent for CentOS, Rocky Linux and RHEL VMs, run the following command:
gcloud compute os-config patch-jobs execute INSTANCE_FILTER \ --yum-exclusive-packages=google-osconfig-agent
Debian
To update the agent for Debian VMs, run the following commands:
gcloud compute os-config patch-jobs execute INSTANCE_FILTER \ --apt-exclusive-packages=google-osconfig-agent
SLES
To update the agent for SLES VMs, run the following command:
gcloud compute os-config patch-jobs execute INSTANCE_FILTER \ --zypper-exclusive-patches=google-osconfig-agent
To update the agent on SLES VMs, you can also do a reinstall of the agent using the Google-provided packages. To do an install using Google-provided packages, see Install the OS Config agent .
Ubuntu
To update the agent for Ubuntu VMs, run the following commands:
gcloud compute os-config patch-jobs execute INSTANCE_FILTER \ --apt-exclusive-packages=google-osconfig-agent
To update the agent on Ubuntu VMs, we recommend that you do a reinstall of the agent using the Google-provided packages. To do an install using Google-provided packages, see Install the OS Config agent .
Windows
To update the agent for Windows VMs, run the following command:
gcloud compute os-config patch-jobs execute INSTANCE_FILTER \ --windows-exclusive-patches=google-packages

