Trivy Setup Guide: Installing the Ultimate Security Scanner

Learn how to easily install Trivy to scan your software containers and projects for hidden security risks.

Introduction to Vulnerability Scanning

What is Trivy?

Trivy is a free and easy-to-use security scanner created by Aqua Security. It is designed to find weak spots, known as vulnerabilities, in your software projects. Instead of waiting for a hacker to find a mistake, Trivy helps you spot these problems early so you can fix them before your software goes live to the public.

It can check many different parts of your project, including container images (such as Docker), computer file systems, and code repositories. When you ask Trivy to scan something, it carefully looks through all the hidden layers and software packages. It then compares what it finds against global databases of known security flaws to see if you are using any risky or outdated tools.

Developers and security teams love Trivy because it is incredibly fast and very simple to use. You do not need to set up complex databases or write long rules to make it work. With just a single command, Trivy automatically downloads the latest security updates and gives you a clear, easy-to-read report showing exactly what needs to be fixed.

Major Prerequisites

  • A computer running a Linux operating system, such as Ubuntu or Debian.
  • Access to the command-line terminal.
  • Administrator (sudo) permissions on your computer to install new software.
  • Basic tools like wget, gnupg, apt-transport-https, and lsb-release installed on your system.
  • An active internet connection to download Trivy and its security databases.

Step-by-Step Installation

(Debian and Ubuntu)

1. Install the required basic tools

First, update your system and install a few basic tools that help download the files safely.

Bash
sudo apt-get update
sudo apt-get install wget apt-transport-https gnupg lsb-release -y

2. Add the official Trivy security key

This key proves that the software you are downloading is genuinely from Aqua Security and is safe to use.

Bash
wget -qO - https://get.trivy.dev/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null

3. Add the Trivy download location

Next, tell your computer's package manager exactly where to find the Trivy software on the internet.

Bash
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://get.trivy.dev/deb generic main" | sudo tee -a /etc/apt/sources.list.d/trivy.list

4. Update your system and install Trivy

Now that your computer knows where to look, refresh the package list and install the tool.

Bash
sudo apt-get update
sudo apt-get install trivy -y

5. Verify the installation

Finally, check that Trivy was installed correctly by asking for its version number. If it shows the version, you are ready to start scanning!

Bash
trivy --version

Final Thoughts

You have now successfully equipped your system with a powerful tool to protect your software.

  • Installed the necessary basic tools to ensure secure downloads.
  • Added the official security key to guarantee the software is genuine.
  • Connected your computer to the official Trivy download location.
  • Successfully installed the Trivy scanner and confirmed it is ready to run.

With the installation complete, you can confidently start scanning your projects to find and fix vulnerabilities before they become a problem.

Dedicated servers in every region

Choose the location closest to your users.