PageRenderTime 29ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/articles/virtual-machines/virtual-machines-linux-agent-user-guide.md

https://gitlab.com/mayakarya/azure-content
Markdown | 348 lines | 221 code | 127 blank | 0 comment | 0 complexity | 2b3262550e45e841d5f7d6eba23b5c9a MD5 | raw file
  1. <properties
  2. pageTitle="Linux Agent User Guide | Microsoft Azure"
  3. description="Learn how to install and configure Linux Agent (waagent) to manage your virtual machine's interaction with Azure Fabric Controller."
  4. services="virtual-machines-linux"
  5. documentationCenter=""
  6. authors="szarkos"
  7. manager="timlt"
  8. editor=""
  9. tags="azure-service-management,azure-resource-manager" />
  10. <tags
  11. ms.service="virtual-machines-linux"
  12. ms.workload="infrastructure-services"
  13. ms.tgt_pltfrm="vm-linux"
  14. ms.devlang="na"
  15. ms.topic="article"
  16. ms.date="07/13/2016"
  17. ms.author="szark"/>
  18. #Azure Linux Agent User Guide
  19. [AZURE.INCLUDE [learn-about-deployment-models](../../includes/learn-about-deployment-models-both-include.md)]
  20. ##Introduction
  21. The Azure Linux Agent (/usr/sbin/waagent) manages interaction between a virtual machine and the Azure Fabric Controller. Please also see [How to update the Azure Linux Agent](virtual-machines-linux-update-agent.md) for information about installing and updating the agent on a running VM.
  22. The Azure Linux Agent is responsible for the following:
  23. > [AZURE.NOTE] Please see the Azure Linux agent [README](https://github.com/Azure/WALinuxAgent/blob/master/README.md) for the latest version of this guide.
  24. * **Image Provisioning**
  25. - Create a user account
  26. - Configure SSH authentication types
  27. - Deploy SSH public keys and key pairs
  28. - Sets the host name
  29. - Publishes the host name to the platform DNS
  30. - Reports SSH host key fingerprint to the platform
  31. - Manages the resource disk
  32. - Formats and mounts the resource disk
  33. - Configures swap space
  34. * **Networking**
  35. - Manages routes to improve compatibility with platform DHCP servers
  36. - Ensures the stability of the network interface name
  37. * **Kernel**
  38. - Configures virtual NUMA
  39. - Consumes Hyper-V entropy for /dev/random
  40. - Configures SCSI timeouts for the root device (which could be remote)
  41. * **Diagnostics**
  42. - Redirects the console to the serial port
  43. * **SCVMM Deployments**
  44. - Detects and bootstraps the VMM agent for Linux when running in a System Center Virtual Machine Manager 2012 R2 environment
  45. * **VM Extension**
  46. - Inject component authored by Microsoft and Partners into Linux VM (IaaS) to enable software and configuration automation
  47. - VM Extension reference implementation on [https://github.com/Azure/azure-linux-extensions](https://github.com/Azure/azure-linux-extensions)
  48. ##Communication
  49. The information flow from the platform to the agent occurs via two channels:
  50. * A boot-time attached DVD for IaaS deployments. This DVD includes an OVF-compliant configuration file that includes all provisioning information other than the actual SSH keypairs.
  51. * A TCP endpoint exposing a REST API used to obtain deployment and topology configuration.
  52. ###Getting the Linux Agent
  53. You can get the Latest Linux Agent directly from:
  54. - [The different Distribution providers endorsing Linux on Azure](http://support.microsoft.com/kb/2805216)
  55. - or from the [GitHub Open Source Repository for the Azure Linux Agent](https://github.com/Azure/WALinuxAgent)
  56. ## Requirements
  57. The following systems have been tested and are known to work with the Azure Linux Agent. **Please note that this list may differ from the official list of supported systems on the Microsoft Azure Platform**, as described here:
  58. [http://support.microsoft.com/kb/2805216](http://support.microsoft.com/kb/2805216)
  59. ###Supported Linux Distributions
  60. * CoreOS
  61. * CentOS 6.2+
  62. * Debian 7.0+
  63. * Ubuntu 12.04+
  64. * openSUSE 12.3+
  65. * SLES 11 SP2+
  66. * Oracle Linux 6.4+
  67. * Red Hat 6.7+
  68. Other Supported Systems:
  69. * FreeBSD 9+ (Azure Linux Agent v2.0.10+)
  70. The Linux agent depends on some system packages in order to function properly:
  71. * Python 2.6+
  72. * Openssl 1.0+
  73. * Openssh 5.3+
  74. * Filesystem utilities: sfdisk, fdisk, mkfs, parted
  75. * Password tools: chpasswd, sudo
  76. * Text processing tools: sed, grep
  77. * Network tools: ip-route
  78. ##Installation
  79. Installation using an RPM or a DEB package from your distribution's package repository is the preferred method of installing and upgrading the Azure Linux Agent.
  80. If installing manually, the 'waagent' script should be copied to /usr/sbin/waagent and installed by running:
  81. # sudo chmod 755 /usr/sbin/waagent
  82. # sudo /usr/sbin/waagent -install -verbose
  83. The agent's log file is kept at /var/log/waagent.log.
  84. ##Command Line Options
  85. ###Flags
  86. - verbose: Increase verbosity of specified command
  87. - force: Skip interactive confirmation for some commands
  88. ###Commands
  89. - help: Lists the supported commands and flags.
  90. - install: Manual installation of the agent
  91. * Checks the system for required dependencies
  92. * Creates the SysV init script (/etc/init.d/waagent), the logrotate configuration file (/etc/logrotate.d/waagent and configures the image to run the init script on boot
  93. * Writes sample configuration file to /etc/waagent.conf
  94. * Any existing configuration file is moved to /etc/waagent.conf.old
  95. * Detects kernel version and applies the VNUMA workaround if necessary
  96. * Moves udev rules that may interfere with networking (/lib/udev/rules.d/75-persistent-net-generator.rules, /etc/udev/rules.d/70-persistent-net.rules) to /var/lib/waagent/
  97. - uninstall: Remove waagent and associated files
  98. * Unregisters the init script from the system and deletes it
  99. * Deletes the logrotate configuration and the waagent config file in /etc/waagent.conf
  100. * Restores any moved udev rules that were moved during installation
  101. * Automatic reverting of the VNUMA workaround is not supported, please edit the GRUB configuration files by hand to re-enable NUMA if required.
  102. - deprovision: Attempt to clean the system and make it suitable for re-provisioning. This operation deleted the following:
  103. * All SSH host keys (if Provisioning.RegenerateSshHostKeyPair is 'y' in the configuration file)
  104. * Nameserver configuration in /etc/resolv.conf
  105. * Root password from /etc/shadow (if Provisioning.DeleteRootPassword is 'y' in the configuration file)
  106. * Cached DHCP client leases
  107. * Resets host name to localhost.localdomain
  108. **Warning:** Deprovision does not guarantee that the image is cleared of all sensitive information and suitable for redistribution.
  109. - deprovision+user: Performs everything under -deprovision (above) and also deletes the last provisioned user account (obtained from /var/lib/waagent) and associated data. This parameter is when de-provisioning an image that was previously provisioning on Azure so it may be captured and re-used.
  110. - version: Displays the version of waagent
  111. - serialconsole: Configures GRUB to mark ttyS0 (the first serial port) as
  112. the boot console. This ensures that kernel bootup logs are sent to the
  113. serial port and made available for debugging.
  114. - daemon: Run waagent as a daemon to manage interaction with the platform.
  115. This argument is specified to waagent in the waagent init script.
  116. ##Configuration
  117. A configuration file (/etc/waagent.conf) controls the actions of waagent.
  118. A sample configuration file is shown below:
  119. #
  120. # Azure Linux Agent Configuration
  121. #
  122. Role.StateConsumer=None
  123. Role.ConfigurationConsumer=None
  124. Role.TopologyConsumer=None
  125. Provisioning.Enabled=y
  126. Provisioning.DeleteRootPassword=n
  127. Provisioning.RegenerateSshHostKeyPair=y
  128. Provisioning.SshHostKeyPairType=rsa
  129. Provisioning.MonitorHostName=y
  130. ResourceDisk.Format=y
  131. ResourceDisk.Filesystem=ext4
  132. ResourceDisk.MountPoint=/mnt/resource
  133. ResourceDisk.EnableSwap=n
  134. ResourceDisk.SwapSizeMB=0
  135. LBProbeResponder=y
  136. Logs.Verbose=n
  137. OS.RootDeviceScsiTimeout=300
  138. OS.OpensslPath=None
  139. The various configuration options are described in detail below. Configuration options are of three types; Boolean, String or Integer. The Boolean configuration options can be specified as "y" or "n". The special keyword "None" may be used for some string type configuration entries as detailed below.
  140. **Role.StateConsumer:**
  141. Type: String
  142. Default: None
  143. If a path to an executable program is specified, it is invoked when waagent has provisioned the image and the "Ready" state is about to be reported to the Fabric. The argument specified to the program will be "Ready". The agent will not wait for the program to return before continuing.
  144. **Role.ConfigurationConsumer:**
  145. Type: String
  146. Default: None
  147. If a path to an executable program is specified, the program is invoked when the Fabric indicates that a configuration file is available for the virtual machine. The path to the XML configuration file is provided as an argument to the executable. This may be invoked multiple times whenever the configuration file changes. The current path of this file is /var/lib/waagent/HostingEnvironmentConfig.xml.
  148. **Role.TopologyConsumer:**
  149. Type: String
  150. Default: None
  151. If a path to an executable program is specified, the program is invoked when the Fabric indicates that a new network topology layout is available for the virtual machine.The path to the XML configuration file is provided as an argument to the executable. This may be invoked multiple times whenever the network topology changes (due to service healing for example). The current location of this file is /var/lib/waagent/SharedConfig.xml.
  152. **Provisioning.Enabled:**
  153. Type: Boolean
  154. Default: y
  155. This allows the user to enable or disable the provisioning functionality in the agent. Valid values are "y" or "n". If provisioning is disabled, SSH host and user keys in the image are preserved and any configuration specified in the Azure provisioning API is ignored.
  156. **Note:** this parameter defaults to "n" on Ubuntu Cloud Images that use cloud-init for provisioning.
  157. **Provisioning.DeleteRootPassword:**
  158. Type: Boolean
  159. Default: n
  160. If set, the root password in the /etc/shadow file is erased during the provisioning process.
  161. **Provisioning.RegenerateSshHostKeyPair:**
  162. Type: Boolean
  163. Default: y
  164. If set, all SSH host key pairs (ecdsa, dsa and rsa) are deleted during the provisioning process from /etc/ssh/. And a single fresh key pair is generated.
  165. The encryption type for the fresh key pair is configurable by the Provisioning.SshHostKeyPairType entry. Please note that some distributions will re-create SSH key pairs for any missing encryption types when the SSH daemon is restarted (for example, upon a reboot).
  166. **Provisioning.SshHostKeyPairType:**
  167. Type: String
  168. Default: rsa
  169. This can be set to an encryption algorithm type that is supported by the SSH daemon on the virtual machine. The typically supported values are "rsa", "dsa" and "ecdsa". Note that "putty.exe" on Windows does not support "ecdsa". So, if you intend to use putty.exe on Windows to connect to a Linux deployment, please use "rsa" or "dsa".
  170. **Provisioning.MonitorHostName:**
  171. Type: Boolean
  172. Default: y
  173. If set, waagent will monitor the Linux virtual machine for hostname changes (as returned by the "hostname" command) and automatically update the networking configuration in the image to reflect the change. In order to push the name change to the DNS servers, networking will be restarted in the virtual machine. This will result in brief loss of Internet connectivity.
  174. **ResourceDisk.Format:**
  175. Type: Boolean
  176. Default: y
  177. If set, the resource disk provided by the platform will be formatted and mounted by waagent if the filesystem type requested by the user in "ResourceDisk.Filesystem" is anything other than "ntfs". A single partition of type Linux (83) will be made available on the disk. Note that this partition will not be formatted if it can be successfully mounted.
  178. **ResourceDisk.Filesystem:**
  179. Type: String
  180. Default: ext4
  181. This specifies the filesystem type for the resource disk. Supported values vary by Linux distribution. If the string is X, then mkfs.X should be present on the Linux image. SLES 11 images should typically use 'ext3'. FreeBSD images should use 'ufs2' here.
  182. **ResourceDisk.MountPoint:**
  183. Type: String
  184. Default: /mnt/resource
  185. This specifies the path at which the resource disk is mounted. Note that the resource disk is a *temporary* disk, and might be emptied when the VM is deprovisioned.
  186. **ResourceDisk.EnableSwap:**
  187. Type: Boolean
  188. Default: n
  189. If set, a swap file (/swapfile) is created on the resource disk and added to the system swap space.
  190. **ResourceDisk.SwapSizeMB:**
  191. Type: Integer
  192. Default: 0
  193. The size of the swap file in megabytes.
  194. **LBProbeResponder:**
  195. Type: Boolean
  196. Default: y
  197. If set, waagent will respond to load balancer probes from the platform (if present).
  198. **Logs.Verbose:**
  199. Type: Boolean
  200. Default: n
  201. If set, log verbosity is boosted. Waagent logs to /var/log/waagent.log and leverages the system logrotate functionality to rotate logs.
  202. **OS.RootDeviceScsiTimeout:**
  203. Type: Integer
  204. Default: 300
  205. This configures the SCSI timeout in seconds on the OS disk and data drives. If not set, the system defaults are used.
  206. **OS.OpensslPath:**
  207. Type: String
  208. Default: None
  209. This can be used to specify an alternate path for the openssl binary to use for cryptographic operations.
  210. ##Ubuntu Cloud Images
  211. Note that Ubuntu Cloud Images utilize [cloud-init](https://launchpad.net/ubuntu/+source/cloud-init) to perform many configuration tasks that would otherwise be managed by the Azure Linux Agent. Please note the following differences:
  212. - **Provisioning.Enabled** defaults to "n" on Ubuntu Cloud Images that use cloud-init to perform provisioning tasks.
  213. - The following configuration parameters have no effect on Ubuntu Cloud Images that use cloud-init to manage the resource disk and swap space:
  214. - **ResourceDisk.Format**
  215. - **ResourceDisk.Filesystem**
  216. - **ResourceDisk.MountPoint**
  217. - **ResourceDisk.EnableSwap**
  218. - **ResourceDisk.SwapSizeMB**
  219. - Please see the following resources to configure the resource disk mount point and swap space on Ubuntu Cloud Images during provisioning:
  220. - [Ubuntu Wiki: Configure Swap Partitions](http://go.microsoft.com/fwlink/?LinkID=532955&clcid=0x409)
  221. - [Injecting Custom Data into an Azure Virtual Machine](virtual-machines-windows-classic-inject-custom-data.md)