The process of auditing a system can give you concrete answers about the state of your system. In addition to this, you can also get a series of recommendations to improve the system’s performance. In this sense, on Linux, there are also applications that allow us to have this audit. That is why today we will show you how to install Lynis in Ubuntu 20.04.
What is Lynis?
According to the project website:
Lynis is a proven security tool for systems running Linux, macOS or Unix-based operating systems. It performs an extensive health scan of your systems to support system hardening and compliance testing.
In other words, thanks to Lynis we can have relevant information about the security status of our system. In addition, the tool provides us with relevant tips that will allow us to solve some of them.
The tool has an active development and is open source, so we can obtain its source code to audit it.
Some Lynis use cases are:
- Security auditing
- Compliance testing (e.g. PCI, HIPAA, SOx)
- Penetration testing
- Vulnerability detection
- System hardening
It is worth noting that you don’t have to be an advanced user to use Lynis, as it is easy to use and provides useful information for a variety of purposes.
Let’s start.
Install Lynis on Ubuntu 20.04
Lynis is easy to install on a system like Ubuntu 20.04 thanks to the great support they offer for Linux. However, we have two methods we can use, and it all depends on the user running it.
Method 1: install Lynis on Ubuntu 20.04 using the official repositories
This first method is easy to apply since the application is already present in the Ubuntu repositories. So, we have to open a terminal or start an SSH session and update the system.
sudo apt update
sudo apt upgrade
Then, the following command will suffice to install Lynis on Ubuntu 20.04
sudo apt install lynis
Thereafter, you can use it without any problems. This first method is ideal for beginners and people who will not make intensive use of the application.
Method 2: Install the latest stable version of Lynis
Another way to install Lynis is through the Lynis repository for Ubuntu. This repository will provide the latest stable version of the tool.
So, after having updated the system, we have to get the GPG key from the repository:
wget -O - https://packages.cisofy.com/keys/cisofy-software-public.key | sudo apt-key add -
Then, we can add it to the system:
echo "deb https://packages.cisofy.com/community/lynis/deb/ stable main" | sudo tee /etc/apt/sources.list.d/cisofy-lynis.list
Then refresh APT
sudo apt update
And finally install Lynis:
sudo apt install lynis
Now we can use it.
Basic use of Lynis
Once we have Lynis installed, we can check the version we have with the following command
lynis show version
You will get an output screen like this
3.0.7
The next step, is to get additional information about the application
lynis update info
Lynis works with commands that we need to know to use it properly. If you want a list of these commands:
lynis show commands
And you will see something like this:
Commands:
lynis audit
lynis configure
lynis generate
lynis show
lynis update
lynis upload-only
From there, we can do a basic system audit with this command:
sudo lynis audit system
This will start the whole process of scanning the system.
After it does so, it will show you all the suggestions of the application.
When finished, you will see a screen like this.
Conclusion
Lynis is a vital tool for all users who want to have additional information about their system. This is important if you would like to armor your system or if you need to audit your system.
Please share this post with your friends and help us to grow.