1
General Discussion / Re: Azure Linux Agent Install
« on: May 02, 2024, 04:16:23 am »
UPDATE: After posting this I was able to piece together some other articles and get this working. These are just my quick notes so someone smarter than me should be able to polish this up.
#Disable the default swap file - Azure agent mounts a temp volume presented to the VM and creates its own swap file
swapoff /dev/gpt/swapfs
#Install the agent dependencies
pkg upgrade
pkg install -y sudo bash git
# check on the python path -- at the time of this post it's 3.9 and create the link for python
ls /usr/local/bin/python*
ln -s /usr/local/bin/python3.9 /usr/local/bin/python
# clone the agent
git clone https://github.com/Azure/WALinuxAgent.git
cd WALinuxAgent
#check the current stable build -- at the time of this post it's v2.10.0.8
git checkout v2.10.0.8
#install the agent and register it as a service
python setup.py install --register-service
#create links for the agent
ln -sf /usr/local/sbin/waagent /usr/sbin/waagent
ln -sf /usr/local/sbin/waagent2.0 /usr/sbin/waagent2.0
#Setup the agent service scripts
echo '#! /bin/sh' >> /usr/local/etc/rc.d/waagent.sh
echo '/usr/local/sbin/waagent --daemon' >> /usr/local/etc/rc.d/waagent.sh
chmod +x /usr/local/etc/rc.d/waagent.sh
echo 'waagent_enable="YES"' >> /etc/rc.conf.local
#Change the agent built swap from 16gb default to 6gb -- the temp volume in my VM was only 8GB
sed -i .bak 's/ResourceDisk.SwapSizeMB=16384/ResourceDisk.SwapSizeMB=6144/g' /etc/waagent.conf
#A quick version check. If this doesn't return the version something went wrong
waagent -version
service waagent status
service waagent start
service waagent status
#Disable the default swap file - Azure agent mounts a temp volume presented to the VM and creates its own swap file
swapoff /dev/gpt/swapfs
#Install the agent dependencies
pkg upgrade
pkg install -y sudo bash git
# check on the python path -- at the time of this post it's 3.9 and create the link for python
ls /usr/local/bin/python*
ln -s /usr/local/bin/python3.9 /usr/local/bin/python
# clone the agent
git clone https://github.com/Azure/WALinuxAgent.git
cd WALinuxAgent
#check the current stable build -- at the time of this post it's v2.10.0.8
git checkout v2.10.0.8
#install the agent and register it as a service
python setup.py install --register-service
#create links for the agent
ln -sf /usr/local/sbin/waagent /usr/sbin/waagent
ln -sf /usr/local/sbin/waagent2.0 /usr/sbin/waagent2.0
#Setup the agent service scripts
echo '#! /bin/sh' >> /usr/local/etc/rc.d/waagent.sh
echo '/usr/local/sbin/waagent --daemon' >> /usr/local/etc/rc.d/waagent.sh
chmod +x /usr/local/etc/rc.d/waagent.sh
echo 'waagent_enable="YES"' >> /etc/rc.conf.local
#Change the agent built swap from 16gb default to 6gb -- the temp volume in my VM was only 8GB
sed -i .bak 's/ResourceDisk.SwapSizeMB=16384/ResourceDisk.SwapSizeMB=6144/g' /etc/waagent.conf
#A quick version check. If this doesn't return the version something went wrong
waagent -version
service waagent status
service waagent start
service waagent status