Linux management and hardening

Installing and managing programs

Easy
20 min

In this module, we will go through how to manage installed packages in a Linux environment and install or remove them.

In Debian-based operating systems, package management is handled through a package management system. Package management is responsible for installing, updating, removing software packages, and managing their dependencies. Ubuntu primarily uses the Advanced Package Tool (APT) system and its derived tools, such as apt-get and apt.

Key commands for package management

Installing the package

sudo apt-get install package_name

This command downloads and installs the desired software or package.

Package removal

sudo apt-get remove package_name

This removes the installed software, but not its configuration files.

Removing the package and deleting the configuration files

sudo apt-get purge package_name

This command deletes the program and its configuration files.

Updating Packages

sudo apt-get update
sudo apt-get upgrade

The first command updates the database from local packages, and the second updates installed software to the latest available versions.

Checking Dependencies

sudo apt-get check

Checks if all dependencies are in order. Typically, one package/program utilizes other packages and programs. These are called dependencies because without the required packages, the program may not necessarily function.

Search for packages

apt-cache search keyword

Searching for packages in the database based on the keyword you entered.

Viewing package information

apt-cache show package_name

Displays information about a specific package.

Autoremove

apt-get autoremove

Removes unnecessary packages that are no longer dependencies of any other package.

List of Installed Packages

apt list --installed

Installing the Package from .deb File

Sometimes you may not have access to the Internet, for example, and you may not be able to download the package you want in the usual way, so you can also install the package from a file if you can transfer it to the machine through other routes. These come in Debian-based systems in files named .deb and these can be installed, for example, as follows.

dpkg -i package.deb

Package management in the Debian operating system is efficient and helps keep your system up to date and secure. The APT system also manages package dependencies automatically, making software installation and updates relatively easy.

Exercise

Questions

Start the task above, connect to the target machine via SSH and check which of the following packages is installed, and answer the last question.

need

openssl

vim

Look at the package information and check what is the description of the package called wget?

hakatemia pro

Ready to become an ethical hacker?
Start today.

As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.