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了。


分享到:


相關文章: