Package Versions

Managing package versions, version tracking, and understanding semantic versioning in Linux distributions

Package versions track software releases and updates in Linux distributions. Understanding version management is crucial for maintaining system stability, security, and compatibility when installing, upgrading, or troubleshooting software packages.

Key Concepts

  • Version Number: Identifies specific software release (e.g., 2.4.1)
  • Package Repository: Central storage for software packages
  • Dependencies: Required packages for software to function
  • Upgrade vs Update: Upgrade changes versions, update refreshes package lists
  • Semantic Versioning: MAJOR.MINOR.PATCH format
  • Release Channels: Stable, testing, unstable package streams

Command Syntax

Debian/Ubuntu (APT)

apt list [options] [package-name] apt-cache [command] [package-name]

Red Hat/CentOS (YUM/DNF)

yum list [options] [package-name] dnf list [options] [package-name]

Common Options

APT Options

--installed - Show only installed packages --upgradable - Show packages with available upgrades --all-versions - Show all available versions

YUM/DNF Options

installed - List installed packages available - Show available packages updates - Show packages with updates

Practical Examples

Example 1: Check installed package version

1
2
3
4
5
6
# Debian/Ubuntu
apt list --installed | grep nginx
# Output: nginx/stable,now 1.18.0-6 amd64 [installed]

# Red Hat/CentOS
yum list installed | grep nginx

Shows currently installed version of nginx

Example 2: View available versions

1
2
3
4
5
6
# Debian/Ubuntu
apt-cache policy nginx
# Shows available versions and repositories

# Red Hat/CentOS  
yum --showduplicates list nginx

Displays all available versions in repositories

Example 3: Check specific package info

1
2
3
4
5
6
# Debian/Ubuntu
apt show nginx
# Detailed package information including version

# Red Hat/CentOS
yum info nginx

Shows comprehensive package details and version

Example 4: Find upgradable packages

1
2
3
4
5
# Debian/Ubuntu
apt list --upgradable

# Red Hat/CentOS
yum check-update

Lists packages with newer versions available

Use Cases

  • Security Updates: Check for patches and security fixes
  • Compatibility Planning: Ensure software versions work together
  • System Auditing: Document installed software versions
  • Rollback Planning: Know current versions before upgrades
  • Dependency Resolution: Verify required package versions

dpkg -l - List installed packages (Debian) rpm -qa - Query all installed packages (Red Hat) apt-cache search - Search for packages yum search - Search package repositories apt upgrade - Upgrade installed packages yum update - Update system packages

Tips & Troubleshooting

  • Hold packages to prevent unwanted updates: apt-mark hold package-name
  • Check package sources if versions seem outdated: cat /etc/apt/sources.list
  • Clear package cache if getting stale information: apt update or yum clean all
  • Version conflicts: Use apt-cache depends to check dependencies
  • Pin specific versions in /etc/apt/preferences for critical stability
  • Always backup before major version upgrades
  • Test upgrades in non-production environments first