云计算百科
云计算领域专业知识百科平台

Kylin Linux V10 替换安装源,并在服务器上启用 EPEL 仓库

查看系统版本:

cat /etc/os-release

NAME="Kylin Linux Advanced Server"
VERSION="V10 (Lance)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Lance)"
ANSI_COLOR="0;31"

uname -a

Linux lab 4.19.90-52.22.v2207.ky10.x86_64 #1 SMP Tue Mar 14 12:19:10 CST 2023 x86_64 x86_64 x86_64 GNU/Linux

uname -r
4.19.90-52.22.v2207.ky10.x86_64

  • 切换CentOS 8源为阿里源 备份原有的yum源文件,以便需要时恢复:
  • mv /etc/yum.repos.d/*.repo repo/
    sudo mv /etc/yum.repos.d/CentOS-* /tmp/

    Problem 1: cannot install the best candidate for the job

    • nothing provides libc.so.6(GLIBC_2.34)(64bit) needed by docker-ce-3:27.4.1-1.el10.x86_64

    yum install gcc
    yum install gcc-c++

    对于CentOS 7,使用以下命令:

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

    对于CentOS 8,使用以下命令:

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

    ###Kylin Linux Advanced Server 10 – os repo###

    [ks10-adv-os]
    name = Kylin Linux Advanced Server 10 – Os
    baseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/base/$basearch/
    gpgcheck = 1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
    enabled = 1

    [ks10-adv-updates]
    name = Kylin Linux Advanced Server 10 – Updates
    baseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/$basearch/
    gpgcheck = 1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
    enabled = 1

    [ks10-adv-addons]
    name = Kylin Linux Advanced Server 10 – Addons
    baseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/addons/$basearch/
    gpgcheck = 1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
    enabled = 0

    wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

    rpm -ivh epel-release-latest-8.noarch.rpm –nodeps –force

    yum clean all

  • 清除yum缓存并重建索引
  • yum clean all
    yum makecache

    下载并安装阿里云的CentOS 8源配置文件:

    sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

    生成缓存

    sudo yum makecache

    更新一下yum源:

    yum -y update

    如果出现这样(尝试添加 –skip-broken 来跳过无法安装的软件包 或 –nobest 来不只使用最佳选择的软件包)的报错,只需根据提示在命令结尾加上–allowerasing或–nobest后再次执行即可yum -y update –nobest 后续如果这样报错,都可以按照此方法 完成上述步骤后,就将yum镜像源更换为阿里云的了。

  • 关闭防火墙,SELINUX
  • systemctl stop firewalld.service
    systemctl disable firewalld.service
    setenforce 0
    sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

    关闭之后,查看状态

    systemctl status firewalld
    systemctl status selinux-autorelabel

    在 服务器上安装并启用 EPEL 仓库 登录或 SSH 到你的 RHEL 8.x 服务器,并执行以下 dnf 命令来安装 EPEL rpm 包,

    [root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y

    上面命令的输出将如下所示,

    dnf-install-epel-repo-rehl8

    EPEL rpm 包成功安装后,它将自动启用并配置其 yum/dnf 仓库。运行以下 dnf 或 yum 命令,以验证是否启用了 EPEL 仓库,

    [root@linuxtechi ~]# dnf repolist epel

    或者

    [root@linuxtechi ~]# dnf repolist epel -v

    epel-repolist-rhel8

    在 CentOS 8.x 服务器上安装并启用 EPEL 仓库 登录或 SSH 到你的 CentOS 8 服务器,并执行以下 dnf 或 yum 命令来安装 epel-release rpm 软件包。在 CentOS 8 服务器中,EPEL rpm 在其默认软件包仓库中。

    [root@linuxtechi ~]# dnf install epel-release -y

    或者

    [root@linuxtechi ~]# yum install epel-release -y

    执行以下命令来验证 CentOS 8 服务器上 EPEL 仓库的状态,

    [root@linuxtechi ~]# dnf repolist epel
    Last metadata expiration check: 0:00:03 ago on Sun 13 Oct 2019 04:18:05 AM BST.
    repo id repo name status
    *epel Extra Packages for Enterprise Linux 8 – x86_64 1,977
    [root@linuxtechi ~]#
    [root@linuxtechi ~]# dnf repolist epel -v
    ……………………
    Repo-id : epel
    Repo-name : Extra Packages for Enterprise Linux 8 – x86_64
    Repo-status : enabled
    Repo-revision: 1570844166
    Repo-updated : Sat 12 Oct 2019 02:36:32 AM BST
    Repo-pkgs : 1,977
    Repo-size : 2.1 G
    Repo-metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=stock&content=centos
    Updated : Sun 13 Oct 2019 04:28:24 AM BST
    Repo-baseurl : rsync://repos.del.extreme-ix.org/epel/8/Everything/x86_64/ (34 more)
    Repo-expire : 172,800 second(s) (last: Sun 13 Oct 2019 04:28:24 AM BST)
    Repo-filename: /etc/yum.repos.d/epel.repo
    Total packages: 1,977
    [root@linuxtechi ~]#

    以上命令的输出说明我们已经成功启用了 EPEL 仓库。让我们在 EPEL 仓库上执行一些基本操作。 列出 EPEL 仓库种所有可用包 如果要列出 EPEL 仓库中的所有的软件包,请运行以下 dnf 命令,

    [root@linuxtechi ~]# dnf repository-packages epel list
    ……………
    Last metadata expiration check: 0:38:18 ago on Sun 13 Oct 2019 04:28:24 AM BST.
    Installed Packages
    epel-release.noarch 8-6.el8 @epel
    Available Packages
    BackupPC.x86_64 4.3.1-2.el8 epel
    BackupPC-XS.x86_64 0.59-3.el8 epel
    CGSI-gSOAP.x86_64 1.3.11-7.el8 epel
    CGSI-gSOAP-devel.x86_64 1.3.11-7.el8 epel
    Field3D.x86_64 1.7.2-16.el8 epel
    Field3D-devel.x86_64 1.7.2-16.el8 epel
    GraphicsMagick.x86_64 1.3.33-1.el8 epel
    GraphicsMagick-c++.x86_64 1.3.33-1.el8 epel
    …………………………
    zabbix40-web-mysql.noarch 4.0.12-1.el8 epel
    zabbix40-web-pgsql.noarch 4.0.12-1.el8 epel
    zerofree.x86_64 1.1.1-3.el8 epel
    zimg.x86_64 2.8-4.el8 epel
    zimg-devel.x86_64 2.8-4.el8 epel
    zstd.x86_64 1.4.2-1.el8 epel
    zvbi.x86_64 0.2.35-9.el8 epel
    zvbi-devel.x86_64 0.2.35-9.el8 epel
    zvbi-fonts.noarch 0.2.35-9.el8 epel
    [root@linuxtechi ~]#

    从 EPEL 仓库中搜索软件包 假设我们要搜索 EPEL 仓库中的 Zabbix 包,请执行以下 dnf 命令, [root@linuxtechi ~]# dnf repository-packages epel list | grep -i zabbix 上面命令的输出类似下面这样,

    epel-repo-search-package-centos8

    从 EPEL 仓库安装软件包 假设我们要从 EPEL 仓库安装 htop 包,运行以下 dnf 命令, 语法:

    # dnf –enablerepo=”epel” install <包名>
    [root@linuxtechi ~]# dnf –enablerepo="epel" install htop -y

    注意:如果我们在上面的命令中未指定 –enablerepo=epel,那么它将在所有可用的软件包仓库中查找 htop 包。

    赞(0)
    未经允许不得转载:网硕互联帮助中心 » Kylin Linux V10 替换安装源,并在服务器上启用 EPEL 仓库
    分享到: 更多 (0)

    评论 抢沙发

    评论前必须登录!