Sed

如何在 RHEL 8 上升級 sed?

  • May 5, 2022

我在 RHEL 8 系統上,預設sed安裝了 4.5。

[root@192 ~]# rpm -qf `which sed`
sed-4.5-2.el8.x86_64
[root@192 ~]#

由於我想使用該--debug選項來調試一些sed命令,所以我必須升級sed. 當我嘗試解除安裝sed時,我發現很多其他包都依賴它:

[root@192 ~]# rpm -e sed
error: Failed dependencies:
   /bin/sed is needed by (installed) os-prober-1.74-6.el8.x86_64
   sed is needed by (installed) krb5-libs-1.18.2-5.el8.x86_64
   sed is needed by (installed) ca-certificates-2020.2.41-80.0.el8_2.noarch
   sed is needed by (installed) dracut-049-95.git20200804.el8.x86_64
   sed is needed by (installed) policycoreutils-2.9-9.el8.x86_64
   sed is needed by (installed) sane-backends-1.0.27-19.el8_2.1.x86_64
   sed is needed by (installed) authselect-libs-1.2.1-2.el8.x86_64
   sed is needed by (installed) open-vm-tools-11.1.0-2.el8.x86_64
   sed is needed by (installed) dhcp-client-12:4.3.6-41.el8.x86_64
   sed is needed by (installed) cups-filters-1.20.0-20.el8.x86_64
   sed is needed by (installed) nfs-utils-1:2.3.3-35.el8.x86_64
   sed is needed by (installed) authselect-compat-1.2.1-2.el8.x86_64
   sed is needed by (installed) autofs-1:5.1.4-43.el8.x86_64
   /usr/bin/sed is needed by (installed) groff-base-1.22.3-18.el8.x86_64
[root@192 ~]#

在這種情況下,升級的正確方法是sed什麼?我也試過直接安裝新版本:

[root@192 ~]# rpm -ivh https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/35/Everything/aarch64/os/Packages/s/sed-4.8-8.fc35.aarch64.rpm
Retrieving https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/35/Everything/aarch64/os/Packages/s/sed-4.8-8.fc35.aarch64.rpm
warning: /var/tmp/rpm-tmp.VumGnB: Header V4 RSA/SHA256 Signature, key ID 9867c58f: NOKEY
error: Failed dependencies:
   glibc >= 2.33.9000-43.fc35 is needed by sed-4.8-8.fc35.aarch64
   ld-linux-aarch64.so.1()(64bit) is needed by sed-4.8-8.fc35.aarch64
   ld-linux-aarch64.so.1(GLIBC_2.17)(64bit) is needed by sed-4.8-8.fc35.aarch64
   libc.so.6(GLIBC_2.33)(64bit) is needed by sed-4.8-8.fc35.aarch64
   libc.so.6(GLIBC_2.34)(64bit) is needed by sed-4.8-8.fc35.aarch64
   libselinux.so.1(LIBSELINUX_1.0)(64bit) is needed by sed-4.8-8.fc35.aarch64
[root@192 ~]#

但是,如您所見,它也有一些失敗的依賴項。我應該安裝這些缺少的依賴項並嘗試再次安裝嗎?

更新

正如 jsbillings 在評論中指出的那樣,我使用了錯誤的包架構。下面是安裝 x86_64 包的輸出。

[root@192 ~]# rpm -ivh https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/35/Everything/x86_64/os/Packages/s/sed-4.8-8.fc35.x86_64.rpm
Retrieving https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/35/Everything/x86_64/os/Packages/s/sed-4.8-8.fc35.x86_64.rpm
warning: /var/tmp/rpm-tmp.FT7OI2: Header V4 RSA/SHA256 Signature, key ID 9867c58f: NOKEY
error: Failed dependencies:
   glibc >= 2.33.9000-43.fc35 is needed by sed-4.8-8.fc35.x86_64
   libc.so.6(GLIBC_2.33)(64bit) is needed by sed-4.8-8.fc35.x86_64
   libc.so.6(GLIBC_2.34)(64bit) is needed by sed-4.8-8.fc35.x86_64
   libselinux.so.1(LIBSELINUX_1.0)(64bit) is needed by sed-4.8-8.fc35.x86_64
[root@192 ~]# 

您不能在 RHEL 上安裝 Fedora 軟體包。

與其嘗試升級你的sed,因為你只想要一個更新版本的調試功能,我建議執行一個容器:

sudo yum install podman
podman run -it --rm fedora:35

這將為您提供一個帶有最新版本的 Fedora 容器sed

引用自:https://unix.stackexchange.com/questions/701568