# Installing Files.com Agent on Linux

Running the Files.com Agent as a system service starts it automatically at boot and keeps it running independently of user logins.

## Configure the Root Path

Before you install the Agent as a service, make sure that the `root` setting in the configuration file uses either a local drive path (such as `/path/to/folder`) or a path to an accessible mounted network drive (such as `/mnt/path/to/folder`).

## Download the Agent

Download the agent executable for your system from the [official download location](https://filescorp.hosted-by-files.com/builds/files-agent-server/latest). Choose the version that matches your architecture and operating system and save it to the same location as your configuration file on the host system.

## Install the Agent

To install the Agent as a service on a Linux system, run the following command:

```
files-agent service install --user-service=false \
  --config /path/to/files_agent_config.toml
```

Start the service with:

```
files-agent service start
```

If you modify the configuration file, stop the service, make your updates, and then restart it.

To stop the service, use:

```
files-agent service stop
```

When you're ready to remove the Agent service, run:

```
files-agent service uninstall --user-service=false
```

## Optional `systemd` Installation <a href="#alternative-installation-method-for-linux" id="alternative-installation-method-for-linux"></a>

If your Linux system uses the [`systemd`](https://en.wikipedia.org/wiki/Systemd) [init system](https://en.wikipedia.org/wiki/Init), you can install the Agent service by creating a service file. For Linux variants that use another init system, refer to the system's init documentation.

Create a file at `/lib/systemd/system/files-agent.service` with the following content:

```
[Unit]
Description=Files.com Agent v2
ConditionFileIsExecutable=/usr/bin/files-agent

[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/usr/bin/files-agent "start" "--config" "/path/to/files_agent_config.toml" "--log_file" "/path/to/files-agent.log"
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target
```

Replace the `ExecStart` paths (config file and log file) with the correct locations for your configuration and log files.

After creating the service file, install and enable it using:

```
sudo systemctl enable files-agent
```

Start the service with:

```
sudo systemctl start files-agent
```

To change the configuration, stop the service, edit the configuration file, then restart the service.

Stop the service with:

```
sudo systemctl stop files-agent
```

Remove the service with:

```
sudo systemctl disable files-agent
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://moverdocs.files.com/connections/any-server-with-files.com-agent/installing-files.com-agent-on-linux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
