How to update the Azure Linux Agent on a VM
Bài viết 08/22/2024
18 người đóng góp
Phản hồi
Trong bài viết này
Caution
This article references CentOS, a Linux distribution that is End Of Life (EOL) status. Please consider your use and plan accordingly. For more information, see the CentOS End Of Life guidance .
To update your Azure Linux Agent on a Linux VM in Azure, you must already have:
A running Linux VM in Azure.
A connection to that Linux VM using SSH.
You should always check for a package in the Linux distro repository first. It's possible the package available may not be the latest version, however, enabling autoupdate will ensure the Linux Agent will always get the latest update. Should you have issues installing from the package managers, you should seek support from the distro vendor.
Verify the Minimum version support for virtual machine agents in Azure before proceeding.
Check your current package version
sudo apt list --installed | grep walinuxagent
Update package cache
sudo apt-get -qq update
Install the latest package version
sudo apt-get install walinuxagent
Ensure auto update is enabled.
First, check to see if it's enabled:
sudo cat /etc/waagent.conf | grep -i autoupdate
Find 'AutoUpdate.Enabled'. If you see this output, it's enabled:
AutoUpdate.Enabled=y
sudo sed -i 's/# AutoUpdate.Enabled=y/AutoUpdate.Enabled=y/g' /etc/waagent.conf
Restart the waagent service
sudo systemctl restart walinuxagent
Validate waagent service is up and running
sudo systemctl status walinuxagent
Check your current package version
sudo yum list WALinuxAgent
Check available updates
sudo yum check-update WALinuxAgent
Install the latest package version
sudo yum install WALinuxAgent -y
Ensure auto update is enabled
First, check to see if it's enabled:
sudo cat /etc/waagent.conf | grep -i autoupdate
Find 'AutoUpdate.Enabled'. If you see this text, it's enabled:
AutoUpdate.Enabled=y
sudo sed -i 's/\# AutoUpdate.Enabled=y/AutoUpdate.Enabled=y/g' /etc/waagent.conf
Restart the waagent service
sudo systemctl restart waagent
Validate waagent service is up and running
sudo systemctl status waagent
Check your current package version
sudo zypper info python-azure-agent
Check available updates. The above output will show you if the package is up to date.
Install the latest package version
sudo zypper install python-azure-agent
Ensure auto update is enabled
First, check to see if it's enabled:
sudo cat /etc/waagent.conf | grep -i autoupdate
Find 'AutoUpdate.Enabled'. If you see this output, it's enabled:
AutoUpdate.Enabled=y
sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf
Restart the waagent service
sudo systemctl restart waagent
Validate waagent service is up and running
sudo systemctl status waagent
Check your current package version
sudo dpkg -l | grep waagent
Update package cache
sudo apt-get -qq update
Install the latest package version
sudo apt-get install waagent
Enable agent auto update.
First, check to see if it's enabled:
sudo cat /etc/waagent.conf | grep -i autoupdate
Find 'AutoUpdate.Enabled'. If you see this output, it's enabled:
AutoUpdate.Enabled=y
sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf
Restart the waagent service:
sudo systemctl restart walinuxagent.service
Validate waagent service is up and running
sudo systemctl status walinuxagent
For Oracle Linux, make sure that the Addons
repository is enabled.
To validate if the repository is enabled, use the following command
sudo yum repolist all | grep -i addons
In case the Addons
repository is disabled, you can enable it using the following command:
sudo yum-config-manager --enable ol6_addons
sudo yum-config-manager --enable ol7_addons
sudo yum-config-manager --enable ol8_addons
sudo yum-config-manager --enable ol9_addons
If you don't find the add-on repository, you can simply add these lines at the end of your .repo
file according to your Oracle Linux release:
For Oracle Linux 6 virtual machines:
[ol6_addons]
name=Add-Ons for Oracle Linux $releasever ($basearch)
baseurl=https://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64
gpgkey=https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=1
For Oracle Linux 7 virtual machines:
[ol7_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
For Oracle Linux 8 virtual machines:
[ol8_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL8/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
For Oracle Linux 9 virtual machines:
[ol9_addons]
name=Oracle Linux 9 Addons ($basearch)
baseurl=https://public-yum.oracle.com/repo/OracleLinux/OL9/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
Then install the latest version of the Azure Linux Agent using the following command:
sudo yum install WALinuxAgent -y
Enable agent auto update.
First, check to see if it's enabled:
sudo cat /etc/waagent.conf | grep -i autoupdate
Find 'AutoUpdate.Enabled'. If you see this output, it's enabled:
AutoUpdate.Enabled=y
sudo sed -i 's/\# AutoUpdate.Enabled=y/AutoUpdate.Enabled=y/g' /etc/waagent.conf
Restart the waagent service:
sudo service waagent restart
Validate waagent service is up and running
sudo systemctl status waagent
In case of issues, execute the following commands and validate the waagent status one more time:
sudo systemctl daemon-reload
sudo systemctl restart waagent
sudo systemctl status waagent
Typically this is all you need, but if for some reason you need to install it from https://github.com directly, use the following steps.
Update the Linux Agent when no agent package exists for distribution
For more information regarding updating the Azure Linux Agent when no package exists, see Azure Linux Agent README .