LogoLogo
  • Welcome
  • Explorers
    • Aptos Explorer
    • Cosmos Explorer
  • Blockchains
    • Aptos
      • Run a Validator and VFN
        • Operator
        • Node Requirements
        • Deploy Nodes
          • Using Source Code
        • Connect Nodes
          • Connect to a Network
          • Staking Pool Operations
          • Delegation Pool Operations
          • Staking Pool Voter
        • Verify Nodes
          • Node Health
          • Validator Leaderboard
        • Modify Nodes
          • Upgrade Nodes
          • Shutdown Nodes
      • Run a Public Fullnode
        • PFN Requirements
        • Deploy a PFN
          • Deploy a PFN using Source Code
        • Verify a PFN
        • Modify a PFN
          • Customize PFN Networks
          • Generate a PFN Identity
          • Upgrade your PFN
          • Run a PFN from Source Code
      • Bootstrap a Node with historical data
        • Bootstrap from a Backup
        • Bootstrap from a Snapshot
      • Configure a Node
        • State Synchronization
        • Data Pruning
        • Telemetry
        • Locating Node Files
          • Files For Mainnet
          • Files For Testnet
          • Files For Devnet
      • Monitor your Nodes
        • Important Node Metrics
        • Node Health Checker
        • Node Health Checker FAQ
        • Node Inspection Service
      • Building Aptos From Source
      • Aptos Networks
    • Berachain V2
      • Node Snapshot
      • Explorer
      • AddrBook File
      • Genesis File
      • API Endpoint
      • RPC Endpoint
      • gRPC Endpoint
      • Live Peers
      • Forest Staking Peer
      • Performance Optimizer Script
      • Discord & TG Alert System
      • RPC Load Balancer Setup
    • Casper
      • Explorer
    • Haqq
      • Node Snapshot
      • Explorer
      • AddrBook File
      • Genesis File
      • API Endpoint
      • RPC Endpoint
      • Live Peers
      • Forest Staking Peer
    • Mantra
      • Node Snapshot
      • Explorer
      • AddrBook File
      • Genesis File
      • API Endpoint
      • RPC Endpoint
      • Live Peers
      • Forest Staking Peer
    • Ika
    • Story Protocol
      • Node Snapshot
      • Explorer
      • AddrBook File
      • Genesis File
      • API Endpoint
      • RPC Endpoint
      • EVM Endpoint
      • Websocket
      • WSS
      • Discord & TG Alert System
      • RPC Load Balancer
      • Performance Optimizer Script
      • Live Peers
      • Forest Staking Peer
    • Supra
      • Explorer
      • Oracle data
    • Showdown
      • Node Snapshot
      • Explorer
      • AddrBook File
      • Genesis File
      • API Endpoint
      • RPC Endpoint
      • Live Peers
      • Forest Staking Peer
    • Soarchain
      • Node Snapshot
      • Explorer
      • AddrBook File
      • Genesis File
      • API Endpoint
      • RPC Endpoint
      • Live Peers
      • Forest Staking Peer
    • Zenrock
      • Node Snapshot
      • Explorer
      • AddrBook File
      • Genesis File
      • API Endpoint
      • RPC Endpoint
      • Live Peers
      • Forest Staking Peer
    • Zetachain
      • Node Snapshot
      • Explorer
      • AddrBook File
      • Genesis File
      • API Endpoint
      • RPC Endpoint
      • Live Peers
      • Forest Staking Peer
    • Airchains
      • Node Snapshot
      • Explorer
  • Gunzilla - Off The Grid
    • Vision and Foundation
    • Gunzilla Hacker Dashboard
      • Key Features of the Hackers Dashboard
        • Wallet Integration and Testnet Access
        • License System with Rarity Tiers
        • Decoding Stats and Hash Power Tracking
        • Marketplace for Trading Licenses and Assets
        • Scanner Tool for Blockchain Transparency
        • Social Media Integration and Community Engagement
      • Mastering the Hackers Dashboard
      • Benefits of the Hackers Dashboard
    • Gunzilla Token Page
  • Forest Esports Team
    • Forest Hexers
  • Crypto Tools & Analytics
    • Top 10 Crypto Exchanges
      • Binance
      • Coinbase
      • Kraken
      • Bybit
      • OKX
      • KuCoin
      • Bitfinex
      • Gemini
      • Crypto.com
      • Bitstamp
    • Top 10 Wallets
      • Ledger Nano X
      • Trezor Model T
      • Exodus
      • Coinbase Wallet
      • Trust Wallet
      • MetaMask
      • Crypto.com DeFi Wallet
      • ZenGo
      • Atomic Wallet
      • SafePal
  • Top 10 Crypto Data Platforms
    • CoinMarketCap
    • CoinGecko
    • CryptoCompare
    • CoinCodex
    • Live Coin Watch
    • CoinCheckup
    • Messari
    • CoinPaprika
    • Arkham Intelligence
  • DeFi Analytics and Tracking
    • DefiLlama
    • Dune Analytics
    • DeBank
    • Zapper
    • Token Terminal
    • DeepDAO
    • Revert Finance
    • L2BEAT
  • API's
    • What are APIs?
    • How APIs Work
    • Types of APIs
    • Real-World API Use Cases
    • Benefits of Using API's
    • Challenges and Considerations of using API's
  • Node Security
    • Physical Security
    • Network Security
    • System and Software Security
    • Access Control
    • Data Security
    • Monitoring and Logging
    • Backup and Disaster Recovery
    • Best Practices for Validator Nodes
    • Cloud Security
    • Incident Response and Recovery
  • Linux Bash
    • Bash 101
      • Getting Started with Bash
      • Navigating the File System
      • File Management Basics
      • Viewing and Editing Files
      • Managing Permissions
      • Working with Processes
      • Using Pipes and Redirection
      • Bash Scripting Basics
      • Essential Networking Commands
      • Installing Software with Package Managers
    • Advanced Linux for Validator Nodes
      • Advanced Bash Scripting for Node Automation and Maintenance
      • Monitoring and Logging Essentials
      • Networking and Security Best Practices
      • Backup and Disaster Recovery
  • Staking 101
    • Understand What Staking Is and How It Works
    • Choose a Blockchain Network to Stake On
    • Set Up a Compatible Wallet for Staking
    • Purchase or Transfer Funds for Staking
    • Choose a Staking Pool
    • Connect Your Wallet to a Staking Platform
    • Confirm and Stake Your Funds
    • Monitor Staking Rewards and Performance
    • Withdraw or Re-Stake Rewards
  • Optimizing Your Infrastructure Choices
    • Infrastructure Comparison: VPS vs. Bare Metal
