Lynis/Installation
Import key
For these commands root access may be needed. Use sudo or run as root user.
Suggested method to download key and use it
curl -fsSL https://packages.cisofy.com/keys/cisofy-software-public.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/cisofy-software-public.gpg echo "deb [arch=amd64,arm64 signed-by=/etc/apt/trusted.gpg.d/cisofy-software-public.gpg] https://packages.cisofy.com/community/lynis/deb/ stable main" | sudo tee /etc/apt/sources.list.d/cisofy-lynis.list
Older method
Option 1) sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 013baa07180c50a7101097ef9de922f1c2fde6c4 Option 2) sudo wget -O - https://packages.cisofy.com/keys/cisofy-software-public.key | sudo apt-key add -
Add software repository
The software repository uses preferably HTTPS for secure transport. Install the 'https' method for APT, if it was not available yet.
sudo apt install apt-transport-https
Using your software in English? Then configure APT to skip downloading translations. This saves bandwidth and prevents additional load on the repository servers.
echo 'Acquire::Languages "none";' | sudo tee /etc/apt/apt.conf.d/99disable-translations
Next step is adding the repository:
echo "deb https://packages.cisofy.com/community/lynis/deb/ stable main" | sudo tee /etc/apt/sources.list.d/cisofy-lynis.list
Install Lynis
Refresh the local package database with the new repository data and install Lynis:
apt update
Got an error after running this command? Check if you filled in the 'codename' correctly and the line is correct. It are those small details that may prevent it from working.
apt install lynis
Note, older Ubuntu versions may need sudo apt-get install lynis
Confirm Lynis version
lynis show version
Is your version not the latest? Run
sudo apt-cache policy lynis
to see where your package came from.
Consider pinning
If you keep receiving an old version from your distribution, 'pin' the Lynis package. Create the file /etc/apt/preferences.d/lynis with the following contents:
Package: lynis Pin: origin packages.cisofy.com Pin-Priority: 600
Note: In this example, a priority of 600 was used, which is typically higher than the other sources. If not, increase the number.