Project: Vector (Observability and Analysis / Observability)
File: from-source.md

title: Install Vector from source short: From source weight: 2 This page covers installing Vector from source using the native toolchain for the host. Vector can also be compiled to a static binary for Linux for x86_64, ARM64, and ARMv7 architectures. See for details. {{< warning >}} We recommend installing Vector through a supported platform, package manager, or pre-built archive if possible. These handle permissions, directory creation, and other intricacies covered in the section. {{< /warning >}} Install Rust: ```shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable ``` Install compilation dependencies, specifically C and C++ compilers (GCC or Clang) and GNU `make` if they aren't pre-installed on your system. Download Vector's source: ```shell mkdir -p vector && \ curl -sSfL --proto '=https' --tlsv1.2 https://api.github.com/repos/vectordotdev/vector/tarball/v{{< version >}} | \ tar xzf - -C vector --strip-components=1 mkdir -p vector && \ curl -sSfL --proto '=https' --tlsv1.2 https://github.com/vectordotdev/vector/archive/master.tar.gz | \ tar xzf - -C vector --strip-components=1 ``` Change into your Vector directory: ```shell cd vector ``` Compile Vector: ```shell [FEATURES="<flag1>,<flag2>,..."] make build ``` The `FEATURES` environment variable is optional. You can override the default features using this variable. See for more info. When finished, the Vector binary is placed in `target/<target>/release/vector`. If you're building Vector on your Mac, for example, the target triple is `x8664-apple-darwin` and the Vector binary will be located at `target/x8664-apple-darwin/release/vector`. Finally, you can start Vector: ```shell target/<target>/release/vector --config config/vector.yaml ``` Install Rust using . If you don't have VC++ build tools, the install will prompt you to install them. Install and add to `PATH`. Install and add to `PATH`. Install . Add Perl to your `PATH`. In a Rust/MSVC environment (for example using `x64 Native Tools Command Prompt`) add the binary directory of Perl installed on the previous step to `PATH`. For example, for default installation of Strawberry Perl it is ```powershell set PATH=%PATH%;C:\Strawberry\perl\bin ``` Get Vector's source using Git: ```shell git clone https://github.com/vectordotdev/vector git checkout v{{< version >}} cd vector git clone

cd vector ``` Build Vector in release mode: ```shell set RUSTFLAGS=-Ctarget-feature=+crt-static cargo build --no-default-features --features default-msvc --release ``` Start Vector. After these steps, a binary `vector.exe` in `target\release` would be created. It can be started by running: ```powershell .\target\release\vector --config config\vector.toml ``` You can build statically linked binaries of Vector for Linux using in Docker. If you do so, the dependencies listed in the previous section aren't needed, as all of them would be automatically pulled by Docker. First, download Vector's source: ```shell mkdir -p vector && \ curl -sSfL --proto '=https' --tlsv1.2 https://api.github.com/repos/vectordotdev/vector/tarball/v{{< version >}} | \ tar xzf - -C vector --strip-components=1 mkdir -p vector && \ curl -sSfL --proto '=https' --tlsv1.2 https://github.com/vectordotdev/vector/archive/master.tar.gz | \ tar xzf - -C vector --strip-components=1 ``` Second, . And then build Vector using [cross]: ```shell make package-x86_64-unknown-linux-musl-all make package-aarch64-unknown-linux-musl-all make package-armv7-unknown-linux-muslueabihf-all ``` The command above builds a Docker image with a Rust toolchain for a Linux target for the corresponding architecture using `musl` as the C library, then starts a container from this image, and then builds inside the container. The target binary is located at `target/<target triple>/release/vector` as in the previous case. The Vector configuration file is located at: ```shell config/vector.yaml ``` Example configurations are located in `config/vector/examples/*`. You can learn more about configuring Vector in the [Configuration] documentation. We recommend creating a that Vector can use: ```shell mkdir /var/lib/vector ``` {{< warning >}} Make sure that this directory is writable by the `vector` process. {{< /warning >}} Vector offers a global that you can use to specify the path of your directory: ```shell data_dir = "/var/lib/vector" # default ``` Vector archives ship with service files in case you need them: To install Vector into Init.d, run: ```shell cp -av etc/init.d/vector /etc/init.d ``` To install Vector into Systemd, run: ```shell cp -av etc/systemd/vector.service /etc/systemd/system ``` To update Vector, follow the same instructions above. Vector supports many feature flags to customize which features are included in a build. By default, all sources, transforms, and sinks are enabled. To view a complete list of features, they are listed under ".