Linux 軟件包管理

Linux 軟件包管理

分析 RPM 包

Linux 發行版本
  • 以 RHEL 為代表的發行版本,使用rpm包管理系統:

    • RHEL (Red Hat Enterprise Linux)
    • Fedora(由原來的RedHat桌面版本發展而來,免費版本)
    • CentOS(RHEL的社區克隆版本,免費)
    • Rocky(RHEL的社區克隆版本,免費)
    • OEL(Oralce Enterprise Linux)
  • 以 Debian 為代表的發行版本,使用deb包管理系統:

    • Debian,社區Linux的典范,迄今為止最遵循GNU規范的Linux系統。

    • Ubuntu,Debian衍生版,是一個以桌面應用為主的Linux操作系統。

    • Kali Linux,Debian衍生版,旨在滲透測試和數字取證。

  • 其他版本:ArchLinux Gentoo 等等…

RPM 包文件名格式

redhat 開發了 rpm 包管理,提供一個標準的軟件版本管理方法,比從歸檔包解壓文件到系統簡單多了。CentOS 提供的所有軟件都是rpm格式。

RPM軟件包文件名格式:name-version-release.architecture.rpm

示例:lrzsz-0.12.20-36.el7.x86_64.rpm

  • name,是描述其內容的一個或多個詞語(lrzsz)。
  • version,是原始軟件的版本號(0.12.20)。
  • release,是基于該版本的發行版號,由軟件打包商設置,后者不一定是原始軟件開發商(36.el7)。
  • architecture,是編譯的軟件包運行的處理器架構。
    • noarch,表示此軟件包不限定架構。
    • x86_64,表示此軟件包限定x86 64位。
    • aarch64,表示此軟件包限定ARM 64位。
RPM 包組成

每個rpm包涵三個部分:

  • 需要安裝的文件。
  • 包的元數據信息,包括包的名稱、版本、架構等;軟件包說明;軟件包依賴關系;許可證;更變日志;其他信息。
  • 腳本:軟件包安裝,更新,卸載需要執行的腳本。

通常,軟件提供商使用GPG密鑰對RPM軟件包進行數字簽名(Red Hat會對其發布的所有軟件包進行數字簽名)。 RPM系統通過確認包由相應的GPG密鑰簽名來驗證包的完整性。 如果GPG簽名不匹配,RPM系統拒絕安裝包。

復習:非對稱加密

非對稱加密:有一對公鑰和私鑰。

  • 公鑰:分享給別人,用來加密數據。
  • 私鑰:自己保留,用來解密公鑰加密的數據。

Linux中rpm包會被私鑰簽名,客戶端使用公鑰驗證簽名,確保文件的完整性。

RPM 包安裝和更新
  • 如果同一個軟件有多個版本,只需安裝最高版本。
  • 在大多數情況下,一個軟件只能安裝一個版本。 kernel是個例外。如果構建包的文件名沒有沖突,則可以安裝多個版本。 由于只能通過引導到該內核來測試新內核,因此特定設計了包,以便可以一次安裝多個版本。如果內核無法啟動,則舊內核仍然可用且可引導。
  • 軟件包升級只需要安裝最新版本,不需要逐步升級。
  • 升級RPM包將刪除舊版本的軟件包并安裝新版本,通常會保留配置文件。
[root@server ~ 11:33:08]# yum install vsftpd --downloadonly
[root@server ~ 13:42:44]# find / -name vsftpd-3.0.2-29.el7_9.x86_64.rpm    
find: ‘/run/user/1000/gvfs’: 權限不夠
/var/cache/yum/x86_64/7/updates/packages/vsftpd-3.0.2-29.el7_9.x86_64.rpm[root@server ~ 13:43:13]# cp /var/cache/yum/x86_64/7/updates/packages/vsftpd-3.0.2-29.el7_9.x86_64.rpm .
rpm 命令
查詢(重點)

幾種模式

