从0到1一步一步玩转openEuler--14 openEuler DNF(YUM)配置管理

news2024/11/25 10:47:21

文章目录

      • 14.1 DNF配置文件
        • 14.1.1 配置main部分
        • 14.1.2 配置repository部分
        • 14.1.3 显示当前配置
      • 14.2 创建本地软件源仓库
      • 14.3 添加、启用和禁用软件源
        • 14.3.1 添加软件源
        • 14.3.2 禁用软件源
        • 14.3.3 启用软件源

DNF是一款Linux软件包管理工具,用于管理RPM软件包。DNF可以查询软件包信息,从指定软件库获取软件包,自动处理依赖关系以安装或卸载软件包,以及更新系统到最新可用版本。

image-20221207200634543说明:

  • DNF与YUM完全兼容,提供了YUM兼容的命令行以及为扩展和插件提供的API。
  • 使用DNF需要管理员权限,本节所有命令需要在管理员权限下执行。

14.1 DNF配置文件

DNF 的主要配置文件是 /etc/dnf/dnf.conf,该文件包含两部分:

  • “main”部分保存着DNF的全局设置。
  • “repository”部分保存着软件源的设置,可以有一个或多个“repository”。

另外,在/etc/yum.repos.d 目录中保存着一个或多个repo源相关文件,它们也可以定义不同的“repository”。

所以openEuler软件源的配置一般有两种方式,一种是直接配置/etc/dnf/dnf.conf文件中的“repository”部分,另外一种是在/etc/yum.repos.d目录下增加.repo文件。

14.1.1 配置main部分

/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,不建议降低此值。

14.1.2 配置repository部分

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
    

    img 说明:
    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
    

    img 说明:

    • enabled为是否启用该软件源仓库,可选值为1和0。默认值为1,表示启用该软件源仓库。
    • gpgkey为验证签名用的公钥。

14.1.3 显示当前配置

  • 要显示当前的配置信息:

    # 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 ~]# 
    

14.2 创建本地软件源仓库

要建立一个本地软件源仓库,请按照下列步骤操作。

  1. 安装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) <defaultkey@localobs>"
     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 ~]# 
    
  2. 将需要的软件包复制到一个目录下,如/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 ~]# 
    
  3. 创建软件源,执行以下命令:

    # 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 ~]# 
    

14.3 添加、启用和禁用软件源

本节将介绍如何通过“dnf config-manager”命令添加、启用和禁用软件源仓库。

14.3.1 添加软件源

要定义一个新的软件源仓库,您可以在 /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 ~]# 

14.3.2 禁用软件源

要禁用软件源,请在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 ~]# 

14.3.3 启用软件源

要启用软件源,请在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 ~]# 

image-20230214213849074

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/346227.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

论文笔记: Monocular Depth Estimation: a Review of the 2022 State of the Art

中文标题&#xff1a;单目深度估计&#xff1a;回顾2022年最先进技术 本文对比了物种最近的基于深度学习的单目深度估计方法&#xff1a; GPLDepth(2022)[15]: Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepthAdabins(2021)[1]: Adabins:…

操作系统:文件系统的实现

一、文件系统结构 磁盘的逻辑单元为块&#xff0c;内存和磁盘之间的I/O传输以块为单位执行。 磁盘的特点 1可以原地重写&#xff0c;可以从磁盘上读一块儿&#xff0c;修改该块&#xff0c;并将它写回到原来的位置可以直接访问磁盘上的任意一块。因此&#xff0c;可以方便地…

浅析SCSI协议(2)命令模型

SCSI命令模型 SCSI协议对链路传输没有进行严格的限制&#xff0c;但约束了SCSI的命令模型。协议允许使用SAS、FC以及以太网等不同的链路实现&#xff0c;但对所有的SCSI传输层实现而言&#xff0c;都必须遵循统一的SCSI命令模型。SCSI命令模型约束了SCSI命令执行过程、命令请求…

《底层逻辑:看清这个世界的底牌》读后感

书名《底层逻辑&#xff1a;看清这个世界的底牌》作者刘润简介如果只教给你各行各业的“干货”&#xff08;方法论&#xff09;&#xff0c;那只是“授人以鱼”&#xff0c;一旦环境出现任何变化&#xff0c;“干货”就不再适用。但如果教给你的是底层逻辑&#xff0c;那就是“…

初入测试如何编写测试用例?从3个方面带你写一个合格的测试用例

前言 作为一个测试新人&#xff0c;刚开始接触测试&#xff0c;对于怎么写测试用例很头疼&#xff0c;无法接触需求&#xff0c;只能根据站在用户的角度去做测试&#xff0c;但是这样情况会导致不能全方位的测试APP&#xff0c;这种情况就需要一份测试用例了&#xff0c;但是不…

亿级高并发电商项目-- 实战篇 --万达商城项目 七(品牌模块、商品类型模块等开发)

专栏&#xff1a;高并发---分布式 在管理商品时&#xff0c;除了商品名、价格、商品介绍等基本参数外。还需 要给商品添加品牌、商品类型、商品规格等参数。比如Iphone13的 品牌是苹果。商品类型属于手机通讯>手机>手机。规格有机身颜色: 星光色、版本:128G。品牌、商品…

暗网与深网:5 个主要区别

在互联网上&#xff0c;深网不会被网络爬虫索引&#xff0c;而暗网是故意隐藏的。 文章目录前言一、暗网与深网二、什么是暗网&#xff1f;什么是深网&#xff1f;暗网和深网之间的 5 个主要区别1. 范围和操作暗网深网2. 尺寸暗网&#xff1a;深网&#xff1a;3. 访问暗网深网4…

