Skip to content

Installing Trivy

In this section you will find an aggregation of the different ways to install Trivy. installations are listed as either "official" or "community". Official integrations are developed by the core Trivy team and supported by it. Community integrations are integrations developed by the community, and collected here for your convenience. For support or questions about community integrations, please contact the original developers.

Install using Package Manager

RHEL/CentOS (Official)

Add repository setting to /etc/yum.repos.d.

RELEASE_VERSION=$(grep -Po '(?<=VERSION_ID=")[0-9]' /etc/os-release)
cat << EOF | sudo tee -a /etc/yum.repos.d/trivy.repo
name=Trivy repository
sudo yum -y update
sudo yum -y install trivy
rpm -ivh

Debian/Ubuntu (Official)

Add repository setting to /etc/apt/sources.list.d.

sudo apt-get install wget apt-transport-https gnupg lsb-release
wget -qO - | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy
sudo dpkg -i trivy_0.50.4_Linux-64bit.deb

Homebrew (Official)

Homebrew for MacOS and Linux.

brew install trivy

Arch Linux (Community)

Arch Linux Package Repository.

pacman -S trivy

References: - -

MacPorts (Community)

MacPorts for MacOS.

sudo port install trivy

References: -

Nix/NixOS (Community)

Nix package manager for Linux and MacOS.

nix-env --install -A nixpkgs.trivy

  # your other config ...
  environment.systemPackages = with pkgs; [
    # your other packages ...
  # your other config ...
  home.packages = with pkgs; [
    # your other packages ...

References: -

FreeBSD (Official)

Pkg for FreeBSD.

pkg install trivy

Install from GitHub Release (Official)

Download Binary

  1. Download the file for your operating system/architecture from GitHub Release assets (curl -LO
  2. Unpack the downloaded archive (tar -xzf ./trivy.tar.gz).
  3. Put the binary somewhere in your $PATH (e.g mv ./trivy /usr/local/bin/).
  4. Make sure the binary has execution bit turned on (chmod +x ./trivy).

Install Script

The process above can be automated by the following script:

curl -sfL | sh -s -- -b /usr/local/bin v0.50.4

Install from source

git clone --depth 1 --branch v0.50.4
cd trivy
go install ./cmd/trivy

Use container image

  1. Pull Trivy image (docker pull aquasec/trivy:0.50.4)
  2. It is advisable to mount a consistent cache dir on the host into the Trivy container.
  3. For scanning container images with Trivy, mount docker.sock from the host into the Trivy container.


docker run -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/Library/Caches:/root/.cache/ aquasec/trivy:0.50.4 image python:3.4-alpine
Registry Repository Link Supportability
Docker Hub Official
GitHub Container Registry (GHCR) Official
AWS Elastic Container Registry (ECR) Official

Other Tools to use and deploy Trivy

For additional tools and ways to install and use Trivy in different environments such as in IDE, Kubernetes or CI/CD, see Ecosystem section.