Getting Started with Linux package management basics

Source: Internet
Author: User
Tags linux mint

Most modern Unix-like operating systems provide a centralized package management mechanism to help users search, install, and manage software. Software is usually stored in the form of "package" in the warehouse "repository", the use and management of the package is called package management. The basic components of a Linux package typically include: Shared libraries, applications, services, and documents

Package management is typically not limited to a one-time installation of software, but also includes tools for upgrading installed packages. The "package warehouse" helps ensure that the code is audited on the system you are using and is managed by the software developer or the package maintainer.

When configuring a Linux server or development environment, it is often not limited to using official sources. While the stable version of software packages used by official sources is likely to be outdated compared to the fast-updating iterations of today's version of the system, it is a common skill to master Common Linux package Management basic operations for systems administrators and developers.

This article will describe the basic ways and quick reference for the common Linux distributions: search, install, and upgrade package management, and can help you quickly understand the basic operations and techniques of different Linux package management.

Package Management System: A brief introduction

Most package management systems are collections built on package files that typically contain compiled binaries and other resources: software, installation scripts, metadata, and the list of dependencies required.

While most popular Linux distributions are similar in package management tools, methods, and forms, there are still platform differences:

system format Tools
Debian . deb Apt, Apt-cache, Apt-get, dpkg
Ubuntu . deb Apt, Apt-cache, Apt-get, dpkg
Centos . rpm Yum
Fedora . rpm Dnf

Debian and its derivatives such as Ubuntu, Linux Mint, and Raspbian package format are . deb files, APT is the most common package Operations command, which can: search for libraries, install packages and their dependencies and manage upgrades. You need to use the dpkg command to install the ready -made. deb package directly.

CentOS, Fedora, and Red Hat series Linux use rpm package files and use the Yum command to manage package files and interact with the software library.

In the latest version of Fedora, theyum command has been replaced by DNF for package management.

Update the local package database list

Most Linux uses a local database to store a list of remotely available package warehouses, so it's a good idea to update the database before installing or upgrading the package.

system Command
Debian/ubuntu sudo apt-get update
Centos Yum Check-update
Fedora DNF Check-update
upgrade an installed package

In the absence of package management, it is a huge project to upgrade and maintain the latest version of Linux installed software, and administrators and users have to manually track upstream software version changes and security warnings. With a package management system, you can keep your software up-to-date with just a few commands.

system Command Notes
Debian/ubuntu sudo apt-get upgrade Upgrade only installed Packages
sudo apt-get dist-upgrade You can add or remove packages to meet the new dependencies.
Centos sudo yum update
Fedora sudo DNF upgrade
Find/Search Packages

Most Linux desktop editions provide a user-friendly interface for searching and installing soft packages, which is the best way to find and install software. But for the pursuit of efficiency and server administrators, using the command-line tool to find/search packages is the right way.

system Command Notes
Debian/ubuntu Apt-cache Search Content
Centos Yum Search Content
Yum Search All content Search all content, including package descriptions.
Fedora DNF Search Content
DNF Search All content Search all content, including package descriptions.
View a package information

Before deciding which package to install, we often need to look at the detailed description of the package. The package's description file typically includes metadata such as package name, version number, and dependency list, which can be viewed using the following command.

system Command Notes
Debian/ubuntu Apt-cache Show Package Name Displays local cache information about the package
Dpkg-s Package Name Displays the current installation state of the package
Centos Yum Info Package Name
Yum Deplist Package Name Since the package was listed
Fedora DNF Info Package Name
DNF Repoquery–requires Package Name Since the package was listed
installing packages from the Software warehouse

Once we know the name of a package, we can use the following command to install the package from the repository.

system Command Notes
Debian/ubuntu sudo apt-get Install package name
sudo apt-get Install Pack 1 Pack 2 ... Install all the listed packages
sudo apt-get install-y package name Direct installation without prompting
Centos sudo yum install package name
sudo yum Install Pack 1 Pack 2 ... Install all the listed packages
sudo yum install-y package name Direct installation without prompting
Fedora sudo DNF Install package name
sudo DNF Install Pack 1 Pack 2 ... Install all the listed packages
sudo DNF install-y package name Direct installation without prompting
install packages directly from the local file system

Most of the time, we need to install the package directly from the local file system after testing or getting the package directly from somewhere. Debian and derivative systems can be installed using dpkg , and the CentOS and Fedora systems are installed using the Yum and DNF commands.

system Command Notes
Debian/ubuntu sudo dpkg-i package name. deb
sudo apt-get install-y gdebi&& sudo gdebi package name. deb Using Gdebi to retrieve missing dependencies
Centos sudo yum install package name. rpm
Fedora sudo DNF install package name. rpm
Remove an installed package

Because the package manager knows which files are provided by which packages, it is usually possible to get a clean system after uninstalling the unwanted packages.

system Command Notes
Debian/ubuntu sudo apt-get Remove package name
sudo apt-get autoremove Automatic removal of known unwanted packages
Centos sudo yum Remove package name
Fedora sudo DNF Erase package name

OK, this article is about the common Linux distribution package management basic operations, to help beginners get started faster and everyone in the Linux distribution to get started faster.

This address: http://www.linuxprobe.com/linux-basic-manage/

Getting Started with Linux package management basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.