Cyberithub

How to Install Vector agent or tool on Ubuntu/Debian

Advertisements

In this article, we will see how to install vector agent or tool on Ubuntu/Debian Servers. Vector is a free and open source lightweight, high performance, ultra-fast tool for building observability data pipelines which puts you in control of your observability data. It can collect, transform and route all logs and metrics from different types of sources including file, kafka, statsd etc. It completely eliminates the cost of using an agent to source logs and metrics data from different sources.

At the same time, it provides data security required by the onboarded vendors. It can be deployed as an agent or aggregator. It acts as a complete platform and quite easy to deploy in almost all the famous platforms. Here we will see how to deploy vector as an agent on Ubuntu/Debian based systems.

Advertisements

 

How to Install Vector agent or tool on Ubuntu/Debian

How to Install Vector agent or tool on Ubuntu/Debian

Also Read: [Solved]: "ERROR! hwloc library not found"

Step 1: Prerequisites

a) You should have a running Ubuntu/Debian Server.

Advertisements

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get and curl utility installed in your Server.

Advertisements

 

Step 2: Update Your Server

Before installing vector agent in your server, it is essential to look for all the available updates and install them using sudo apt update && sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
[sudo] password for cyberithub:
Get:1 https://dl.winehq.org/wine-builds/ubuntu focal InRelease [8,041 B]
Hit:2 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:4 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:5 https://download.sublimetext.com apt/stable/ InRelease
Hit:6 http://ppa.launchpad.net/flatpak/stable/ubuntu focal InRelease
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:8 https://ngrok-agent.s3.amazonaws.com buster InRelease
Hit:9 http://ppa.launchpad.net/gencfsm/ppa/ubuntu focal InRelease
Get:10 https://repositories.timber.io/public/vector/deb/ubuntu focal InRelease [4,947 B]
Hit:11 http://ppa.launchpad.net/juju/stable/ubuntu focal InRelease
Get:12 https://dl.winehq.org/wine-builds/ubuntu focal/main amd64 Packages [436 kB]
Hit:13 http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal InRelease
Get:14 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
...........................................................

 

Step 3: Install Vector

There are number of ways to install vector on Ubuntu/Debian based systems. You can choose any of the below methods depending on your needs and requirements.

Advertisements

a) Using Script

The most easiest way to install vector is through below bash script. You can get the latest script from official website. Just copy the script and paste it here to deploy the agent on your system.

cyberithub@ubuntu:~$ curl --proto '=https' --tlsv1.2 -sSf https://sh.vector.dev | bash
__   __  __
\ \ / / / /
\ V / / /
 \_/ \ /

V E C T O R
Installer


--------------------------------------------------------------------------------
Website: https://vector.dev
Docs: https://vector.dev/docs/
Community: https://vector.dev/community/
--------------------------------------------------------------------------------

>>> We'll be installing Vector via a pre-built archive at https://packages.timber.io/vector/0.32.1/
>>> Ready to proceed? (y/n)

>>> y

--------------------------------------------------------------------------------

>>> Downloading Vector via https://packages.timber.io/vector/0.32.1/vector-0.32.1-x86_64-unknown-linux-gnu.tar.gz
✓
>>> Unpacking archive to /home/cyberithub/.vector ... ✓
>>> Adding Vector path to /home/cyberithub/.zprofile ✓
>>> Adding Vector path to /home/cyberithub/.profile ✓
>>> Install succeeded! 🚀
>>> To start Vector:

vector --config /home/cyberithub/.vector/config/vector.yaml

>>> More information at https://vector.dev/docs/

b) Using Apt

You can also choose to install vector tool from repository. For that, you have to first install the repo using below curl command. This will execute bash script for the timber/vector repo and finally install the repo after running few checks in your system.

cyberithub@ubuntu:~$ curl -1sLf 'https://repositories.timber.io/public/vector/cfg/setup/bash.deb.sh' | sudo -E bash
[sudo] password for cyberithub:
Executing the setup script for the 'timber/vector' repository ...

  OK: Checking for required executable 'curl' ...
  OK: Checking for required executable 'apt-get' ...
  OK: Detecting your OS distribution and release using system methods ...
^^^^: ... Detected/provided for your OS/distribution, version and architecture:
>>>>:
>>>>: ... distro=ubuntu version=20.04 codename=focal arch=x86_64
>>>>:
NOPE: Checking for apt dependency 'apt-transport-https' ...
  OK: Updating apt repository metadata cache ...
  OK: Attempting to install 'apt-transport-https' ...
  OK: Checking for apt dependency 'ca-certificates' ...
  OK: Checking for apt dependency 'gnupg' ...
 RUN: Importing 'timber/vector' repository GPG keys ...gpg: WARNING: unsafe ownership on homedir '/home/cyberithub/.gnupg'
  OK: Checking for apt signed-by key support ...
  OK: Importing 'timber/vector' repository GPG keys ...
  OK: Checking if upstream install config is OK ...
  OK: Installing 'timber/vector' repository via apt ...
  OK: Updating apt repository metadata cache ...
  OK: The repository has been installed successfully - You're ready to rock!

