[[elastic-agent-installation]]
[role="xpack"]
= Install {agent}

beta[]

Install an {agent} on each host that you want to monitor. These steps assume
that you're running a fresh installation. If {agent} is already running on your
system and you want to upgrade to a new version, see <<upgrade-elastic-agent>>.

Before running the installation, decide whether you want to use {fleet} to
manage your agents in a central location in {kib} (recommended), or run
standalone agents.

With {fleet}, you enroll each agent in a policy defined in {kib}. The policy
specifies how to collect observability data from the services you want to
monitor. The agent connects to a trusted {kib} instance to retrieve the policy
and report agent events.

TIP: We recommend using {fleet} management because it makes the management and
upgrade of your agents considerably easier. If you want to run standalone
agents, instead of using {fleet}, see <<run-elastic-agent-standalone>>.

To install {agent} and enroll it in {fleet}:

. If you're running {agent} 7.9 or earlier, stop the agent and manually remove
it from your host.

. On your host, download and extract the installation package.
+
--
// tag::install-elastic-agent[]

include::{beats-repo-dir}/x-pack/elastic-agent/docs/tab-widgets/download-widget.asciidoc[]

// end::install-elastic-agent[]
--

. From the agent directory, run the appropriate command to install {agent} as
a managed service, enroll it in {fleet}, and start the service. Don't have a
{fleet} enrollment key? Read the
{ingest-guide}/fleet-quick-start.html[Quick start guide] to learn how to get one
from {fleet}.
+
--
include::{beats-repo-dir}/x-pack/elastic-agent/docs/tab-widgets/install-widget.asciidoc[]
--
+
This step installs the {agent} files into the directory locations described
in <<installation-layout>>.

Because {agent} is installed as an auto-starting service, it will restart
automatically if the system is rebooted.

To confirm that {agent} is installed and running, go to the **Agents** tab in
{fleet}. 

If you run into problems, see <<fleet-troubleshooting>>.

[discrete]
[[installation-layout]]
== Installation layout

When you run the `install` command, {agent} installs files in the following
locations. You cannot override these installation paths because they are
required for upgrades.

include::tab-widgets/install-layout-widget.asciidoc[]


// Add Javascript and CSS for tabbed panels
include::tab-widgets/code.asciidoc[]
