Use yum to install, uninstall, and upgrade RPM packages

Using Yum tools is more convenient than using RPM tools. The biggest advantage of the yum tool is that it can be connected to the Internet to download the required RPM packages, and then install them automatically. If the RPM package to be installed has dependencies, the yum tool will help us install all related RPM packages in sequence.

List all available RPM packages yum list, only 20 are listed here

As can be seen from the above, Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast,
this means that the data of Repodata has exceeded two weeks, and needs to be updated. We run yum makecache fast

 Run yum list | head -n 20 again

As can be seen from the above example, the information mirrors.bupt.edu.cn appears, which tells the user that it is the RPM package resource downloaded from mirrors.bupt.edu.cn.
It can also be seen that the RPM package name is on the far left, the version information is in the middle, and the installation information is on the far right.
If it is installed, @base, @updates or @anaconda will be displayed on the far right
. If it is not installed, it will display base Or if anaconda
is installed but needs to be upgraded, it will display updates

The yum list command will first list the installed package (installed package), and then list the available package (available package)

Search for RPM packages, yum search [related keywords]

 Use grep to filter the search results to find the corresponding RPM package

 Install the RPM package

The command to install the RPM package is yum install [-y] [RPM package name]. If the -y option is not added, it will be installed interactively with the user.

 In this process, it will first list the RPM packages that need to be installed, and if there are dependencies, it will also list all dependent packages. Then ask the user whether to install, input y to install, input n to not install. The -y option will omit the step of asking the user whether to install

Uninstalling the RPM package: yum remove [-y] [RPM package name]

 Uninstallation is the same as installation, and you can directly add the -y option to omit which step of interacting with the user. However, when uninstalling a certain RPM package, be sure to check it clearly, and do not uninstall other important RPM packages at the same time, so as not to affect Normal business, so when using the yum remove command to uninstall the package, still add the -y option.

Upgrade the RPM package: yum update [-y] [RPM package]

Guess you like

Origin blog.csdn.net/yanzhenxi/article/details/127353498