Post

Package Management

Package Management

Here’s a clear and structured guide for Package Management and related Linux system topics:


📦 Linux Package Management & File System Structure


1. 📁 The Linux File System Structure (Simplified)

DirectoryPurpose
/Root of the file system.
/binEssential binary programs (e.g. ls, cp, bash).
/sbinSystem binaries (e.g. reboot, mount).
/etcConfiguration files.
/devDevice files.
/homeUser directories.
/libEssential shared libraries.
/optOptional software.
/usrUser-installed software and libraries.
/varVariable files (e.g., logs, spools).
/tmpTemporary files.
/mnt, /mediaMount points for removable storage.

2. 📚 Managing Shared Libraries

Tool / FileDescription
ldd binaryLists shared libraries required by a binary.
ldconfigUpdates the dynamic linker runtime bindings.
/etc/ld.so.confFile listing directories for shared libraries.
LD_LIBRARY_PATHTemporary environment variable to specify additional library paths.

Example:

1
export LD_LIBRARY_PATH=/custom/lib:$LD_LIBRARY_PATH

3. 📦 Debian Package Management

a. /etc/apt/sources.list

Defines package sources:

1
deb http://deb.debian.org/debian stable main contrib non-free

b. apt-get – Basic commands:

1
2
3
4
sudo apt-get update        # Update package list
sudo apt-get upgrade       # Upgrade installed packages
sudo apt-get install pkg   # Install a package
sudo apt-get remove pkg    # Remove a package

c. dpkg

Low-level package tool:

1
2
3
sudo dpkg -i package.deb    # Install .deb file
sudo dpkg -r package         # Remove package
dpkg -l | grep pkgname       # List package info

d. apt-cache

Query APT package cache:

1
2
apt-cache search firefox
apt-cache show firefox

e. aptitude (TUI tool, optional)

1
2
sudo aptitude        # Launch UI
sudo aptitude install pkgname

4. 📦 RPM and YUM Package Management

f. /etc/yum.conf and /etc/yum.repos.d/

  • yum.conf: Main configuration.
  • .repo files in /etc/yum.repos.d/ define repository sources.

g. yumdownloader

Download RPMs without installing:

1
2
sudo yum install yum-utils
yumdownloader package

h. rpm and rpm2cpio

  • Install:
1
sudo rpm -ivh package.rpm
  • Convert .rpm to .cpio archive:
1
rpm2cpio file.rpm | cpio -idmv

Link TypeCommandDescription
Symbolic (soft) linkln -s target linknamePoints to a file or directory path.
Hard linkln target linknamePoints to same inode; works only within same filesystem.

Examples:

1
2
ln -s /etc/nginx/nginx.conf ~/nginx.conf_link
ln /bin/ls ~/ls_hardlink

This post is licensed under CC BY 4.0 by the author.