Then install vector package by using sudo apt-get install vector command as shown below. This will download and install the package from repository.

cyberithub@ubuntu:~$ sudo apt-get install vector
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
vector
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 27.3 MB of archives.
After this operation, 118 MB of additional disk space will be used.
Get:1 https://repositories.timber.io/public/vector/deb/ubuntu focal/main amd64 vector amd64 0.32.2-1 [27.3 MB]
Fetched 27.3 MB in 8s (3,253 kB/s)
Selecting previously unselected package vector.
(Reading database ... 261432 files and directories currently installed.)
Preparing to unpack .../vector_0.32.2-1_amd64.deb ...
Unpacking vector (0.32.2-1) ...
Setting up vector (0.32.2-1) ...
systemd-journal:x:101:

c) Using dpkg

Finally, you can also install vector agent from a debian package. You have to download the package in your local system by using below curl command.

cyberithub@ubuntu:~$ curl --proto '=https' --tlsv1.2 -O https://packages.timber.io/vector/0.32.2/vector_0.32.2-1_amd64.deb
% Total % Received % Xferd Average Speed Time Time Time Current
                           Dload Upload Total Spent Left Speed
100 26.0M 100 26.0M 0 0 3441k 0 0:00:07 0:00:07 --:--:-- 4875k

After downloading the package, install it by running sudo dpkg -i vector_0.32.2-1_amd64.deb command as shown below.

cyberithub@ubuntu:~$ sudo dpkg -i vector_0.32.2-1_amd64.deb
[sudo] password for cyberithub:
(Reading database ... 261464 files and directories currently installed.)
Preparing to unpack vector_0.32.2-1_amd64.deb ...
Unpacking vector (0.32.2-1) over (0.32.2-1) ...
Setting up vector (0.32.2-1) ...
systemd-journal:x:101:vector

 

Step 4: Check Version

After successful installation, you can check the current installed version by using vector --version command as shown below.

cyberithub@ubuntu:~$ vector --version
vector 0.32.1 (x86_64-unknown-linux-gnu 9965884 2023-08-21 14:52:38.330227446)

 

Step 5: Start Vector

Before starting vector, you have to create and configure vector.yaml file with all the source and sink information along with the transform information as per your needs and requirements. For example, we have setup our sample vector.yaml file under /home/cyberithub/.vector/config path. To start the agent, we have to run vector --config /home/cyberithub/.vector/config/vector.yaml command as shown below.

cyberithub@ubuntu:~$ vector --config /home/cyberithub/.vector/config/vector.yaml
2023-10-15T13:58:37.906426Z INFO vector::app: Log level is enabled. level="vector=info,codec=info,vrl=info,file_source=info,tower_limit=info,rdkafka=info,buffers=info,lapin=info,kube=info"
2023-10-15T13:58:37.908983Z WARN vector::app: DEPRECATED The openssl legacy provider provides algorithms and key sizes no longer recommended for use. Set `--openssl-legacy-provider=false` or `VECTOR_OPENSSL_LEGACY_PROVIDER=false` to disable. See https://vector.dev/highlights/2023-08-15-0-32-0-upgrade-guide/#legacy-openssl for details.
2023-10-15T13:58:38.096636Z INFO vector::app: Loaded openssl provider. provider="legacy"
2023-10-15T13:58:38.116985Z INFO vector::app: Loaded openssl provider. provider="default"
2023-10-15T14:03:14.668902Z INFO vector::app: Loading configs. paths=["/home/cyberithub/.vector/config/vector.yaml"]
......................................................

 

Step 6: Check all available options

To check all the options available with vector command, run vector --help command as shown below.

cyberithub@ubuntu:~$ vector --help
Usage: vector [OPTIONS] [COMMAND]

Commands:
  validate         Validate the target config, then exit
  generate         Generate a Vector configuration containing a list of components
  generate-schema  Generate the configuration schema for this version of Vector. (experimental)
  list             List available components, then exit
  test             Run Vector config unit tests, then exit. This command is experimental and therefore subject to change. For guidance on how to write
                       unit tests check out <https://vector.dev/guides/level-up/unit-testing/>
  graph            Output the topology as visual representation using the DOT language which can be rendered by GraphViz
  top              Display topology and metrics in the console, for a local or remote Vector instance
  tap              Observe output log events from source or transform components. Logs are sampled at a specified interval
  vrl              Vector Remap Language CLI
  help             Print this message or the help of the given subcommand(s)
......................................................

 

Step 7: Uninstall Vector

Once you are done using vector agent, you can also choose to remove it from your system by using sudo apt remove vector command as shown below. Please note that below command will only work if you installed the agent using apt package manager or through the debian package.

cyberithub@ubuntu:~$ sudo apt remove vector
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
vector
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
After this operation, 118 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 261463 files and directories currently installed.)
Removing vector (0.32.2-1) ...

Leave a Comment