How to Install Chkrootkit on Ubuntu 22.04 | 20.04


Chkrootkit is a tool to detect and prevent rootkits on Linux systems. Rootkits are stealthy pieces of malicious software that can be difficult to detect and neutralize, so using Chkrootkit to stay ahead of them can be incredibly important. Installing Chkrootkit on an Ubuntu system can be done in two ways: manually downloading the file from its official page or through the apt package manager. Both methods are relatively straightforward, and this guide will teach you how to install Chkrootkit on Ubuntu 22.04 and 20.04 LTS Linux.

Method 1: Using the APT Package Manager

Step 1: Update package lists

Before installing Chkrootkit, it’s a good practice to update the package lists on your system to ensure that you have the latest information about available packages. Open a terminal and run the following command.

sudo apt update & sudo apt upgrade

Step 2: Install Chkrootkit

To install Chkrootkit, you can use the apt package manager. Run the following command.

sudo apt install chkrootkit

This will install the Chkrootkit package, which contains the tools and scripts to detect and prevent rootkits on your system.

Step 3: Verify the installation

You can verify the installation by running the Chkrootkit version command in the terminal.

chkrootkit -V

Example output:

chkrootkit version 0.55

Step 4: Run a scan for rootkits with Chkrootkit

sudo chkrootkit

This command should display the version of Chkrootkit and will perform a scan on your system to detect any rootkits.

Alternatively, use the quiet mode.

sudo chkrootkit -q

Step 5: Configure automatic scanning

Lastly, you can enable automatic daily scanning of your system with the APT version by first opening the configuration file.

sudo nano /etc/chkrootkit/chkrootkit.conf

Next, find the line “RUN_DAILY” and change it to “TRUE”. By default, this is set, but it is good to check anyway.

Example:

Close the file with CTRL+O and exit with CTRL+X.

Lastly, list the help options for further exploring Chkrootkit commands and for extra information.

chkrootkit -h

Example output:

Alternatively, use the man command.

man chkrootkit

Example output:

Method 2: Installing from the Source

Step 1: Download the Chkrootkit source code

First, you will need to download the Chkrootkit source code from the official website. Open a terminal and navigate to the directory where you want to download the source code, then run the following command.

wget ftp://chkrootkit.org/pub/seg/pac/chkrootkit.tar.gz

Step 2: Extract the source code

Next, you will need to extract the source code from the downloaded archive. Run the following command to extract the source code:

tar -xvzf chkrootkit.tar.gz -d chkrootkit

Step 3: Compile and install Chkrootkit

First, install the following packages, these should be installed, but it is good to run a check.

sudo apt install gcc make

Navigate to the extracted Chkrootkit source code directory and run the following command to install Chkrootkit

cd chkrootkit-{your-version-number}
sudo make sense

Step 4: Verify the installation

You can verify the installation by running the Chkrootkit command in the terminal.

./chkrootkit -V

Example output:

chkrootkit version 0.57

As mentioned above, at the time of this tutorial, the default Ubuntu repository contained version v0.55, and the manual method contained the latest v0.57.

Next, run the chkrootkit command to do a scan. Remember, you must be in the directory to run commands using this method.

sudo ./chkrootkit

Alternatively, use the quiet mode.

sudo ./chkrootkit -q

Conclusion

Both methods for installing Chkrootkit on Ubuntu are straightforward and will leave you with a better system to detect and prevent rootkits. Keep your system updated and regularly scan it with Chkrootkit to ensure optimal security. Have you installed Chkrootkit on your Ubuntu system? If so, which method did you use? Let us know in the comments below.

See also
Enable or Disable Firewall on Ubuntu 22.04 or 20.04

Leave a Comment

Share to...