Powered by GitBook
On this page

Was this helpful?

  1. Linux Bash
  2. Bash 101

Installing Software with Package Managers

In Linux, managing software through package managers is an essential skill, as it allows you to install, update, and remove applications efficiently. Package managers streamline software management by automating the retrieval, installation, and dependency handling of software packages. Different Linux distributions use different package managers, with apt commonly used for Ubuntu and Debian systems, and yum or dnf for CentOS and RHEL (Red Hat Enterprise Linux). Let’s dive into how these package managers work, their key commands, and examples of their usage.


1. Ubuntu/Debian Package Management with apt

The apt (Advanced Package Tool) package manager is used to manage software on Debian-based distributions like Ubuntu. It’s user-friendly, powerful, and handles dependencies automatically, ensuring all required packages are installed for a software to run.

  • Updating Package Lists:

    • sudo apt update: This command updates the local list of available packages and their versions, which ensures that the latest versions are fetched when you install or upgrade software.

      $ sudo apt update
      • This command doesn’t upgrade any software—it simply refreshes the package index, showing what’s available in the repositories.

  • Installing Software:

    • sudo apt install packagename: Installs a specific package from the repositories. For example:

      $ sudo apt install curl
      • This command installs curl and any dependencies required for it to run. If the package is already installed, apt will display a message confirming it.

  • Upgrading Installed Software:

    • sudo apt upgrade: Upgrades all installed packages to their latest available versions based on the updated package list.

      $ sudo apt upgrade
      • To upgrade individual packages, use sudo apt install --only-upgrade packagename.

  • Removing Software:

    • sudo apt remove packagename: Removes an installed package without deleting its configuration files.

      $ sudo apt remove curl
    • sudo apt purge packagename: Removes a package and its configuration files, leaving no traces.

      $ sudo apt purge curl
  • Cleaning Up Unused Packages:

    • sudo apt autoremove: Removes packages that were installed as dependencies but are no longer required.

      $ sudo apt autoremove

