Centos8.1 配置本地Yum源,DNF的主要命令

一、先将iso镜像文件挂载

#mount /dev/cdrom /mnt

将cdrom挂载到/mnt下

删除/etc/yum.repos.d/ 目录下所有文件

新建文件local.repo

vi /etc/yum.repos.d/local.repo

[InstallMedia]

name=CentOS Linux 8

baseurl=file:///mnt/BaseOS

gpgcheck=0

enabled=1

[AppStream]

name=AppStream

baseurl=file:///mnt/AppStream

enabled=1

gpgcheck=0

保存文件local.repo

yum源新建缓存,检查文件:

yum makecache

yum repolist

三、还有一种方法,把iso下源文件全部拷贝进系统,新建目录/yum,再对应目录配置yum源文件

cp -rf /mnt/ /yum/

四、DNF的主要命令

$ dnf --help

usage: dnf [options] COMMAND

List of Main Commands:

alias List or create command aliases

autoremove remove all unneeded packages that were originally installed as dependencies

check check for problems in the packagedb

check-update check for available package upgrades

clean remove cached data

deplist List package's dependencies and what packages provide them

distro-sync synchronize installed packages to the latest available versions

downgrade Downgrade a package

group display, or use, the groups information

help display a helpful usage message

history display, or use, the transaction history

info display details about a package or group of packages

install install a package or packages on your system

list list a package or groups of packages

makecache generate the metadata cache

mark mark or unmark installed packages as installed by user.

module Interact with Modules.

provides find what package provides the given value

reinstall reinstall a package

remove remove a package or packages from your system

repolist display the configured software repositories

repoquery search for packages matching keyword

repository-packages run commands on top of all packages in given repository

search search package details for the given string

shell run an interactive DNF shell

swap run an interactive dnf mod for remove and install one spec

updateinfo display advisories about packages

upgrade upgrade a package or packages on your system

upgrade-minimal upgrade, but only 'newest' package match which fixes a problem that affects your system

DNF最后的这个upgrade-minimal命令,貌似Yum没有,这个命令看着很不错。总之,能用DNF,就不要再用yum了。