rpm -q 查詢rpm -q -a
rpm -v 驗證
rpm -i 安裝
rpm -e 卸載
rpm -u 升級
#查詢系統中安裝了哪些軟件包
[root@server ~ 13:44:32]# rpm -qa
libqmi-utils-1.18.0-2.el7.x86_64
libmpcdec-1.2.6-12.el7.x86_64
gtkmm30-3.22.2-1.el7.x86_64
nss-sysinit-3.67.0-4.el7_9.x86_64
#查詢系統中某個軟件包是否安裝
[root@server ~ 14:02:06]# rpm -q httpd
httpd-2.4.6-99.el7.centos.1.x86_64
[root@server ~ 14:02:48]# rpm -q coreutils
coreutils-8.22-24.el7_9.2.x86_64#查詢系統中某個已安裝的軟件包元數據信息
[root@server ~ 14:03:12]# rpm -q httpd -i
Name        : httpd
Version     : 2.4.6
Release     : 99.el7.centos.1
Architecture: x86_64
Install Date: 2025年07月28日 星期一 14時14分27秒
Group       : System Environment/Daemons
Size        : 9829328
License     : ASL 2.0
Signature   : RSA/SHA256, 2023年05月30日 星期二 23時15分45秒, Key ID 24c6a8a7f4a80eb5
Source RPM  : httpd-2.4.6-99.el7.centos.1.src.rpm
Build Date  : 2023年05月30日 星期二 22時02分56秒
Build Host  : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://httpd.apache.org/
Summary     : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.#查詢系統中某個已安裝的軟件包包涵那些文件
[root@server ~ 14:03:52]# rpm -q openssh-server -l
/etc/pam.d/sshd
/etc/ssh/sshd_config
/etc/sysconfig/sshd
/usr/lib/systemd/system/sshd-keygen.service
/usr/lib/systemd/system/sshd.service
/usr/lib/systemd/system/sshd.socket
/usr/lib/systemd/system/sshd@.service
/usr/lib64/fipscheck/sshd.hmac
/usr/libexec/openssh/sftp-server
/usr/sbin/sshd
/usr/sbin/sshd-keygen
/usr/share/man/man5/moduli.5.gz
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sftp-server.8.gz
/usr/share/man/man8/sshd.8.gz
/var/empty/sshd# 查詢系統中某個已安裝的軟件包包涵哪些配置文件
[root@server ~ 14:04:35]# rpm -q openssh-server -c
/etc/pam.d/sshd
/etc/ssh/sshd_config
/etc/sysconfig/sshd# 查詢系統中某個已安裝的軟件包包涵哪些文檔文件
[root@server ~ 14:05:29]# rpm -q openssh-server -d
/usr/share/man/man5/moduli.5.gz
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sftp-server.8.gz
/usr/share/man/man8/sshd.8.gz# 查詢系統中某個某個文件屬于哪個已安裝的軟件包
[root@centos7 ~14:05:30]# rpm -q -f /etc/ssh/sshd_config 
openssh-server-7.4p1-22.el7_9.x86_64# 查詢系統中某個已安裝的軟件包包涵的腳本
[root@server ~ 14:05:35]# rpm -q openssh-server --scripts 
preinstall scriptlet (using /bin/sh):
getent group sshd >/dev/null || groupadd -g 74 -r sshd || :
getent passwd sshd >/dev/null || \useradd -c "Privilege-separated SSH" -u 74 -g sshd \-s /sbin/nologin -r -d /var/empty/sshd sshd 2> /dev/null || :
postinstall scriptlet (using /bin/sh):# 查詢系統中某個已安裝的軟件包變更日志
[root@server ~ 14:06:19]# rpm -q openssh-server --changelog 
* 四 930 2021 Dmitry Belyavskiy <dbelyavs@redhat.com> - 7.4p1-22 + 0.10.3-2
- avoid segfault in Kerberos cache cleanup (#1999263)
- fix CVE-2021-41617 (#2008884)* 二 625 2019 Jakub Jelen <jjelen@redhat.com> - 7.4p1-21 + 0.10.3-2
- Avoid double comma in the default cipher list in FIPS mode (#1722446)# 下載 httpd 軟件包,以及依賴的其他軟件包
[root@server ~ 14:16:33]# yum install httpd --downloadonly --downloaddir=rpms[root@server ~ 14:16:53]# ls -1 rpms
httpd-2.4.6-99.el7.centos.1.x86_64.rpm# 下載 httpd 軟件包,以及依賴的其他軟件包
[root@server ~ 14:17:05]# rpm -q -p rpms/httpd-2.4.6-99.el7.centos.1.x86_64.rpm -c
/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/userdir.conf
/etc/httpd/conf.d/welcome.conf
# 查詢系統中某個軟件包組中包涵哪些軟件包
[root@server ~ 14:17:39]# rpm -qg 'System Environment/Base'
grub2-common-2.02-0.87.0.1.el7.centos.9.noarch
centos-release-7-9.2009.1.el7.centos.x86_64
setup-2.8.71-11.el7.noarch

實例:

# 查看openssh-server軟件安裝是否有問題
[root@server ~ 14:31:13]# rpm -V openssh-server 
S.5....T.  c /etc/ssh/sshd_config
[root@server ~ 14:31:31]# sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
[root@server ~ 14:31:50]# rpm -V openssh-server 
S.5....T.  c /etc/ssh/sshd_config
[root@server ~ 14:31:54]# sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
# 移走 /etc/ssh/sshd_config 文件,再次查看
[root@server ~ 14:32:17]# mv /etc/ssh/sshd_config .
[root@server ~ 14:32:44]# rpm -V openssh-server 
遺漏   c /etc/ssh/sshd_config
提取 RPM 包中文件
Windows 提取

使用壓縮工具(例如360壓縮)打開rpm包,瀏覽和提取。

Linux 提取
[root@server ~ 14:33:33]# rm -f /etc/ssh/sshd_config
[root@server ~ 14:49:48]# repoquery --location openssh-server
http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/openssh-server-7.4p1-23.el7_9.x86_64.rpm
[root@server ~ 14:50:53]# wget http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/openssh-server-7.4p1-23.el7_9.x86_64.rpm[root@server ~ 14:51:09]# file openssh-server-7.4p1-23.el7_9.x86_64.rpm 
openssh-server-7.4p1-23.el7_9.x86_64.rpm: RPM v3.0 bin i386/x86_64 openssh-server-7.4p1-23.el7_9# 將文件轉換為cpio格式
[root@server ~ 14:51:36]# rpm2cpio openssh-server-7.4p1-23.el7_9.x86_64.rpm >openssh-server-7.4p1-23.el7_9.x86_64.cpio
[root@server ~ 14:52:25]# file openssh-server-7.4p1-23.el7_9.x86_64.
openssh-server-7.4p1-23.el7_9.x86_64.cpio
openssh-server-7.4p1-23.el7_9.x86_64.rpm
[root@server ~ 14:52:25]# file openssh-server-7.4p1-23.el7_9.x86_64.cpio 
openssh-server-7.4p1-23.el7_9.x86_64.cpio: ASCII cpio archive (SVR4 with no CRC)
# 查詢 cpio 格式(一種打包格式)文件中有哪些文件
[root@server ~ 14:52:48]# cpio -t < openssh-server-7.4p1-23.el7_9.x86_64.cpio
./etc/pam.d/sshd
./etc/ssh/sshd_config
./etc/sysconfig/sshd
./usr/lib/systemd/system/sshd-keygen.service
./usr/lib/systemd/system/sshd.service
./usr/lib/systemd/system/sshd.socket# 配置管道查詢特定文件
[root@server ~ 14:53:35]# cpio -t < openssh-server-7.4p1-23.el7_9.x86_64.cpio | grep etc
1946 塊
./etc/pam.d/sshd
./etc/ssh/sshd_config
./etc/sysconfig/sshd#-d 
[root@server ~ 14:53:50]# cpio -id ./etc/ssh/sshd_config < openssh-server-7.4p1-23.el7_9.x86_64.cpio
1946[root@server ~ 14:54:40]# mv etc/ssh/sshd_config /etc/ssh/
[root@server ~ 14:55:04]# systemctl res
rescue        reset-failed  restart       
[root@server ~ 14:55:04]# systemctl restart sshd

方法二:一步提取所有文件

[root@centos7 ~]# rpm2cpio httpd-2.4.6-99.el7.centos.1.x86_64.rpm | cpio -id '*'

使用 yum 管理軟件包

yum 介紹
  • rpm 命令是一個管理軟件包的工具,不適用于軟件包存儲庫或自動解決來自多個源的依賴項。
  • Yum(Yellowdog Updater Modified)旨在成為管理基于RPM的軟件安裝和更新的更好系統。yum命令允許安裝,更新,刪除和獲取有關軟件包及其依賴項的信息。
yum 命令
# 查看倉庫中httpd包信息
[root@server ~ 14:55:19]# yum info httpd
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
可安裝的軟件包
名稱    :httpd
架構    :x86_64
版本    :2.4.6
發布    :99.el7.centos.1
大小    :2.7 M
源    :updates/7/x86_64
簡介    : Apache HTTP Server
網址    :http://httpd.apache.org/
協議    : ASL 2.0
描述    : The Apache HTTP Server is a powerful, efficient,: and extensible web server.# 查看倉庫中http開頭的包有哪些
[root@server ~ 15:37:43]# yum list 'http*'
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
已安裝的軟件包
httpd-tools.x86_64              2.4.6-99.el7.centos.1 @updates
可安裝的軟件包
http-parser.i686                2.7.1-9.el7           base    
http-parser.x86_64              2.7.1-9.el7           base    
http-parser-devel.i686          2.7.1-9.el7           base    # 查看倉庫中httpd包有哪些版本
[root@server ~ 15:38:29]# yum list httpd --showduplicates
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
可安裝的軟件包
httpd.x86_64           2.4.6-95.el7.centos             base   
httpd.x86_64           2.4.6-97.el7.centos             updates
httpd.x86_64           2.4.6-97.el7.centos.1           updates
httpd.x86_64           2.4.6-97.el7.centos.2           updates
httpd.x86_64           2.4.6-97.el7.centos.4           updates
httpd.x86_64           2.4.6-97.el7.centos.5           updates
httpd.x86_64           2.4.6-98.el7.centos.6           updates
httpd.x86_64           2.4.6-98.el7.centos.7           updates
httpd.x86_64           2.4.6-99.el7.centos.1           updates# 查看簡介包含關鍵字的軟件包
[root@server ~ 15:39:31]# yum search 'web server'
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com# 查看描述和簡介包含關鍵字的軟件包
[root@server ~ 15:40:27]# yum search all 'web server'
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
====================== 匹配:web server ======================
erlang-inets.x86_64 : A set of services such as a Web server: and a ftp client etc
ghc-warp.x86_64 : Fast light-weight web server for WAI: applications
mod_log_post.x86_64 : Module for the Apache web server to log: all HTTP POST messages
nginx.x86_64 : A high performance web server and reverse proxy: server
nikto.noarch : Web server scanner
pcp-pmda-weblog.x86_64 : Performance Co-Pilot (PCP) metrics: from web server logs
perl-PSGI.noarch : Perl Web Server Gateway Interface: Specification
perl-SOAP-WSDL-Apache.noarch : SOAP server with WSDL support: for Apache2 web server
python-tornado.x86_64 : Scalable, non-blocking web server and: tools
python36-tornado.x86_64 : Scalable, non-blocking web server: and tools
rubygem-thin.x86_64 : A thin and fast web server
tlssled.noarch : An evaluation tool for SSL/TLS (HTTPS) web: server implementations
webalizer.x86_64 : A flexible Web server log file analysis: program
xsp.x86_64 : A small web server that hosts ASP.NET
yawn-server.noarch : Standalone web server for yawn
yaws.x86_64 : Web server for dynamic content written in Erlang
Pound.x86_64 : Reverse proxy and load balancer# 查看倉庫中哪個包可以提供文件sar程序
[root@server ~ 15:41:14]# yum provides sar
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
base/7/x86_64/filelists_db             | 7.2 MB     00:01     
epel/x86_64/filelists_db               |  15 MB     00:03     
extras/7/x86_64/filelists_db           | 305 kB     00:00     
updates/7/x86_64/filelists_db          |  15 MB     00:04     
sysstat-10.1.5-19.el7.x86_64 : Collection of performance: monitoring tools for Linux
源    :base
匹配來源:
文件名    :/usr/bin/sarsysstat-10.1.5-20.el7_9.x86_64 : Collection of performance: monitoring tools for Linux
源    :updates
匹配來源:
文件名    :/usr/bin/sarsysstat-10.1.5-19.el7.x86_64 : Collection of performance: monitoring tools for Linux
源    :@anaconda
匹配來源:
文件名    :/bin/sarsysstat-10.1.5-19.el7.x86_64 : Collection of performance: monitoring tools for Linux
源    :@anaconda
匹配來源:
文件名    :/usr/bin/sar#只下載不安裝
[root@server ~ 15:43:24]# yum install vsftpd --downloadonly --downloaddir=/root/
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
正在解決依賴關系
[root@server ~ 15:43:52]# ls vsftpd-*
vsftpd-3.0.2-29.el7_9.x86_64.rpm# 安裝本地文件系統中vsftpd包
[root@server ~ 15:44:23]# yum localinstall ./vsftpd-3.0.2-29.el7_9.x86_64.rpm 
已加載插件:fastestmirror, langpacks
正在檢查 ./vsftpd-3.0.2-29.el7_9.x86_64.rpm: vsftpd-3.0.2-29.el7_9.x86_64
./vsftpd-3.0.2-29.el7_9.x86_64.rpm 將被安裝
# 降級vsftpd版本為3.0.2-28.el7
[root@server ~ 15:44:53]#  yum downgrade -y vsftpd-3.0.2-28.el7
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile# 升級vsftpd版本為3.0.2-29.el7_9
[root@server ~ 15:45:34]# yum update vsftpd-3.0.2-29.el7_9
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile# 升級系統中所有軟件為最新版本
[root@server ~ 15:45:59]# yum update # 卸載軟件包
[root@server ~ 15:51:55]# yum remove httpd

配置 yum 倉庫

yum 倉庫配置

yum 工具的配置文件是 /etc/yum/yum.conf,該文件包括兩部分:

  • main,yum全局配置,提供每個倉庫部分參數默認值。
  • 每個倉庫的獨立配置。
[root@server ~ 15:59:55]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5[root@server ~ 16:29:28]# yum install -y yum-utils
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
軟件包 yum-utils-1.1.31-54.el7_8.noarch 已安裝并且是最新版本
無須任何處理[root@server ~ 16:30:25]# yum-config-manager
已加載插件:fastestmirror, langpacks
========================== main ===========================
[main]
alwaysprompt = True
assumeno = False
assumeyes = False
autocheck_running_kernel = True
autosavets = True
bandwidth = 0
bugtracker_url = http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
cache = 0
cachedir = /var/cache/yum/x86_64/7
check_config_file_age = True
clean_requirements_on_remove = False
color = auto
color_list_available_downgrade = dim,cyan
color_list_available_install = normal
color_list_available_reinstall = bold,underline,green
color_list_available_running_kernel = bold,underline
color_list_available_upgrade = bold,blue
color_list_installed_extra = bold,red
color_list_installed_newer = bold,yellow
color_list_installed_older = bold

main 部分需要關注的參數:

  • enabled = 1,倉庫默認啟用。
  • gpgcheck = 1,倉庫默認啟用gpg校驗。
  • keepcache = 0,不保存緩存。
  • cachedir = /var/cache/yum,緩存文件保存的位置。
  • reposdir = /etc/yum.repos.d, /etc/yum/repos.d, /etc/distro.repos.d,yum倉庫配置文件。

yum管理的軟件包存放在yum倉庫,yum倉庫配置文件存放在/etc/yum.repos.d目錄。

[root@server ~ 16:30:52]# ls /etc/yum.repos.d/
CentOS-Base.repo       CentOS-Sources.repo
CentOS-CR.repo         CentOS-Vault.repo
CentOS-Debuginfo.repo  CentOS-x86_64-kernel.repo
CentOS-fasttrack.repo  epel.repo
CentOS-Media.repo
[root@server ~ 16:31:59]# ls /etc/yum.repos.d /etc/distro.repos.d
ls: 無法訪問/etc/distro.repos.d: 沒有那個文件或目錄
/etc/yum.repos.d:
CentOS-Base.repo       CentOS-Sources.repo
CentOS-CR.repo         CentOS-Vault.repo
CentOS-Debuginfo.repo  CentOS-x86_64-kernel.repo
CentOS-fasttrack.repo  epel.repo
CentOS-Media.repo
yum 倉庫管理
查看 yum 倉庫
# 查看yum倉庫,默認不包括未啟用的倉庫
[root@server ~ 16:32:28]# yum repolist
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
源標識           源名稱                              狀態
base/7/x86_64    CentOS-7 - Base - mirrors.aliyun.co 10,072
epel/x86_64      Extra Packages for Enterprise Linux 13,791
extras/7/x86_64  CentOS-7 - Extras - mirrors.aliyun.    526
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun  6,173
repolist: 30,562# 查看yum所有倉庫,包括未啟用的倉庫
[root@server ~ 16:33:01]# yum repolist all

啟用和禁用倉庫

[root@server ~ 16:33:41]#  vim /etc/yum.repos.d/epel.repo
# 將enabled設置為1,設置為0禁用
enabled=1
倉庫緩存管理

更新緩存后,yum install命令可補全軟件包名稱

# 清理緩存數據
[root@server ~ 16:34:42]# yum clean 
all           dbcache       headers       packages
cache         expire-cache  metadata      # 清理所有緩存數據
[root@server ~ 16:34:42]# yum clean all
已加載插件:fastestmirror, langpacks
正在清理軟件源: base epel epel-source extras updates
Cleaning up list of fastest mirrors# 創建緩存數據
[root@server ~ 16:36:07]# yum makecache
已加載插件:fastestmirror, langpacks
Determining fastest mirrors
元數據緩存已建立

元數據緩存簡單來說,就是將頻繁訪問的元數據臨時存儲在速度更快的存儲介質中,以加快后續對這些元數據的訪問速度,提升系統整體性能。它是應對元數據訪問瓶頸的關鍵技術,在分布式系統、數據庫等場景中應用廣泛

添加 kubernetes 倉庫

[root@server ~ 16:41:10]# yum-config-manager --add-repo=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
已加載插件:fastestmirror, langpacks
adding repo from: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/[mirrors.aliyun.com_kubernetes_yum_repos_kubernetes-el7-x86_64_]
name=added from: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1[root@server ~ 16:41:42]# cat /etc/yum.repos.d/mirrors.aliyun.com_kubernetes_yum_repos_kubernetes-el7-x86_64_.repo [mirrors.aliyun.com_kubernetes_yum_repos_kubernetes-el7-x86_64_]
name=added from: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1# 安裝 kubectl 包
[root@server ~ 16:41:55]# yum install kubectl --nogpgcheck已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com

添加 docker-ce 倉庫

[root@server ~ 16:44:27]#  cat << 'EOF' > /etc/yum.repos.d/docker-ce.repo
> [docker-ce-stable]
> name=Docker CE Stable - $basearch
> baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
> enabled=1
> gpgcheck=0
> EOF# 查看docker版本
[root@server ~ 16:45:02]# yum list docker-ce

源碼安裝軟件

源碼安裝 nginx
介紹

Nginx是一個高性能的HTTP和反向代理web服務器。

# 安裝依賴
[root@centos7 ~]# yum install gcc make pcre-devel zlib-devel # 下載
[root@centos7 ~]# wget https://nginx.org/download/nginx-1.24.0.tar.gz# 解壓
[root@centos7 ~]# tar -xf nginx-1.24.0.tar.gz # 配置
[root@centos7 ~]# cd nginx-1.24.0/
[root@centos7 ~]# ./configure --prefix=/usr/local/nginx# 編譯安裝
[root@centos7 nginx-1.24.0]# make && make install
[root@centos7 ~]# ls /usr/local/nginx/
conf  html  logs  sbin# 配置環境變量
[root@centos7 nginx-1.24.0]# export PATH=$PATH:/usr/local/nginx/sbin/
[root@centos7 nginx-1.24.0]# echo 'export PATH=$PATH:/usr/local/nginx/sbin/' >> ~/.bashrc#使用
# 啟動服務
[root@centos7 ~]# nginx# 驗證
[root@centos7 ~]# curl -s http://localhost | grep Thank
<p><em>Thank you for using nginx.</em></p>

外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳

命令總結:

  • nginx,啟動服務
  • nginx -s quit,待nginx進程處理任務完畢進行停止。
  • nginx -s stop,查出nginx進程id再使用kill命令強制殺掉進程。
  • nginx -s reload,重新加載服務。

源碼安裝 cmatrix

#安裝依賴包
[root@server ~ 19:02:32]# yum -y install gcc make autoconf ncurses-devel
#下載
[root@server ~ 19:03:27]# wget https://jaist.dl.sourceforge.net/project/cmatrix/cmatrix/1.2a/cmatrix-1.2a.tar.gz
#解壓
[root@server ~ 19:05:26]# tar -xf cmatrix-1.2a.tar.gz
#配置軟件
[root@server ~ 19:05:43]# cd cmatrix-1.2a/
[root@server cmatrix-1.2a 19:05:55]# ./configure --prefix=/usr/local/cmatrix
creating cache ./config.cache
#編譯并安裝
[root@server cmatrix-1.2a 19:06:29]# make && make install
#配置環境變量
[root@server cmatrix-1.2a 19:07:25]# export PATH=$PATH:/usr/local/cmatrix/bin
#運行
[root@server cmatrix-1.2a 19:07:51]# cmatrix

在這里插入圖片描述

效果如上

自由調整速度

掉進程。

  • nginx -s reload,重新加載服務。

源碼安裝 cmatrix

#安裝依賴包
[root@server ~ 19:02:32]# yum -y install gcc make autoconf ncurses-devel
#下載
[root@server ~ 19:03:27]# wget https://jaist.dl.sourceforge.net/project/cmatrix/cmatrix/1.2a/cmatrix-1.2a.tar.gz
#解壓
[root@server ~ 19:05:26]# tar -xf cmatrix-1.2a.tar.gz
#配置軟件
[root@server ~ 19:05:43]# cd cmatrix-1.2a/
[root@server cmatrix-1.2a 19:05:55]# ./configure --prefix=/usr/local/cmatrix
creating cache ./config.cache
#編譯并安裝
[root@server cmatrix-1.2a 19:06:29]# make && make install
#配置環境變量
[root@server cmatrix-1.2a 19:07:25]# export PATH=$PATH:/usr/local/cmatrix/bin
#運行
[root@server cmatrix-1.2a 19:07:51]# cmatrix

[外鏈圖片轉存中…(img-Me2jMuBB-1753873932721)]

效果如上

自由調整速度

在 Cmatrix 運行的過程中,你可以按 09 的任何一位數字鍵來隨意改變當前的更新速度。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/pingmian/91679.shtml
繁體地址,請注明出處:http://hk.pswp.cn/pingmian/91679.shtml
英文地址,請注明出處:http://en.pswp.cn/pingmian/91679.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

使用 Vue 3.0 Composition API 優化流程設計器界面

&#x1f90d; 前端開發工程師、技術日更博主、已過CET6 &#x1f368; 阿珊和她的貓_CSDN博客專家、23年度博客之星前端領域TOP1 &#x1f560; 牛客高級專題作者、打造專欄《前端面試必備》 、《2024面試高頻手撕題》、《前端求職突破計劃》 &#x1f35a; 藍橋云課簽約作者、…

2025Nacos安裝Mac版本 少走彎路版本

https://github.com/alibaba/nacos 一開始看網上文章&#xff0c;隨便下了一個最新的3.0.2&#xff0c;然后出現很多錯誤 密鑰等等問題&#xff0c;最后啟動了&#xff0c;但是打不開鏈接&#xff1a;http://localhost:8848/nacos 然后開始找問題日志&#xff0c;/.nofollow/…

sifu mod制作 相關經驗

sifu mod制作一遍流程數據傳遞后拆開是ok的&#xff0c;沒必要合并 斷片不能使用原材質不然導入ue里沒法片段選擇 效果拔群 帶自動權重就會有跟隨骨骼的效果&#xff0c;空頂點組會跟隨父級的原點 這個選負的會抵消膠囊的碰撞效果 應用并刷新布料模擬&#xff08;相當于工程圖的…

論文精讀筆記:Overview

本文檔記錄了一些經典論文的講解筆記。 重讀經典&#xff1a;《ImageNet Classification with Deep Convolutional Neural Networks》 重讀經典&#xff1a;《Generative Adversarial Nets》 重讀經典&#xff1a;《Deep Residual Learning for Image Recognition》 重讀經典…

Elasticsearch+Logstash+Filebeat+Kibana單機部署

目錄 一、配置準備 下載java&#xff0c;需要java環境 二、單機模式 ELK部署 修改域名解析 elasticsearch配置 啟動elasticsearch服務 查看是否啟用 查看監聽端口 logstash服務 創建配置文件 kibana 啟動服務kebana 驗證 網頁訪問 ?編輯 生成圖表 回到網頁 一、配置準…

redis快速部署、集成、調優

redis快速部署、集成、調優 1.部署 1.1 docker部署 參考&#xff1a;https://blog.csdn.net/taotao_guiwang/article/details/135508643 1.2 redis部署 資源見&#xff0c;百度網盤&#xff1a;https://pan.baidu.com/s/1qlabJ7m8BDm77GbDuHmbNQ?pwd41ac 執行redis_insta…

大學生HTML期末大作業——HTML+CSS+JavaScript音樂網站

HTMLCSSJS【音樂網站】網頁設計期末課程大作業 web前端開發技術 web課程設計 網頁規劃與設計&#x1f4a5; 文章目錄一、&#x1f3c1; 網站題目二、&#x1f6a9; 網站描述三、&#x1f38c; 網站介紹四、&#x1f3f4; 網站效果五、&#x1f3f3;? 網站代碼六、&#x1f3f3…

ARP協議是什么?ARP欺騙是如何實現的?我們該如何預防ARP欺騙?

ARP&#xff08;Address Resolution Protocol&#xff0c;地址解析協議&#xff09;是一個工作在數據鏈路層&#xff08;OSI第二層&#xff09;和網絡層&#xff08;OSI第三層&#xff09;之間的基礎網絡協議&#xff0c;它的核心功能是將網絡層地址&#xff08;IP地址&#xf…

一個物理引擎仿真器(mujoco這種)的計算流程

物理仿真的核心循環 一個典型的物理仿真引擎&#xff0c;在每一個時間步&#xff08;dt&#xff09;內&#xff0c;大致會執行以下流程&#xff1a; 確定當前狀態 (State)&#xff1a;獲取所有物體當前的位置 q 和速度 v。計算力 (Forces)&#xff1a;根據當前狀態&#xff0c;…

自然語言處理NLP(3)

上文&#xff1a; 自然語言處理NLP&#xff08;1&#xff09; 自然語言處理NLP&#xff08;2&#xff09; Gated RNN & LSTM 簡單RNN存在的問題 隨著時間的回溯&#xff0c;簡單RNN不能避免梯度消失或者梯度爆炸 梯度裁剪 用來解決梯度爆炸問題 code: g&#xff1a;所有參…

內循環全部滿足條件后,為true

### 實現方式在 C 中&#xff0c;可以通過在內循環外部定義一個布爾變量&#xff0c;并在內循環的每次迭代中檢查特定條件是否滿足。如果所有迭代均滿足條件&#xff0c;則在內循環結束后將布爾變量設置為 true。以下是一個示例代碼&#xff1a;cpp #include <iostream>i…

STM32--DHT11(標準庫)驅動開發

一、前言在我們進行嵌入式開發時&#xff0c;驅動開發也是十分重要的一步&#xff0c;在很多時候&#xff0c;我們的都需要自己來編寫硬件的底層驅動&#xff0c;實現硬件與芯片的通信&#xff0c;常見的協議有SPI&#xff0c;IIC&#xff0c;以及單總線的一些通信方式&#xf…

HttpServletRequest 和 HttpServletResponse核心接口區別

HttpServletRequest 和 HttpServletResponse核心接口區別在 Java Web 開發&#xff08;基于 Servlet 規范&#xff09;中&#xff0c;HttpServletRequest 和 HttpServletResponse 是兩個核心接口&#xff0c;分別代表 ??HTTP 請求?? 和 ??HTTP 響應??。它們的主要區別在…

win10 環境刪除文件提示文件被使用無法刪除怎么辦?

因為我沒想太好怎么模擬一個文件被使用&#xff0c;我就使用 "java -jar xxx.jar" 模擬 xxx.jar 文件被使用無法刪除吧。現在有一個后臺進行在執行 java -jar chat-robot-1.0.0.jar &#xff0c;所以此時刪除 chat-robot-1.0.0.jar 提示&#xff1a;當然這個提示對于…

1.7vue生命周期

生命周期階段與鉤子函數創建階段beforeCreate()&#xff1a;實例初始化之后&#xff0c;數據觀測和事件配置之前調用。此時無法訪問到data、methods等屬性。created()&#xff1a;實例創建完成后調用。完成了數據觀測&#xff0c;屬性和方法的運算&#xff0c;watch/event事件回…

第十八天(指紋識別WAF判斷蜜罐排除)

Web架構 開源CMS&#xff1a; Discuz、WordPress、PageAdmin、蟬知等 前端技術&#xff1a; HTML5、Jquery、Bootstrap、Vue、NodeJS等 開發語言&#xff1a; PHP、JAVA、Ruby、Python、C#、JS、Go等 框架組件&#xff1a; SpringMVC、Thinkphp、Yii、Tornado、Vue等 Web服…

Real-Time Rendering 4th Edition 完整學習路徑

課程計劃&#xff1a;Real-Time Rendering 4th Edition 完整學習路徑 &#x1f4da;? 階段一&#xff1a;數學基礎鞏固 (2-3周) &#x1f9ee;向量與矩陣運算 3D變換矩陣的本質理解齊次坐標系統的實際意義幾何數學 點、線、面的幾何關系法向量與切向量計算三角函數在圖形學中的…

MC0364魔法鏈路

碼蹄集OJ-魔法鏈路 MC0364?魔法鏈路 難度&#xff1a;黃金 時間限制&#xff1a;1 秒 占用內存&#xff1a;256 M 收藏 報錯 小碼妹學會了多重施法&#xff0c;也就是同時施放多個法術的能力&#xff0c;然而多重施法中每個最終施放的法術都需要一些前置的法力運轉&#xff…

《解密React key:虛擬DOM Diff中的節點身份錨點》

在React的性能優化體系中&#xff0c;key屬性始終是一個看似簡單卻暗藏玄機的存在。它并非可有可無的標記&#xff0c;而是虛擬DOM Diff算法識別節點身份的核心錨點&#xff0c;直接決定著React如何判斷節點是否需要重渲染、如何復用已有元素。理解key的本質&#xff0c;不僅能…

react 和 react native 的開發過程區別

React 和 React Native 雖然都使用 React 思想和語法&#xff08;函數組件、Hooks、JSX 等&#xff09;&#xff0c;但在 開發流程、渲染機制、UI 組件、樣式處理、運行平臺 等方面有明顯差異。以下是對比總結&#xff1a;? 一、開發目的和平臺不同對比項ReactReact Native應用…