Security is, and should be, your number one priority. One compromised server can lead to devastating data breaches, financial losses, and irreversible damage to your reputation.
Want to secure your Linux server but don't know where to start? Learning how to install Lynis on Linux and perform security audits is your first step toward bulletproof security.
Whether you want to download Lynis in Ubuntu, Debian, or Rocky Linux & AlmaLinux, this guide covers everything from installation (via GitHub or package managers) to implementing Lynis suggestions. In just a few minutes, you’ll learn how to harden your server's security and safeguard your peace of mind.

What is Lynis?
Lynis is a specialized security auditing tool designed to analyze Linux and Unix-based systems. It systematically examines system configurations, services, and security controls while identifying potential vulnerabilities and misconfigurations. The tool provides detailed recommendations for hardening your system, compliance checking against security frameworks, and generates comprehensive reports that help prioritize security improvements and track progress over time.
Prerequisites - Before You Install Lynis for Linux Security Audits
Lynis is available on all our OS options—Ubuntu, Debian, and others—and the installation/usage instructions are the same for every platform, so this tutorial is OS agnostic. To follow these instructions, you’ll need:
- A VPS running any of our available OS options. If you haven't noticed, we offer the best priced, most reliable Linux servers in the world. Take a look at our deals and prepare for your mind to be blown 🤯.
- A non-root user account (commands requiring escalated privileges will use
sudo
).
Check out Connecting to Your VPS with SSH and Improving SSH Safety to learn how to connect to your server.
How to Install Lynis on Linux to Perform Security Audits
You can install Lynis with two methods: either through your distribution's official package repositories using standard package managers (apt/dnf), or by cloning the official GitHub repository to get the latest version with newest security checks and features.
Option 1: Installing The Official Distribution Package
To install Lynis and use it to perform security audits for your distribution, you can just use the package manager for your distribution.
To download and install Lynis in Ubuntu and Debian:
$ sudo apt install lynis

To download and install Lynis on Rocky Linux/AlmaLinux/CentOS/RHEL:
$ sudo dnf install epel-release -y
$ sudo dnf install lynis

To verify the installation, check the Lynis version:
$ sudo lynis --version
Output:
3.0.9
You can now use the stable Lynis version currently available for your distribution. However, if you want to run the latest version. You can go with the second option and install Lynis using Git via the official Github repository.
Option 2: Installing Lynis Via GitHub For The Latest Version
Note: If you’ve already installed Lynis through your package manager with the first option above, make sure to uninstall it before proceeding to mitigate package conflicts.
If you want to use the latest Lynis version directly from the source, the process is as simple as cloning the GitHub repository to your VPS. If you're running a brand new VPS, you might not have Git installed yet:
$ sudo apt install git # Ubuntu/Debian
$ sudo dnf install git # Rocky Linux/AlmaLinux/CentOS/RHEL
Let's clone the Lynis repository next:
$ git clone https://github.com/CISOfy/lynis
It's recommended to run the script as the root user, so we'll use chown
to change the ownership of the script. If you run the command with sudo
or su
without changing ownership first, you'll receive a security warning, which you can ignore by hitting Enter
or cancel with Ctrl+C
. And, if you try running the command using your normal users, you'll get a warning that results will be incomplete due to some processing requiring higher privileges.
$ sudo chown -R 0:0 lynis
$ cd lynis
Verify your installation by checking the Lynis version:
$ sudo ./lynis --version
You’ll likely notice that the version of Lynis you’ve installed via Github is newer than the one available in your distribution's package manager:
3.1.4
Command to See Documentation and Instructions for Lynis
# For package manager installations
sudo lynis show commands
# For GitHub installations (from lynis directory)
sudo ./lynis show commands
by subscribing to our newsletter.