openSUSE 官方软件包单独下载网址
https://software.opensuse.org
openSUSE 官方软件包单独下载网址
https://software.opensuse.org
# yum help
# yum help <option>
或者:
# yum <option> help
# yum install <software>
# yum -y install <software>
或者:
# yum install <software> -y
# yum remove <software>
# yum -y remove <software>
或者:
# yum remove <software> -y
# yum update <software>
# yum -y update <software>
或者:
# yum update <software> -y
# yum update
# yum -y update
或者:
# yum update -y
# yum update --best --allowerasing
# yum -y update --best --allowerasing
或者:
# yum update --best --allowerasing -y
# yum update --exclude=<software>
# yum -y update --exclude=<software>
或者:
# yum update --exclude=<software> -y
# yum ./yum.conf update
(补充:这里以使用 ./yum.conf 配置文件升级所有软件包为例)
# yum -y -c ./yum.conf update
(补充:这里以使用 ./yum.conf 配置文件升级所有软件包为例)
# yum check-update
# dnf needs-restarting --reboothint
# yum list <software>
或者:
# yum list all | grep <software>
# yum info <software>
# yum list <software> --showduplicate | sort -r
# yum module provides <software>
# yum module provides ipa-client
Updating Subscription Management repositories.
Last metadata expiration check: 1:38:12 ago on Fri 26 Jul 2024 08:00:39 AM CST.
ipa-client-4.7.1-11.module+el8+2842+7481110c.x86_64
Module : idm:DL1:820190227212412:5986f621:x86_64
Profiles : client common
Repo : rhel-8-for-x86_64-appstream-rpms
Summary : The Red Hat Enterprise Linux Identity Management system module
......
(补充:从这里的输出结果可以看出 ipa-client 软件包来自 idm 模块,版本是 DL1)
# yum list all
# yum groupinstall <group>
# yum -y groupinstall <group>
或者:
# yum groupinstall <group> -y
# yum groupremove <group>
# yum -y groupremove <group>
或者:
# yum groupremove <group> -y
# yum group list
# yum update --advisory=<errata>
# yum -y update --advisory=<errata>
或者:
# yum update --advisory=<errata> -y
# yum updateinfo <errata>
# yum update-minimal --security
# yum -y update-minimal --security
或者:
# yum update-minimal --security -y
# yum updateinfo list
# yum updateinfo info security
# yum update --cve <CVE>
# yum -y update --cve <CVE>
或者:
# yum update --cve <CVE> -y
# yum updateinfo list cves
# yum updateinfo info security
# yum update <security patch>
# yum -y update <security patch>
或者:
# yum update <security patch> -y
# yum update --security
# yum -y update --security
或者:
# yum update --security -y
# yum check-update --security
# yum repolist
# yum repolist
# yum clean all
# yum makecache
# yum module provides <software>
# yum module list
# yum module list | grep <software>
# yum module info <module>
# yum module info <module> | grep <submodule>
# dnf module info <module>:<stream>
# yum module reset <module>
# yum module enable <module>:<version>
# yum distro-sync
(注意:需要确保这条命令执行有以后没有报错)
# yum module provides podman
(补充:这里以显示 podman 软件包属于哪个软件模块为例)
# yum module list | grep podman
container-tools rhel8 [d] common [d] Most recent (rolling) versions of podman, buildah, skopeo, runc, conmon, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and updated as frequently as every 12 weeks.
container-tools 1.0 common [d] Stable versions of podman 1.0, buildah 1.5, skopeo 0.1, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and supported for 24 months.
container-tools 2.0 common [d] Stable versions of podman 1.6, buildah 1.11, skopeo 0.1, runc, conmon, etc as well as dependencies such as container-selinux built and tested together, and supported as documented on the Application Stream lifecycle page.
container-tools 3.0 common [d] Stable versions of podman 3.0, buildah 1.19, skopeo 1.2, runc, conmon, etc as well as dependencies such as container-selinux built and tested together, and supported as documented on the Application Stream lifecycle page.
container-tools 4.0 common [d] Stable versions of podman 4.0, buildah 1.24, skopeo 1.6, runc, conmon, etc as well as dependencies such as container-selinux built and tested together, and supported as documented on the Application Stream lifecycle page.
(补充:这里以显示所有和 podman 软件相关的软件模块为例)
# yum module reset container-tools
(补充:这里以重置 container-tools 软件模块为例)
# yum module enable container-tools:3.0
(补充:这里以设置 container-tools 软件模块版本号为 3.0 为例)
或者:
# yum module enable container-tools:rhel8
(
补充:
1) 这里以设置最新的 container-tools 软件模块版本号为例
2) 当站主在测试这条命令时,最新的 container-tools 软件模块版本号刚好是 3.0
)
(注意:有些时候只能设置成最新的软件模块版本号后才能升级到最新的软件)
# yum list all | egrep ^podman\.x
podman.x86_64 3.0.1-9.module+el8.6.0+14874+64436299 rhel-8-for-x86_64-appstream-rpms
(补充:可以看到此时 podman 软件的可用版本是 3.0.1-9)
# yum module reset container-tools
(补充:这里以重置 container-tools 软件模块为例)
# yum list all | egrep ^podman\.x
podman.x86_64 2:4.0.2-6.module+el8.6.0+14877+f643d2d6 rhel-8-for-x86_64-appstream-rpms
(补充:可以看到此时 podman 软件的可用版本是 2:4.0.2-6)
# yum history
# yum history info
# yum history info <software>
# yum history info httpd
(补充:这里以查看 httpd 软件的安装记录为例)
# yum history
# yum history undo <ID>
(补充:上面第 1 条命令会实现操作的 ID 号,在第 2 条命令中写入那个 ID 号就可以取消那次操作)
# vim /etc/sudoers
或者:
# visudo
添加以下内容:
……
zhumingyu ALL=(ALL) /usr/bin/mysql
(补充:这里以给用户 zhumingyu 添加 /usr/bin/mysql 命令为例)
# vim /etc/sudoers
在
......
env_reset
......
这一行下面添加:
......
Defaults env_keep += "http_proxy https_proxy"
......
(补充:这里以允许用户在进行 sudo 提权的同时也能使用 http_proxy、https_proxy 为例)
# iftop
(补充:此时会不停地显示系统联通状态,按下 “q” 键后退出)
# iftop
interface: eth0
IP address is: 10.10.10.129
IPv6 address is: fdb2:2c26:f4e4:0:5940:b748:da58:4f3
MAC address is: 00:1c:42:c9:3c:81
# value=
# newvalue=${value:-eternalcenter}
# echo $newvalue
eternalcenter
# value=mingyuzhu
# newvalue=${value:-eternalcenter}
# echo $newvalue
mingyuzhu
或者:
# value=
# newvalue=${value:=eternalcenter}
# echo $newvalue
eternalcenter
# value=mingyuzhu
# newvalue=${value:=eternalcenter}
# echo $newvalue
mingyuzhu
(补充:这里以当变量 value 存在且为空时则变量 newvalue 的值为 eternalcenter 为例)
# value=
# newvalue=${value:+eternalcenter}
# echo $newvalue
# value=mingyuzhu
# newvalue=${value:+eternalcenter}
# echo $newvalue
eternalcenter
(补充:这里以当变量 value 存在且不为空时则变量 newvalue 的值为 eternalcenter 为例)
# str=eternalcenter.com
# echo ${str::2}
et
或者:
# str=eternalcenter.com
# echo ${str:0:2}
et
或者:
# str=eternalcenter.com
# echo ${str:offset:2}
et
(补充:这里以截取字符串中从左数第 2 个字符和左边的所有内容为例)
# str=eternalcenter.com
echo ${str::0-2}
eternalcenter.c
(补充:这里以截取字符串中从右数第 2 个字符开始左边的所有内容为例)
# str=eternalcenter.com
# echo ${str:0-2}
om
(补充: 截取字符串中从除右数第 2 个字符开始到右边的所有内容)
# str=eternalcenter.com
# echo ${str:5:4}
alce
(补充:这里以截取字符串中从左数第 5 个字符开始 4 个字符的内容为例)
(注意:在此情况下是从第 0 字符开始数第 1 个字符的,而不是从第 1 个字符开始数第 1 个字符)
# str=eternalcenter.com
# echo ${str:0-5:4}
r.co
(补充:这里以截取字符串中从右数第 5 个字符开始右边 4 个字符的内容为例)
(注意:在此情况下是从第 0 字符开始数第 1 个字符的,而不是从第 1 个字符开始数第 1 个字符)
# str=eternalcenter.com
# echo ${str:1:-4}
ternalcenter
(补充:这里以截取字符串中从左数第 1 个字符到右数第 4 个字符中的所有内容为例)
(注意:在此情况下是从第 0 字符开始数第 1 个字符的,而不是从第 1 个字符开始数第 1 个字符)
# str=eternalcenter.com
# echo ${str:0-5:0-1}
r.co
或者:
# str=eternalcenter.com
# echo ${str:0-5:-1}
r.co
(补充:这里以截取字符串中从右数第 1 个字符到从右数第 4 个字符中的所有内容为例)
(注意:在此情况下是从第 0 字符开始数第 1 个字符的,而不是从第 1 个字符开始数第 1 个字符)
# str=eternalcenter.com
# echo ${str:2}
ernalcenter.com
(补充:截取字符串中从除左数第 2 个字符开始到右边的所有内容)
# value=ming:yu:zhu
# newvalue=${value%:*}
# echo $newvalue
ming:yu
(补充:这里以截取变量 value 右数第 1 个冒号 “:” 左边的所有值并赋予给变量 newvalue 为例)
# value=ming:yu:zhu
# newvalue=${value%%:*}
# echo $newvalue
ming
(补充:这里以截取变量 value 右数最后 1 个冒号 “:” 左边的所有并赋予给变量 newvalue 内容为例)
# value=mingyuzhu
# novalue=zhu
# newvalue=${value%%$novalue}
# echo $newvalue
mingyu
(补充:这里以截取变量 value 右数最后 1 个 zhu 左边的所有内容并赋予给变量 newvalue 为例)
# value=ming:yu:zhu
# newvalue=${value#*:}
# echo $newvalue
yu:zhu
(补充:这里以截取变量 value 左数第 1 个冒号 “:” 右边的所有内容并赋予给变量 newvalue 为例)
# value=ming:yu:zhu
# newvalue=${value##*:}
# echo $newvalue
zhu
(补充:这里以截取变量 value 左数最后 1 个冒号 “:” 右边的所有内容并赋予给变量 newvalue 为例)
# value=mingyuzhu
# novalue=ming
# newvalue=${value##$novalue}
# echo $newvalue
yuzhu
(补充:这里以截取变量 value 左数最后 1 个 ming 右边的所有内容并赋予给变量 newvalue 为例)
# value=mingyuzhu
# noneedvalue=yu
# needvalue=zhu
# newvalue=${value/$noneedvalue/$needvalue}
# echo $newvalue
mingzhuzhu
(补充:这里以将变量 value 中的 yu 替换成 zhu 并赋予给变量 newvalue 为例)