数据的分组聚合

1&#xff1a;分组 t.groupby #coding:utf-8 import pandas as pd import numpy as np file_path./starbucks_store_worldwide.csv dfpd.read_csv(file_path) #print(df.head(1)) #print(df.info()) groupeddf.groupby(byCountry) print(grouped) #DataFrameGroupBy #可以遍历…

1.2配置OSPF包文分析和验证

1.2.2实验2:配置OSPF包文分析和验证 [1] 实验目的通过抓包分析OSPF的包文实现OSPF区域认证的配置实验拓扑实验拓扑图如图1-3所示。 图1-3 配置OSPF包文分析和验证 实验步骤 IP地址的配置、运行OSPF的步骤与实验1相同,此处略。[2] 在R1的g0/0/0抓包

Redis 集群搭建及集群管理工具

目录一、简介二、架构图三、搭建集群3.1、下载3.2、编译安装3.3、配置文件修改3.4、创建集群四、集群管理工具redis-cli4.1、查看集群信息4.2、检查集群4.3、修复槽错误4.4、重分片4.5、负载均衡4.6、添加节点4.7、删除节点4.8、设置超时4.9、导入数据4.10、重建集群一、简介 本…

【JavaWeb】网络编程概念 + Socket套接字 + UDP/TCP编程

目录 网络编程基础概念 发送端与接受端 请求与响应 客户端与服务器 常见的客户端服务器模型 Socket套接字 回显(echo)程序 UDP版的回显程序 服务器代码 客户端代码 结果 TCP版的回显程序 服务器代码 客户端代码 结果 网络编程基础概念 网络编程&#xff0c;指网…

2.5|物联网应用系统设计|复习提纲|提问背诵

基础概念总结掌握Linux常用的基本命令功能、语法结构&#xff0c;用法等。具体命令参考实验指导书、相关PPT等资料内容。什么是操作系统&#xff08;OS&#xff09;&#xff1f;操作系统是用以控制和管理计算机系统资源&#xff0c;方便用户使用的程序和数据结构的集合。在所有…

零基础学习Python的一点建议

Python语言的火爆程度&#xff0c;真的是超过了任何一门计算机语言&#xff0c;当然火爆程度里面含有赶上了人工智能这个领域的风口&#xff0c;但是大部分的原因是Python易学&#xff0c;语法对小白非常友好&#xff0c;总结一句话&#xff0c;Python语言能做很多事情&#xf…

亿级高并发电商项目-- 实战篇 --万达商城项目 六(编写角色管理、用户权限(Spring Security认证授权)、管理员管理等模块)

专栏&#xff1a;高并发---前后端分布式 &#x1f44f;作者简介&#xff1a;大家好&#xff0c;我是小童&#xff0c;Java开发工程师&#xff0c;CSDN博客博主&#xff0c;Java领域新星创作者 &#x1f4d5;系列专栏&#xff1a;前端、Java、Java中间件大全、微信小程序、微信…

使用nvm管理node

nvm介紹 node的版本管理器&#xff0c;可以方便地安装&切换不同版本的node 我们在工作中&#xff0c;可以会有老版本的node的项目需要维护&#xff0c;也可能有新版本的node的项目需要开发&#xff0c;如果只有一个node版本的话将会很麻烦&#xff0c;nvm可以解决我们的难点…

node 拉取github开源漏洞

我们可以通过github的open api 来拉取一些信息。这里主要是拉取 github 开源漏洞中的漏洞信息 Github Explorer github Explorer 是一个在线工具&#xff0c;登录之后&#xff0c;我们可以在左侧输入GraphQL 查询语句&#xff0c;之后就可以查询相关的信息。例如&#xff1a;…

B树和B+树,红黑树作为索引的区别

索引是一种数据结构&#xff0c;帮助我们在mysql表中更高效获取数据的数据结构 常用作为索引的数据结构&#xff1a;二叉树&#xff0c;红黑树&#xff0c;Hash表&#xff0c;B树&#xff0c;B树 下面的数据表中有两个字段&#xff0c;第一个字段是col1&#xff0c;第二个字段…

如何在Qt中设置背景图片,且不覆盖其它控件

正常情况&#xff0c;我们直接通过在样式表里设置背景图片会出现背景图片覆盖其它控件的情况&#xff0c;比如下面操作&#xff1a; 首先右击空白处&#xff0c;点击改变样式表。 然后选择background-image 然后点击铅笔图标 之后我们要先添加前缀&#xff0c;也就是我们…

使用 Three.js 后处理的粗略铅笔画效果

本文使用Three.js的后处理创建粗略的铅笔画效果。我们将完成创建自定义后处理渲染通道、在 WebGL中实现边缘检测、将法线缓冲区重新渲染到渲染目标以及使用生成和导入的纹理调整最终结果的步骤。翻译自Codrops&#xff0c;有改动。 Three.js 中的后处理 Three.js中的后处理是一…

1.9 实践项目——爬取学生信息

1. 项目简介设计一个 Web 服务器 server.py&#xff0c;它读取 students.txt 文件中的学生数据&#xff0c;以表格的形式呈现在网页上&#xff0c;其中 students.txt 的格式如下&#xff1a;No,Name,Gender,Age1001,张三,男,201002,李四,女,191003,王五,男,21设计一个客户端的爬…