# Installing TD Agent on Ubuntu and Debian Treasure Agent (td-agent) is a stable distribution package of Fluentd, which is maintained by Treasure Data and the [Cloud Native Computing Foundation](https://www.cncf.io/projects/). - [Before Installation](#before-installation) - [Install or Upgrade td-agent](#install-or-upgrade-td-agent) - [td-agent 4](#td-agent-4) - [td-agent 3](#td-agent-3) - [Cookbook](#cookbook) - [Other Resources](#other-resources) ## Before Installation You can learn more about how to prepare for the installation at [Fluentd Installation Guide](https://docs.fluentd.org/installation/before-install). ## Install or Upgrade td-agent You can install or upgrade from a previous version using the following methods. We recommend the latest version of td-agent, which can be downloaded from the [www.fluentd.org](http://www.fluentd.org/) website. Learn more about how this version [compares to earlier versions](https://docs.fluentd.org/quickstart/td-agent-v2-vs-v3-vs-v4). | Platform | Platform Version | Package or Installer | | --- | --- | --- | | Ubuntu/Debian | 2.6+ Linux kernel (64-bit) | td-agent v4 | - [Installation Guide](https://docs.fluentd.org/v1.0/articles/install-by-deb) - 64-bit/amd64 packages are available for [Focal](https://td-agent-package-browser.herokuapp.com/4/ubuntu/focal/pool/contrib/t/td-agent), [Bionic](https://td-agent-package-browser.herokuapp.com/4/ubuntu/bionic/pool/contrib/t/td-agent), [Xenial](https://td-agent-package-browser.herokuapp.com/4/ubuntu/xenial/pool/contrib/t/td-agent), and Debian [Buster](https://td-agent-package-browser.herokuapp.com/4/debian/buster/pool/contrib/t/td-agent). ### td-agent 4 We currently provide td-agent4.x packages for Ubuntu Focal, Bionic, Xenial, and Debian Buster. A shell script is provided to automate the installation process for each version. The shell script registers a new apt repository at `/etc/apt/sources.list.d/treasure-data.list` and installs the `td-agent` deb package. For Ubuntu Focal, ```bash # Ubuntu 20.04 Focal -- td-agent 4 curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-focal-td-agent4.sh | sh ``` For Ubuntu Bionic, ```bash # Ubuntu 18.04 Bionic -- td-agent 4 curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-bionic-td-agent4.sh | sh ``` For Ubuntu Xenial, ```bash # Ubuntu 16.04 Xenial -- td-agent 4 curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-xenial-td-agent4.sh | sh ``` For Debian Buster, ```bash # Debian Buster -- td-agent 4 curl -L https://toolbelt.treasuredata.com/sh/install-debian-buster-td-agent4.sh | sh ``` ### td-agent 3 Legacy td-agent3.x is available for EOL versions Ubuntu Trusty, Debian Stretch, and Debian Jessie. A shell script is provided to automate the installation process for each version. The shell script registers a new apt repository at `/etc/apt/sources.list.d/treasure-data.list` and installs the `td-agent` deb package. These commands set up td-agent package for you: For Ubuntu Trusty, ```bash curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent3.sh | sh ``` For Debian Stretch, ```bash curl -L https://toolbelt.treasuredata.com/sh/install-debian-stretch-td-agent3.sh | sh ``` For Debian Jessie, ```bash curl -L https://toolbelt.treasuredata.com/sh/install-debian-jessie-td-agent3.sh | sh ``` #### Launch the daemon with systemd The `/lib/systemd/system/td-agent` script is provided to start, stop, or restart the agent. ```bash sudo systemctl start td-agent.service sudo systemctl status td-agent.service ``` Example output: ``` ● td-agent.service - td-agent: Fluentd based data collector for Treasure Data Loaded: loaded (/lib/systemd/system/td-agent.service; disabled; vendor preset: enabled) Active: active (running) since Thu 2017-12-07 15:12:27 PST; 6min ago Docs: https://docs.treasuredata.com/articles/td-agent Process: 53192 ExecStart=/opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent.pid (code=exited, status=0/SUCCESS) Main PID: 53198 (fluentd) Tasks: 2 (limit: 4915) Memory: 19.9M CPU: 1.251s CGroup: /system.slice/td-agent.service ├─53198 /opt/td-agent/embedded/bin/ruby /opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent.pid └─53203 /opt/td-agent/embedded/bin/ruby -Eascii-8bit:ascii-8bit /opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent.pid ``` If you want to customize systemd behavior, place your `td-agent.service` file in `/etc/systemd/system`. #### Launch the daemon with init.d The `/etc/init.d/td-agent` script is provided to start, stop, or restart the agent. ```bash sudo /etc/init.d/td-agent restart sudo /etc/init.d/td-agent status ``` Example output: ``` td-agent (pid 21678) is running... ``` The following commands are supported: ```bash sudo /etc/init.d/td-agent start sudo /etc/init.d/td-agent stop sudo /etc/init.d/td-agent restart sudo /etc/init.d/td-agent status ``` Make sure your configuration file is located at `/etc/td-agent/td-agent.conf`. The logs are located under `/var/log/td-agent`. The daemon runs as the `td-agent` user and `td-agent` group. After you modify the config file, restart the agent. ## Cookbook See the [Chef cookbook](https://github.com/treasure-data/chef-td-agent) to automate this process. ## Other Resources - [td-agent change log](/products/customer-data-platform/integration-hub/streaming/td-agent/td-agent-logs-sent-to-treasure-data) - [Continuous Data Import with td-agent](https://docs.treasuredata.com/smart/project-integrations/fluentd-continuous-data-import-integration)