How to update the Azure Linux Agent on a VM

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 is 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.

Updating the Azure Linux Agent

Ubuntu

Check your current package version

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 is enabled:

cat /etc/waagent.conf

Find 'AutoUpdate.Enabled'. If you see this output, it is enabled:

# AutoUpdate.Enabled=y
AutoUpdate.Enabled=y

To enable run:

sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf

Restart the waagent service

Restart agent for 14.04

initctl restart walinuxagent

Restart agent for 16.04 / 17.04

systemctl restart walinuxagent.service

Debian

Debian 7 “Wheezy”

Check your current package version

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

This version of Debian does not have a version >= 2.0.16, therefore AutoUpdate is not available for it. The output from the above command will show you if the package is up-to-date.

Debian 8 “Jessie” / Debian 9 “Stretch”

Check your current package version

apt list --installed | grep walinuxagent

Update package cache

sudo apt-get -qq update

Install the latest package version

sudo apt-get install waagent

Ensure auto update is enabled

First, check to see if it is enabled:

cat /etc/waagent.conf

Find 'AutoUpdate.Enabled'. If you see this output, it is enabled:

# AutoUpdate.Enabled=y
AutoUpdate.Enabled=y

To enable run:

sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf

Restart the waagent service

sudo systemctl restart walinuxagent.service

Redhat / CentOS

RHEL/CentOS 6

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

Ensure auto update is enabled

First, check to see if it is enabled:

cat /etc/waagent.conf

Find 'AutoUpdate.Enabled'. If you see this output, it is enabled:

# AutoUpdate.Enabled=y
AutoUpdate.Enabled=y

To enable run:

sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf

Restart the waagent service

sudo service waagent restart

RHEL/CentOS 7

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  

Ensure auto update is enabled

First, check to see if it is enabled:

cat /etc/waagent.conf

Find 'AutoUpdate.Enabled'. If you see this output, it is enabled:

# AutoUpdate.Enabled=y
AutoUpdate.Enabled=y

To enable run:

sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf

Restart the waagent service

sudo systemctl restart waagent.service

SUSE SLES

SUSE SLES 11 SP4

Check your current package version

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 is enabled:

cat /etc/waagent.conf

Find 'AutoUpdate.Enabled'. If you see this output, it is enabled:

# AutoUpdate.Enabled=y
AutoUpdate.Enabled=y

To enable run:

sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf

Restart the waagent service

sudo /etc/init.d/waagent restart

SUSE SLES 12 SP2

Check your current package version

zypper info python-azure-agent

Check available updates

In the output from the above, this will show you if the package is upto date.

Install the latest package version

sudo zypper install python-azure-agent

Ensure auto update is enabled

First, check to see if it is enabled:

cat /etc/waagent.conf

Find 'AutoUpdate.Enabled'. If you see this output, it is enabled:

# AutoUpdate.Enabled=y
AutoUpdate.Enabled=y

To enable run:

sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf

Restart the waagent service

sudo systemctl restart waagent.service

Oracle 6 and 7

For Oracle Linux, make sure that the Addons repository is enabled. Choose to edit the file /etc/yum.repos.d/public-yum-ol6.repo(Oracle Linux 6) or /etc/yum.repos.d/public-yum-ol7.repo(Oracle Linux), and change the line enabled=0 to enabled=1 under [ol6_addons] or [ol7_addons] in this file.

Then, to install the latest version of the Azure Linux Agent, type:

sudo yum install WALinuxAgent

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=http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64
gpgkey=http://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=0

Then type:

sudo yum update WALinuxAgent

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

Install wget (there are some distros that don't install it by default, such as Redhat, CentOS, and Oracle Linux versions 6.4 and 6.5) by typing sudo yum install wget on the command line.

1. Download the latest version

Open the release of Azure Linux Agent in GitHub in a web page, and find out the latest version number. (You can locate your current version by typing waagent --version.)

For version 2.2.x or later, type:

wget https://github.com/Azure/WALinuxAgent/archive/v2.2.x.zip
unzip v2.2.x.zip.zip
cd WALinuxAgent-2.2.x

The following line uses version 2.2.0 as an example:

wget https://github.com/Azure/WALinuxAgent/archive/v2.2.14.zip
unzip v2.2.14.zip  
cd WALinuxAgent-2.2.14

2. Install the Azure Linux Agent

For version 2.2.x, use:

You may need to install the package setuptools first--see here. Then run:

sudo python setup.py install

Ensure auto update is enabled

First, check to see if it is enabled:

cat /etc/waagent.conf

Find 'AutoUpdate.Enabled'. If you see this output, it is enabled:

# AutoUpdate.Enabled=y
AutoUpdate.Enabled=y

To enable run:

sudo sed -i 's/AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf

3. Restart the waagent service

For most of Linux distros:

sudo service waagent restart

For Ubuntu, use:

sudo service walinuxagent restart

For CoreOS, use:

sudo systemctl restart waagent

4. Confirm the Azure Linux Agent version

waagent -version

For CoreOS, the above command may not work.

You will see that the Azure Linux Agent version has been updated to the new version.

For more information regarding the Azure Linux Agent, see Azure Linux Agent README.