CentOS yum & dnf

List packages
yum list | grep llvm
yum list | grep clang
dnf list | grep clang
dnf install clang-devel
查看 ubuntu 相关安装库版本
# ./llvm-split --version
LLVM (http://llvm.org/):
  LLVM version 12.0.0

  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: cascadelake


# clang-12  --version
Ubuntu clang version 12.0.0-3ubuntu1~20.04.5
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

TroubleShoot

如果出现这个error!

Unable to detect release version (use '--releasever' to specify release version)

解决方案

dnf install  --releasever=8 centos-stream-release

yum

$ yum search dnf
Loaded plugins: auto-update-debuginfo, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * tlinux-sclo-rh: mirrors.tencent.com
 * tlinux-sclo-sclo: mirrors.tencent.com
 * updates: mirrors.aliyun.com
================================== N/S matched: dnf ===================================
dnf-data.noarch : Common data and configuration files for DNF
dnf-langpacks.noarch : Langpacks plugin for dnf
dnf-langpacks-conf.noarch : Configuration file for DNF Langpacks plugin
dnf-plugin-subscription-manager.i686 : Subscription Manager plugins for DNF
dnf-plugin-subscription-manager.x86_64 : Subscription Manager plugins for DNF
dnf-plugins-core.noarch : Core Plugins for DNF
etckeeper-dnf.noarch : DNF plugin for etckeeper support
libdnf-devel.x86_64 : Development files for libdnf
libdnf-devel.i686 : Development files for libdnf
python-dnf-langpacks.noarch : Langpacks plugin for dnf-2
查找 对应的库源
# yum provides devtoolset-9
Trying other mirror.
devtoolset-9-9.0-3.el7.x86_64 : Package that installs devtoolset-9
Repo        : centos-sclo-rh



devtoolset-9-9.1-0.el7.x86_64 : Package that installs devtoolset-9
Repo        : centos-sclo-rh



devtoolset-9-9.1-0.el7.x86_64 : Package that installs devtoolset-9
Repo        : @centos-sclo-rh


# rpm -q devtoolset-9
devtoolset-9-9.1-0.el7.x86_64

增加 repo

如果 yum search 某个 库,搜索不到,而在其他的centos 环境中,可以search 到。那可以使用增加 repo 的 方式,进行安装

yum-config-manager --add-repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all & yum makecache

会在 /etc/yum.repos.d/ 生成 Centos-7.repo

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

如果 里面 的 $releasever,不能直接被系统变量替换, 那可以直接手动替换成 7

$ cat Centos-7.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-7 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
        http://mirrors.aliyuncs.com/centos/7/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

FQA

Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64
Could not resolve hots: mirrorlist.centos.org

该错误是以下问题导致
在这里插入图片描述

解决如下

cd /etc/yum.repos.d/
mv CentOS-SCLo-scl.repo CentOS-SCLo-scl.repo.bak
mv CentOS-SCLo-scl-rh.repo CentOS-SCLo-scl-rh.repo.bak

vim CentOS-SCLo-rh.repo
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

yum clean all
yum makecache

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值