How to Install Lynis on Linux (Step-by-Step Tutorial)

This guide will teach you how to easily set up and run the Lynis security auditing tool to keep your Linux system safe from threats.

Lynis

Understanding Security Audits

Linux

What is Lynis?

Lynis is a free and open-source security tool designed to evaluate the defenses of Unix-like operating systems such as Linux. Instead of just looking for simple viruses, it performs a deep health check on your entire system. System administrators and regular users rely on it to find hidden weaknesses before hackers can exploit them.

When you run Lynis, it automatically scans your computer's software, settings, and files to see if they follow the best security practices. It checks important details like your password rules, firewall configurations, and whether any of your installed programs are dangerously out of date. After the scan finishes, the tool prints out a clear report showing what is safe and what needs your immediate attention.

One of the greatest features of Lynis is that it provides direct, easy-to-understand advice on how to fix the problems it discovers. It gives your system a "hardening index" score, which tells you exactly how secure your computer is at that moment. By following its step-by-step suggestions, you can improve your score and make your Linux machine much harder for bad actors to break into.

Prerequisites

  • A computer or server running a Linux operating system (such as Ubuntu, Debian, Fedora, or CentOS).
  • Access to the command-line terminal.
  • Administrative (sudo or root) privileges so you can run system-level commands.
  • The git package installed on your machine to download the files.
  • An active internet connection.

Step-by-Step Installation

1

Open your terminal

Launch your command-line interface. You will type all the following installation commands into this window.
2

Navigate to a standard software directory

Move to the /usr/local folder, which is the standard and safest place to keep shared software on Linux.
BASH
cd /usr/local
3

Download the Lynis files

Use the git clone command to download the newest version of Lynis straight from the official creators.
BASH
sudo git clone https://github.com/CISOfy/lynis
4

Enter the new Lynis folder

Move into the new directory that Git just created for you. There is no complicated installation process; the tool is ready to use right out of the folder.
Bash
cd lynis
5

Run your first security scan

Start the program and tell it to check your entire system. The scan will print out colored text on your screen and take a minute or two to finish.
BASH
sudo ./lynis audit system

Discover CTCservers Dedicated Server Locations

CTCservers servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.