[步骤] Linux 第三方库的添加

步骤一:添加第三方库

# vi /etc/ld.so.conf

或者:

# vi /etc/ld.so.conf.d/*.conf

添加以下内容:

......
/root/lib

(补充:这里以添加位于目录 /root/lib 的库为例)

(注意:这里的 /etc/ld.so.conf.d/*.conf 是指 /etc/ld.so.conf.d/ 目录下任意以 .conf 结尾的文件,例如 /etc/ld.so.conf.d/one.conf)

步骤二:创建新的 initramfs 文件为例

2.1 备份已有的 initramfs 文件

# cp /boot/initramfs-4.18.0-553.89.1.el8_10.x86_64.img  /boot/initramfs-4.18.0-553.89.1.el8_10.x86_64.img.backup


补充:
1) 这里以将:/boot/initramfs-4.18.0-553.89.1.el8_10.x86_64.img 备份为:/boot/initramfs-4.18.0-553.89.1.el8_10.x86_64.img.backup 为例
2) initramfs 是压缩的 cpis 文件,是临时的根文件系统包含一些脚本、程序和配置文件,在 Linux 启动过程中被加载在内存里,负责 Linux 操作系统在挂载根目录前加载内核模块、检查硬件、加载驱动以及挂载真正的根文件系统等)

2.2 创建新的 initramfs 文件

# dracut -f /boot/initramfs-(uname -r).img $(uname -r)

(补充:这里以将正在运行的内核版本生成一个新的 initramfs 为例)

(注意:此时原来启动系统时使用的那个 initramfs 文件会被覆盖)

步骤三:重启系统

# reboot

步骤四:确认第三方库已经添加

4.1 确认在现在的缓存中包含了第三方库

# ldconfig -p -M -X | grep out


补充:
1) 这里的 -N 和 -X 必须一起使用,作用是不更新相关链接和不重建相关缓存
2) 这里的 -p 作用是打印现在在缓存中的相关目录和相关候选库
3) 这条命令会显示目前在缓存中的第三方库

4.2 确认加载的库中没有重复的

# for l in $(ldconfig -p -N -X | awk '{ print $1 }') ; do matches=$(ldconfig -p -N -X | awk "\$1 == \"$l\" { print }"); if [ $(echo "$matches" | wc -l) -ge 2 ]; then echo "$matches"; echo; fi; done |wc -l

(补充:如果加载的库中没有重复的则这里不会有任何输出结果)

[排错] 解决 openSUSE & SLES 使用 zypper migration 命令时报错 “are not activated on the system”

报错命令

# zypper migration

报错代码

'The requested products 'SAP Applications Module 15 SP6 x86_64' are not activated on the system.' (422)

'/usr/lib/zypper/commands/zypper-migration' exited with status 1

(补充:从这里输出可以看出,本次缺失的软件库是 SAP Applications Module 15 SP6 x86_64)

解决方法

解决方法一:添加缺失的软件库 (必须要有相关软件库的订阅才能使用此解决方法)

1.1 显示所有的软件库

# SUSEConnect --list-extensions

或者:

# SUSEConnect -l

(补充:如果此时有相关的软件库订阅的话,此命令就会显示添加相关软件库的方法)

1.2 添加相应的软件库

按照上一步显示的方法,添加相应的软件库

解决方法二:删除缺失的软件库

# zypper remove -y sle-module-sap-applications-release

(补充:这里以删除 sle-module-sap-applications-release 软件库为例)

[步骤] SSL 证书公钥从 cer 格式到 pfx 格式的转换

正文:

步骤一:将 SSL 证书公钥从 cer 格式转换到 pem 格式

# openssl x509 -in <public certificate>.cer -inform der -outform pem -out <public certificate>.pem

步骤二:将 SSL 证书公钥和私钥从 pem 格式转换成 pfx

# openssl pkcs12 -export -in <public certificate>.pem -inkey <private certificate>.key -out <certificate>.pfx

参考文献:

https://access.redhat.com/solutions/7005234

[步骤] 系统升级 (从 openSUSE Leap 15.6 升级到 openSUSE Leap 16.0)

正文:

步骤一:显示现在的系统版本

# cat /etc/*release*
NAME="openSUSE Leap"
VERSION="15.6"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.6"
PRETTY_NAME="openSUSE Leap 15.6"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.6"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap"
LOGO="distributor-logo-Leap"

(注意:确保显示的系统版本是 openSUSE Leap 15.6)

步骤二:准备升级

2.1 确认已使用的软件库

# zypper ls -d
# | Alias       | Name        | Enabled | GPG Check | Refresh | Priority | Type   | URI
--+-------------+-------------+---------+-----------+---------+----------+--------+-------------------------------------------------------------------------
1 | Debug-OSS   | Debug-OSS   | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/debug/distribution/leap/15.6/repo/oss/
2 | Non-OSS     | Non-OSS     | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.6/repo/non-oss/
3 | OSS         | OSS         | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.6/repo/oss/
4 | Src-Non-OSS | Src-Non-OSS | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/source/distribution/leap/15.6/repo/non-oss/
5 | Src-OSS     | Src-OSS     | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/source/distribution/leap/15.6/repo/oss/


补充:
1) 确保以上软件库已处于 Enabled 状态
2) 手动启动这些软件库的命令如下

# zypper ar -f http://download.opensuse.org/distribution/leap/\$releasever/repo/oss/ OSS
# zypper ar -f http://download.opensuse.org/distribution/leap/\$releasever/repo/non-oss/ Non-OSS
# zypper ar -f http://download.opensuse.org/source/distribution/leap/\$releasever/repo/oss/ Src-OSS
# zypper ar -f http://download.opensuse.org/source/distribution/leap/\$releasever/repo/non-oss/ Src-Non-OSS
# zypper ar -f http://download.opensuse.org/debug/distribution/leap/\$releasever/repo/oss/ Debug-OSS

2.2 刷新已使用的软件库

# zypper ref

(注意:确保刷新成功,否则请检查网络)

2.3 将所有 openSUSE Leap 15.6 软件包更新到最新版本

# zypper -n update

2.4 用 releasever 变量替换所有版本号

# sed -i 's/15.6/${releasever}/g' /etc/zypp/repos.d/*.repo

步骤三:升级系统

3.1 升级系统

# sudo zypper --releasever 16.0 dup

3.2 重启系统

# reboot

参考文献:

https://en.opensuse.org/SDB:System_upgrade
https://github.com/openSUSE/openSUSE-repos/blob/main/opensuse-leap16-repoindex.xml