I. Software Installation Methods Comparison

  1. Wget is not an installation tool
    Wget is a download tool similar to Xunlei. To download a software package, you can directly use wget followed by the download URL.
  2. apt-get
    This is a software installation method in Ubuntu, which is based on Debian.
  3. Yum
    This is a software installation method in RedHat and CentOS, based on the Linux operating system.

II. Overview of Common Tools

  1. Wget
    Wget is similar to Xunlei and is a download tool. It supports downloads through the three most common TCP/IP protocols: HTTP, HTTPS, and FTP. It also supports HTTP proxying.
    The name "wget" combines "World Wide Web" and "get."
  2. Yum
    Yum is the software installation tool for RedHat and CentOS systems, based on Linux. The full name is "Yellow dog Updater, Modified." It is a shell-based front-end package manager in Fedora, RedHat, and CentOS.
    It is based on RPM package management and can automatically download and install RPM packages from specified servers. It can handle dependency resolution automatically and install all dependent packages in one go.
  3. RPM
    RPM stands for "RedHat Package Management." It's used to install or uninstall .rpm software packages.

    • To install a package: rpm -ivh xxx.rpm
    • To uninstall a package: rpm -e package-name

    Example:
    First, use wget to download an RPM package, then install it using rpm -ivh xxx.rpm. To simplify things, you can directly use yum install package-name to download and install the RPM package and its dependencies automatically.

  4. apt-get
    This is a software installation method in Ubuntu, which is based on Debian.

III. Solving "wget: command not found"

If you're using CentOS 6.5, wget is not installed by default. To resolve this, you need to install wget.

Solution

  1. Method 1: Install using Yum
    yum install wget
  2. Method 2: Install using RPM
    If Yum is not available, you can download the RPM package and install it manually.

IV. Major Linux Distributions

Linux systems generally fall into two categories:

  1. RedHat Series:
    Includes RedHat, CentOS, Fedora, etc.

    • Common package format: RPM
    • Installation command for RPM packages: rpm -parameter
    • Package management tool: Yum
    • Supports tar packages
  2. Debian Series:
    Includes Debian, Ubuntu, etc.

    • Common package format: DEB
    • Installation command for DEB packages: dpkg -parameter
    • Package management tool: apt-get
    • Supports tar packages

Differences Between RPM and Tar:

  • Tar: This is just a compression format. It compresses and packages files.
  • RPM: Similar to installation files in Windows, it automatically handles software package dependencies.

Pros and Cons:

  • RPM: Pre-compiled, which may bind it to a specific CPU or distribution.
  • Tar: Usually includes a compilation script, offering more flexibility and compatibility with different environments.

If you don't want to release the source code, you can use RPM. For open-source projects, tar might be more convenient.
Installing software using tar typically involves the following three steps:
./configure, make, make install.


V. RPM Installation and Management

For Binary .rpm Packages (CentOS):

  • Install: rpm -ivh *.rpm
  • Uninstall: rpm -e package-name
  • Upgrade: rpm -Uvh xxx

Common Queries:

  • Check installed packages: rpm -qa
  • Check a specific package: rpm -qa | grep xxx
  • Show package information: rpm -qi xxx
  • Check installation path: rpm -ql xxx
  • Check configuration files: rpm -qc xxx
  • Find the package that generated a specific file: rpm -qf /etc/yum.conf

VI. Managing Source Code Packages (src.rpm)

Source code packages provide the full source code and require manual compilation. While this offers flexibility, it's more difficult and not recommended for beginners.

Commands for .src.rpm Packages:

  • Build and install:
    rpm -rebuild *.src.rpm
    After compilation, install the resulting binary RPM from /usr/src/dist/RPMS using rpm -ivh *.rpm.

VII. Debian Package Management (dpkg)

Common dpkg Commands:

  1. Install a package: dpkg -i <package.deb>
  2. List package contents: dpkg -c <package.deb>
  3. Show package information: dpkg -I <package.deb>
  4. Remove a package: dpkg -r <package>
  5. Purge a package (including config files): dpkg -P <package>
  6. List installed package files: dpkg -L <package>
  7. Show installed package information: dpkg -s <package>

VIII. Yum and apt-get: Advanced Package Management

Yum (RedHat/CentOS):

  • Install software: yum install xxx
  • Uninstall software: yum remove xxx
  • Update system: yum update
  • Clean cache: yum clean all

apt-get (Ubuntu/Debian):

  • Install software: sudo apt-get install xxx
  • Remove software: sudo apt-get remove xxx
  • Update system: sudo apt-get update && sudo apt-get upgrade
  • Upgrade to new distribution: sudo apt-get dist-upgrade

Common Commands:

  • Search for packages: apt-cache search package
  • Show package information: apt-cache show package
  • Reinstall a package: sudo apt-get install --reinstall package
  • Fix missing dependencies: sudo apt-get -f install
  • Clean unnecessary files: sudo apt-get clean && sudo apt-get autoclean

This comprehensive guide covers essential Linux software management tools, including wget, yum, RPM, apt-get, and dpkg, outlining their usage in downloading, installing, and managing software packages across different Linux distributions.

Last modification:October 3, 2024
如果觉得我的文章对你有用,请随意赞赏