Installation Methods for Different Platforms

Installation Methods for Different Platforms

Trivy offers multiple installation methods to accommodate different operating systems and deployment scenarios. The simplest approach uses pre-built binaries available for Linux, macOS, and Windows. For Linux systems, you can download and install Trivy with a single command:

# Download and install the latest version on Linux
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin

# Verify the installation
trivy --version

# For specific version installation
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.45.0

macOS users can leverage Homebrew for easy installation and updates. This method integrates Trivy into the standard macOS package management workflow:

# Install using Homebrew
brew install trivy

# Keep Trivy updated
brew upgrade trivy

# For MacPorts users
sudo port install trivy

Windows installations can use Chocolatey or download binaries directly. For enterprise environments, having multiple installation options ensures compatibility with existing toolchains:

# Install using Chocolatey
choco install trivy

# Or download directly using PowerShell
Invoke-WebRequest -Uri https://github.com/aquasecurity/trivy/releases/download/v0.45.0/trivy_0.45.0_windows-64bit.zip -OutFile trivy.zip
Expand-Archive -Path trivy.zip -DestinationPath .