Example Workflow: Suppose you want to install a new software package, ensure it’s up to date, and remove unused dependencies:

  1. sudo apt update

  2. sudo apt install packagename

  3. sudo apt upgrade

  4. sudo apt autoremove

This series of commands ensures a clean and updated system.


2. CentOS/RHEL Package Management with yum or dnf

On CentOS, RHEL, and Fedora, the package managers used are yum (Yellowdog Updater, Modified) and dnf (Dandified YUM). dnf is the modern replacement for yum and is used by default in recent versions of Fedora, CentOS 8+, and RHEL 8+. Both yum and dnf are similar in functionality to apt but have their syntax and commands specific to the RPM package format used on these systems.

Basic Commands with yum

  • Installing Software:

    • sudo yum install packagename: Installs a package, along with any required dependencies.

      $ sudo yum install curl
  • Updating Package Lists:

    • Unlike apt, yum doesn’t require a separate update of package lists. Instead, yum refreshes lists each time an install or update command is run. However, you can still check for updates:

      $ sudo yum check-update
  • Upgrading Packages:

    • sudo yum update: Updates all installed packages on the system.

      $ sudo yum update
    • You can also update a single package:

      $ sudo yum update packagename
  • Removing Software:

    • sudo yum remove packagename: Uninstalls a package and removes any dependencies that are no longer needed.

      $ sudo yum remove curl

Basic Commands with dnf

dnf is similar to yum but is designed to be faster and more efficient with better dependency handling.

  • Installing Software:

    • sudo dnf install packagename: Installs a package along with its dependencies.

      $ sudo dnf install curl
  • Updating Software:

    • sudo dnf upgrade: Upgrades all installed packages to the latest versions, similar to yum update.

      $ sudo dnf upgrade
  • Removing Software:

    • sudo dnf remove packagename: Uninstalls a package, removing its dependencies if they’re no longer required.

      $ sudo dnf remove curl
  • Clearing Cache:

    • sudo dnf clean all: Clears cached data, which helps free up disk space and ensures fresh package lists.

      $ sudo dnf clean all

Example Workflow: To install, update, and manage packages on a CentOS/RHEL system:

  1. sudo yum install packagename or sudo dnf install packagename

  2. sudo yum update or sudo dnf upgrade

  3. sudo yum autoremove or sudo dnf autoremove

Using dnf instead of yum generally results in faster operations and better dependency resolution.


3. Advanced Package Management Commands

In both apt and dnf/yum, there are additional commands for more advanced package management:

  • List Installed Packages:

    • apt list --installed (Debian/Ubuntu) or yum list installed / dnf list installed (CentOS/RHEL): Lists all installed packages, allowing you to verify if specific software is present on the system.

  • Searching for Packages:

    • apt search keyword: Searches for available packages containing a specific keyword.

      $ apt search nginx
    • yum search keyword or dnf search keyword: Searches for available packages in the repository.

      $ dnf search nginx
  • Checking Package Info:

    • apt show packagename or yum info packagename / dnf info packagename: Shows detailed information about a package, including its version, description, and dependencies.

      $ apt show curl
  • Viewing Logs:

    • cat /var/log/apt/history.log (Debian/Ubuntu) or cat /var/log/yum.log (CentOS/RHEL): Views recent package management activity, useful for auditing and troubleshooting.


Key Differences Between apt, yum, and dnf

  • Package Format: apt works with .deb packages, while yum and dnf work with .rpm packages.

  • Cache Management: dnf automatically manages and cleans its cache better than yum or apt, reducing unnecessary disk usage.

  • Dependency Handling: dnf has enhanced dependency resolution compared to yum, making it faster and more efficient for updates and installations.


Summary of Package Management Commands

  • Ubuntu/Debian:

    • sudo apt update – Updates package lists.

    • sudo apt install packagename – Installs a package.

    • sudo apt upgrade – Upgrades all packages.

    • sudo apt remove packagename – Removes a package.

  • CentOS/RHEL:

    • sudo yum install packagename or sudo dnf install packagename – Installs a package.

    • sudo yum update or sudo dnf upgrade – Upgrades all packages.

    • sudo yum remove packagename or sudo dnf remove packagename – Removes a package.

PreviousEssential Networking CommandsNextAdvanced Linux for Validator Nodes

Last updated 6 months ago

Was this helpful?

Page cover image