说明:
- DNF与YUM完全兼容,提供了YUM兼容的命令行以及为扩展和插件提供的API。
- 使用DNF需要管理员权限,本节所有命令需要在管理员权限下执行。
DNF 的主要配置文件是 /etc/dnf/dnf.conf,该文件包含两部分:
另外,在/etc/yum.repos.d 目录中保存着一个或多个repo源相关文件,它们也可以定义不同的“repository”。
所以openEuler软件源的配置一般有两种方式,一种是直接配置/etc/dnf/dnf.conf文件中的“repository”部分,另外一种是在/etc/yum.repos.d目录下增加.repo文件。
/etc/dnf/dnf.conf 文件包含的“main”部分,配置示例如下:
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False
常用选项说明:
表 1 main参数说明
参数 | 说明 |
---|---|
cachedir | 缓存目录,该目录用于存储RPM包和数据库文件。 |
keepcache | 可选值是1和0,表示是否要缓存已安装成功的那些RPM包及头文件,默认值为0,即不缓存。 |
debuglevel | 设置dnf生成的debug信息。取值范围:[0-10],数值越大会输出越详细的debug信息。默认值为2,设置为0表示不输出debug信息。 |
clean_requirements_on_remove | 删除在dnf remove期间不再使用的依赖项,如果软件包是通过DNF安装的,而不是通过显式用户请求安装的,则只能通过clean_requirements_on_remove删除软件包,即它是作为依赖项引入的。 默认值为True。 |
best | 升级包时,总是尝试安装其最高版本,如果最高版本无法安装,则提示无法安装的原因并停止安装。默认值为True。 |
obsoletes | 可选值1和0,设置是否允许更新陈旧的RPM包。默认值为1,表示允许更新。 |
gpgcheck | 可选值1和0,设置是否进行gpg校验。默认值为1,表示需要进行校验。 |
plugins | 可选值1和0,表示启用或禁用dnf插件。默认值为1,表示启用dnf插件。 |
installonly_limit | 设置可以同时安装“installonlypkgs”指令列出包的数量。默认值为3,不建议降低此值。 |
repository部分允许您定义定制化的openEuler软件源仓库,各个仓库的名称不能相同,否则会引起冲突。配置repository部分有两种方式,一种是直接配置/etc/dnf/dnf.conf文件中的“repository”部分,另外一种是配置/etc/yum.repos.d目录下的.repo文件。
直接配置/etc/dnf/dnf.conf文件中的“repository”部分
下面是[repository]部分的一个最小配置示例:
[repository]
name=repository_name
baseurl=repository_url
说明:
openEuler提供在线的镜像源,地址:https://repo.openeuler.org/。以 openEuler 22.03的x86_64版本为例,baseurl可配置为https://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/。
选项说明:
表 2 repository参数说明
参数 | 说明 |
---|---|
name=repository_name | 软件仓库(repository )描述的字符串。 |
baseurl=repository_url | 软件仓库(repository )的地址。使用http协议的网络位置:例如 http://path/to/repo使用ftp协议的网络位置:例如 ftp://path/to/repo本地位置:例如 file:///path/to/local/repo |
配置/etc/yum.repos.d目录下的.repo文件
openEuler提供了多种repo源供用户在线使用,各repo源含义可参考系统安装。使用root权限添加openEuler repo源,示例如下:
# vi /etc/yum.repos.d/openEuler.repo
[OS]
name=openEuler-$releasever - OS
baseurl=https://repo.openeuler.org/openEuler-22.03/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.openeuler.org/openEuler-22.03/OS/$basearch/RPM-GPG-KEY-openEuler
说明:
- enabled为是否启用该软件源仓库,可选值为1和0。默认值为1,表示启用该软件源仓库。
- gpgkey为验证签名用的公钥。
要显示当前的配置信息:
# dnf config-manager --dump
例如示例命令如下
[root@superman-21 ~]# dnf config-manager --dump
=========================================================== main ============================================================
[main]
allow_vendor_change = 1
assumeno = 0
assumeyes = 0
autocheck_running_kernel = 1
bandwidth = 0
best = 1
bugtracker_url = https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=dnf
cachedir = /var/cache/dnf
cacheonly = 0
.
.
.
system_cachedir = /var/cache/dnf
throttle = 0
timeout = 30
transformdb = 1
tsflags =
upgrade_group_objects_upgrade = 1
user_agent = libdnf (openEuler 22.03; generic; Linux.x86_64)
username =
varsdir = /etc/yum/vars, /etc/dnf/vars
zchunk = 1
[root@superman-21 ~]#
要显示相应软件源的配置,首先查询repo id:
# dnf repolist
例如示例命令如下:
[root@superman-21 ~]# dnf repolist
repo id repo name
EPOL EPOL
OS OS
debuginfo debuginfo
everything everything
source source
update update
[root@superman-21 ~]#
然后执行如下命令,显示对应id的软件源配置,其中 repository 为查询得到的repo id:
# dnf config-manager --dump repository
例如示例命令如下:
[root@superman-21 ~]# dnf config-manager --dump OS
=================================== repo: OS ===================================
[OS]
bandwidth = 0
baseurl = http://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/
cachedir = /var/cache/dnf
cost = 1000
countme = 0
deltarpm = 1
deltarpm_percentage = 75
enabled = 1
enabled_metadata =
enablegroups = 1
exclude =
excludepkgs =
fastestmirror = 0
gpgcheck = 1
gpgkey = http://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler
includepkgs =
ip_resolve = whatever
max_parallel_downloads = 3
mediaid =
metadata_expire = 172800
minrate = 1000
module_hotfixes = 0
name = OS
password =
priority = 99
protected_packages = dnf, dnf, sudo, systemd, systemd-udev, yum, dnf, sudo, systemd, systemd-udev, yum
proxy =
proxy_auth_method = any
proxy_sslcacert =
proxy_sslclientcert =
proxy_sslclientkey =
proxy_sslverify = 1
repo_gpgcheck = 0
retries = 10
skip_if_unavailable = 0
sslcacert =
sslclientcert =
sslclientkey =
sslverify = 1
sslverifystatus = 0
throttle = 0
timeout = 30
type =
user_agent = libdnf (openEuler 22.03; generic; Linux.x86_64)
username =
[root@superman-21 ~]#
您也可以使用一个全局正则表达式,来显示所有匹配部分的配置:
# dnf config-manager --dump glob_expression
例如示例命令如下:
[root@superman-21 ~]# dnf config-manager --dump | grep retries
retries = 10
[root@superman-21 ~]#
要建立一个本地软件源仓库,请按照下列步骤操作。
安装createrepo软件包。在root权限下执行如下命令:
# dnf install createrepo
例如示例命令如下:
[root@superman-21 ~]# dnf install createrepo
OS 42 kB/s | 3.8 kB 00:00
everything 43 kB/s | 3.8 kB 00:00
EPOL 31 kB/s | 3.0 kB 00:00
debuginfo 43 kB/s | 3.8 kB 00:00
source 43 kB/s | 3.8 kB 00:00
update 41 kB/s | 3.5 kB 00:00
update 5.4 MB/s | 28 MB 00:05
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
createrepo_c x86_64 0.17.6-1.oe2203 OS 137 k
Installing dependencies:
drpm x86_64 0.5.0-2.oe2203 update 60 k
Transaction Summary
================================================================================
Install 2 Packages
Total download size: 197 k
Installed size: 535 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): drpm-0.5.0-2.oe2203.x86_64.rpm 320 kB/s | 60 kB 00:00
(2/2): createrepo_c-0.17.6-1.oe2203.x86_64.rpm 621 kB/s | 137 kB 00:00
--------------------------------------------------------------------------------
Total 879 kB/s | 197 kB 00:00
retrieving repo key for OS unencrypted from http://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler
OS 22 kB/s | 2.1 kB 00:00
Importing GPG key 0xB25E7F66:
Userid : "private OBS (key without passphrase) "
Fingerprint: 12EA 74AC 9DF4 8D46 C69C A0BE D557 065E B25E 7F66
From : http://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : drpm-0.5.0-2.oe2203.x86_64 1/2
Installing : createrepo_c-0.17.6-1.oe2203.x86_64 2/2
Running scriptlet: createrepo_c-0.17.6-1.oe2203.x86_64 2/2
Verifying : createrepo_c-0.17.6-1.oe2203.x86_64 1/2
Verifying : drpm-0.5.0-2.oe2203.x86_64 2/2
Installed:
createrepo_c-0.17.6-1.oe2203.x86_64 drpm-0.5.0-2.oe2203.x86_64
Complete!
[root@superman-21 ~]#
将需要的软件包复制到一个目录下,如/local_repo 。
[root@superman-21 ~]# cp /mnt/Packages/per* /local_repo/
[root@superman-21 ~]#
[root@superman-21 ~]# ls /local_repo/
perf-5.10.0-60.18.0.50.oe2203.x86_64.rpm
perftest-4.5-1.oe2203.x86_64.rpm
perl-5.34.0-3.oe2203.x86_64.rpm
perl-Algorithm-Diff-1.201-1.oe2203.noarch.rpm
perl-Archive-Tar-2.40-1.oe2203.noarch.rpm
perl-autodie-2.34-2.oe2203.noarch.rpm
perl-B-Debug-1.26-5.oe2203.noarch.rpm
perl-bignum-0.63-1.oe2203.noarch.rpm
perl-Bit-Vector-7.4-15.oe2203.x86_64.rpm
perl-Carp-1.50-418.oe2203.noarch.rpm
.
.
.
perl-XML-Parser-2.46-1.oe2203.x86_64.rpm
perl-XML-Parser-help-2.46-1.oe2203.noarch.rpm
perl-XML-SAX-1.02-1.oe2203.noarch.rpm
perl-XML-SAX-Base-1.09-7.oe2203.noarch.rpm
perl-XML-Simple-2.25-4.oe2203.noarch.rpm
perl-XML-Writer-0.900-1.oe2203.noarch.rpm
perl-XML-Writer-help-0.900-1.oe2203.noarch.rpm
perl-XML-XPath-1.44-1.oe2203.noarch.rpm
perl-YAML-LibYAML-0.82-2.oe2203.x86_64.rpm
[root@superman-21 ~]#
创建软件源,执行以下命令:
# createrepo /local_repo
例如示例命令如下:
[root@superman-21 ~]# createrepo /local_repo
Directory walk started
Directory walk done - 168 packages
Temporary output repo path: /local_repo/.repodata/
Preparing sqlite DBs
Pool started (with 5 workers)
Pool finished
[root@superman-21 ~]#
[root@superman-21 ~]# ls /local_repo/
perf-5.10.0-60.18.0.50.oe2203.x86_64.rpm
perftest-4.5-1.oe2203.x86_64.rpm
perl-5.34.0-3.oe2203.x86_64.rpm
.
.
.
perl-XML-Parser-2.46-1.oe2203.x86_64.rpm
perl-XML-Parser-help-2.46-1.oe2203.noarch.rpm
perl-XML-SAX-1.02-1.oe2203.noarch.rpm
perl-XML-SAX-Base-1.09-7.oe2203.noarch.rpm
perl-XML-Simple-2.25-4.oe2203.noarch.rpm
perl-XML-Writer-0.900-1.oe2203.noarch.rpm
perl-XML-Writer-help-0.900-1.oe2203.noarch.rpm
perl-XML-XPath-1.44-1.oe2203.noarch.rpm
perl-YAML-LibYAML-0.82-2.oe2203.x86_64.rpm
repodata
[root@superman-21 ~]#
本节将介绍如何通过“dnf config-manager”命令添加、启用和禁用软件源仓库。
要定义一个新的软件源仓库,您可以在 /etc/dnf/dnf.conf 文件中添加“repository”部分,或者在/etc/yum.repos.d/目录下添加“.repo”文件进行说明。建议您通过添加“.repo”的方式,每个软件源都有自己对应的“.repo”文件,以下介绍该方式的操作方法。
要在您的系统中添加一个这样的源,请在root权限下执行如下命令,执行完成之后会在/etc/yum.repos.d/目录下生成对应的repo文件。其中 repository_url 为repo源地址,详情请参见表2。
# dnf config-manager --add-repo repository_url
例如示例命令如下:
[root@superman-21 ~]# dnf config-manager --add-repo /local_repo
添加仓库自:file:///local_repo
[root@superman-21 ~]#
要禁用软件源,请在root权限下执行如下命令:
# dnf config-manager --set-disable repository
例如示例命令如下:
[root@superman-21 ~]# cat /etc/yum.repos.d/openEuler.repo
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/update/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[root@superman-21 ~]#
[root@superman-21 ~]# dnf config-manager --set-disable update
[root@superman-21 ~]#
[root@superman-21 ~]# cat /etc/yum.repos.d/openEuler.repo
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/update/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[root@superman-21 ~]#
同样的,您也可以使用一个全局正则表达式来禁用所有匹配的软件源:
# dnf config-manager --set-disable glob_expression
例如示例命令如下:
[root@superman-21 ~]# cat /etc/yum.repos.d/openEuler.repo
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/update/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[root@superman-21 ~]#
[root@superman-21 ~]# dnf config-manager --set-disable {source,update}
[root@superman-21 ~]#
[root@superman-21 ~]# cat /etc/yum.repos.d/openEuler.repo
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/source/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/update/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[root@superman-21 ~]#
要启用软件源,请在root权限下执行如下命令,其中 repository 为新增.repo文件中的repo id(可通过dnf repolist查询):
# dnf config-manager --set-enable repository
例如示例命令如下:
[root@superman-21 ~]# cat /etc/yum.repos.d/openEuler.repo
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/update/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[root@superman-21 ~]#
[root@superman-21 ~]# dnf config-manager --set-enable update
[root@superman-21 ~]#
[root@superman-21 ~]# cat /etc/yum.repos.d/openEuler.repo
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/update/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[root@superman-21 ~]#
您也可以使用一个全局正则表达式,来启用所有匹配的软件源。其中 glob_expression 为对应的正则表达式,用于同时匹配多个repo id:
# dnf config-manager --set-enable glob_expression
例如示例命令如下:
[root@superman-21 ~]# cat /etc/yum.repos.d/openEuler.repo
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/source/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/update/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[root@superman-21 ~]#
[root@superman-21 ~]# dnf config-manager --set-enable {source,update}
[root@superman-21 ~]#
[root@superman-21 ~]# cat /etc/yum.repos.d/openEuler.repo
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-22.03-LTS/update/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[root@superman-21 ~]#