Raspberry Pi

How to Install Lynis on Raspberry Pi

Lynis is a security tool that is specifically designed for Linux based systems that was first launched in 2007 and is completely free. Having an audit tool has now become necessary nowadays as it has become quite difficult to find the potential issues with the system. So, if you are looking for a software that not only looks for any potential issues but also protects your Raspberry Pi then Lynis will be the one for you as it is free, lightweight, and quite easy to install.

Installing Lynis on Raspberry Pi

There is a general perception that antivirus takes up a lot of resources of a computer and makes it rather slow but when it comes to Lynis that is not the case. Follow the steps mentioned below to install the Lynis on Raspberry Pi:

Step 1: First install the cryptography package for exchanging the encrypted messages by downloading the GPG key using the following command:

$ sudo wget -qO /etc/apt/trusted.gpg.d/cisofy-key.asc https://packages.cisofy.com/keys/cisofy-software-public.key

Graphical user interface, text Description automatically generated

Step 2: Now execute the following command to skip the downloading of translation:

$ echo 'Acquire::Languages "none";' | sudo tee /etc/apt/apt.conf.d/99disable-translations

Text Description automatically generated

Step 3: Next install the repositories of Lynis by executing the given command:

$ echo "deb https://packages.cisofy.com/community/lynis/deb/ stable main" | sudo tee /etc/apt/sources.list.d/cisofy-lynis.list

A screenshot of a computer Description automatically generated with medium confidence

Step 4: Now update the packages list of Raspberry Pi by using the given command:

$ sudo apt update

Step 5: Next execute the given command to install Lynis on your Raspberry Pi:

$ sudo apt install -y lynis

Step 6: To see if the Lynis is installed correctly check its version by using the given command:

$ sudo lynis --version

Step 7: To check you Raspberry Pi for any issues and threats use the given command in the terminal:

$ sudo lynis audit system

So, this is how you can install Lynis and keep your Raspberry Pi safe from any potential threats.

Uninstalling Lynis from Raspberry Pi

The removal process of Lynis from Raspberry Pi is also easy just go through the steps mentioned below:

Step1: Run the command given below to uninstall the Lynis from Raspberry Pi:

$ sudo apt purge --autoremove -y lynis

Step 2: Next remove the apt configuration file along with the repositories of Lynis:

$ sudo rm -rf /etc/apt/trusted.gpg.d/cisofy-key.asc

$ sudo rm -rf /etc/apt/sources.list.d/cisofy-lynis.list

$ sudo rm -rf /etc/apt/apt.conf.d/99disable-translations

Step 3: Lastly, remove the logs of Lynis using the following command:

$ sudo rm -rf /var/log/lynis*

So, this is how you can remove Lynis from Raspberry Pi completely.

Conclusion

If you are using Raspberry Pi and looking for an application that highlights any of the potential issues and protects the system from viruses then Lynis is the best choice for you. Lynis is a free audit software that not only scans the system for viruses but also looks for any issues the system is having. To install Lynis get the GFG key, download its repositories and then use the apt package manager to install Lynis.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.