河北建设部官方网站wordpress 浏览器缓存
2026/4/11 7:31:02 网站建设 项目流程
河北建设部官方网站,wordpress 浏览器缓存,网站横幅广告代码,小程序制作教程零基础入门Windows 中软件包管理1. 控制面板中程序和功能。通过安装#xff0c;将信息注册到系统中。2. 用户下载的绿色软件。例如U盘启动盘工具rufus。 软件包来源#xff1a;应用商城#xff0c;第三方官方网站#xff08;qq、微信#xff09;。分析 RPM 包Linux 发行版本以 RHEL …Windows 中软件包管理1. 控制面板中程序和功能。通过安装将信息注册到系统中。2. 用户下载的绿色软件。例如U盘启动盘工具rufus。软件包来源应用商城第三方官方网站qq、微信。分析 RPM 包Linux 发行版本以 RHEL 为代表的发行版本使用rpm包管理系统RHEL (Red Hat Enterprise LinuxFedora由原来的RedHat桌面版本发展而来免费版本CentOSRHEL的社区克隆版本免费RockyRHEL的社区克隆版本免费OELOralce Enterprise Linux以 Debian 为代表的发行版本使用deb包管理系统Debian社区Linux的典范迄今为止最遵循GNU规范的Linux系统。UbuntuDebian衍生版是一个以桌面应用为主的Linux操作系统。Kali LinuxDebian衍生版旨在渗透测试和数字取证。其他版本ArchLinux Gentoo 等等...RPM 包文件名格式redhat 开发了 rpm 包管理提供一个标准的软件版本管理方法比从归档包解压文件到系统简单多了。CentOS 提供的所有软件都是rpm格式。RPM软件包文件名格式name-version-release.architecture.rpm示例lrzsz-0.12.20-36.el7.x86_64.rpmname是描述其内容的一个或多个词语(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包将删除旧版本的软件包并安装新版本通常会保留配置文件。rpm 命令查询重点基本语法rpm {-q|--query} [select-options] [query-options] select-options [PACKAGE_NAME] [-a,--all] [-f,--file FILE] [-g,--group GROUP] {-p,--package PACKAGE_FILE] [--hdrid SHA1] [--pkgid MD5] [--tid TID] [--querybynumber HDRNUM] [--triggeredby PACKAGE_NAME] [--whatprovides CAPABILITY] [--whatrequires CAPABILITY] query-options [--changelog] [-c,--configfiles] [--conflicts] [-d,--docfiles] [--dump] [--filesbypkg] [-i,--info] [--last] [-l,--list] [--obsoletes] [--provides] [--qf,--queryformat QUERYFMT] [-R,--requires] [--scripts] [-s,--state] [--triggers,--triggerscripts]示例# 查询系统中安装了哪些软件包 [rootcentos7 ~]# 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 ...... # 查询系统中某个软件包是否安装 [rootcentos7 ~]# rpm -q httpd 未安装软件包 httpd [rootcentos7 ~]# rpm -q kernel kernel-3.10.0-1160.71.1.el7.x86_64 # 查询系统中某个已安装的软件包元数据信息 [rootcentos7 ~]# rpm -q coreutils -i Name : coreutils Version : 8.22 Release : 24.el7_9.2 Architecture: x86_64 Install Date: 2025年07月18日 星期五 10时29分40秒 Group : System Environment/Base Size : 14594210 License : GPLv3 Signature : RSA/SHA256, 2020年11月18日 星期三 22时16分51秒, Key ID 24c6a8a7f4a80eb5 Source RPM : coreutils-8.22-24.el7_9.2.src.rpm Build Date : 2020年11月17日 星期二 06时24分59秒 Build Host : x86-01.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem http://bugs.centos.org Vendor : CentOS URL : http://www.gnu.org/software/coreutils/ Summary : A set of basic GNU tools commonly used in shell scripts Description : These are the GNU core utilities. This package is the combination of the old GNU fileutils, sh-utils, and textutils packages. # 查询系统中某个已安装的软件包包涵哪些文件 [rootcentos7 ~]# 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 # 查询系统中某个已安装的软件包包涵哪些配置文件 [rootcentos7 ~]# rpm -q openssh-server -c /etc/pam.d/sshd /etc/ssh/sshd_config /etc/sysconfig/sshd # 查询系统中某个已安装的软件包包涵哪些文档文件 [rootcentos7 ~]# 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 # 查询系统中某个某个文件属于哪个已安装的软件包 [rootcentos7 ~]# rpm -q -f /etc/ssh/sshd_config openssh-server-7.4p1-22.el7_9.x86_64 # 查询系统中某个已安装的软件包包涵的脚本 [rootcentos7 ~]# rpm -q openssh-server --scripts preinstall scriptlet (using /bin/sh): ...... postinstall scriptlet (using /bin/sh): ...... preuninstall scriptlet (using /bin/sh): ...... postuninstall scriptlet (using /bin/sh): ...... # 查询系统中某个已安装的软件包变更日志 [rootcentos7 ~]# rpm -q openssh-server --changelog * 四 9月 30 2021 Dmitry Belyavskiy dbelyavsredhat.com - 7.4p1-22 0.10.3-2 - avoid segfault in Kerberos cache cleanup (#1999263) - fix CVE-2021-41617 (#2008884) ...... # 下载 httpd 软件包,以及依赖的其他软件包 [rootcentos7 ~]# yumdownloader httpd [rootcentos7 ~]# ls httpd-* httpd-2.4.6-99.el7.centos.1.x86_64.rpm # 查询系统中某个软件包(package)文件包涵哪些配置文件 [rootcentos7 ~]# rpm -q -p 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 ...... # 同样-l -d -i也可以配置-p使用 # 查询系统中某个软件包组中包涵哪些软件包 [rootcentos7 ~]# 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 filesystem-3.2-25.el7.x86_64 ......扩展# 查看软件包所在仓库精确位置 [rootcentos7 ~]# repoquery --location httpd http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/httpd-2.4.6- 99.el7.centos.1.x86_64.rpm # 此时可以通过 wget 下载特定文件 [rootcentos7 ~]# wget \ http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/httpd-2.4.6- 99.el7.centos.1.x86_64.rpm验证基本语法rpm {-V|--verify} [select-options] [verify-options] select-options [PACKAGE_NAME] [-a,--all] [-f,--file FILE] [-g,--group GROUP] {-p,--package PACKAGE_FILE] [--hdrid SHA1] [--pkgid MD5] [--tid TID] [--querybynumber HDRNUM] [--triggeredby PACKAGE_NAME] [--whatprovides CAPABILITY] [--whatrequires CAPABILITY] verify-options [--nodeps] [--nofiles] [--noscripts] [--nodigest] [--nosignature] [--nolinkto] [--nofiledigest] [--nosize] [--nouser] [--nogroup] [--nomtime] [--nomode] [--nordev] [--nocaps] [--noconfig] [--noghost]示例# 查看openssh-server软件安装是否有问题 [rootcentos7 ~]# rpm -V openssh-server # 修改(change) [rootcentos7 ~]# sed -i s/PermitRootLogin yes/PermitRootLogin no/g /etc/ssh/sshd_config [rootcentos7 ~]# rpm -V openssh-server S.5....T. c /etc/ssh/sshd_config [rootcentos7 ~]# sed -i s/PermitRootLogin no/PermitRootLogin yes/g /etc/ssh/sshd_config # 移走 /etc/ssh/sshd_config 文件再次查看 [rootcentos7 ~]# mv /etc/ssh/sshd_config . [rootcentos7 ~]# rpm -V openssh-server 遗漏 c /etc/ssh/sshd_config # 恢复该文件到原来位置 [rootcentos7 ~]# mv sshd_config /etc/ssh/sshd_config安装和卸载基本语法rpm {-i|--install} [install-options] PACKAGE_FILE ... install-options [--allfiles] [--badreloc] [--excludepath OLDPATH] [--excludedocs] [--force] [-h,--hash] [--ignoresize] [--ignorearch] [--ignoreos] [--includedocs] [--justdb] [--nocollections] [--nodeps] [--nodigest] [--nosignature] [--noplugins] [--noorder] [--noscripts] [--notriggers] [--oldpackage] [--percent] [--prefix NEWPATH] [--relocate OLDPATHNEWPATH] [--replacefiles] [--replacepkgs] [--test]示例# 下载软件包 [rootcentos7 ~]# repoquery --location lrzsz http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/lrzsz-0.12.20- 36.el7.x86_64.rpm [rootcentos7 ~]# wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/lrzsz-0.12.20- 36.el7.x86_64.rpm lrzsz-0.12.20-36.el7.x86_64.rpm # 安装 [rootcentos7 ~]# rpm -i lrzsz-0.12.20-36.el7.x86_64.rpm [rootcentos7 ~]# rpm -q lrzsz lrzsz-0.12.20-36.el7.x86_64 # 卸载 [rootcentos7 ~]# rpm -e lrzsz [rootcentos7 ~]# rpm -q lrzsz 未安装软件包 lrzsz # 友好方式安装 [rootcentos7 ~]# rpm -ivh lrzsz-0.12.20-36.el7.x86_64.rpm Verifying... ################################ [100%] 准备中... ################################ [100%] 正在升级/安装... 1:lrzsz-0.12.20-36.el7 ################################ [100%] # 友好方式卸载 [rootcentos7 ~]# rpm -evh lrzsz 准备中... ################################ [100%] 正在清理/删除... 1:lrzsz-0.12.20-36.el7 ################################ [100%] # 安装 httpd报错如下下一节讲解如下解决 # 安装准备确保系统中没有提供httpd需要的依赖包 [rootcentos7 ~]# rpm -e apr apr-util httpd-tools mailcap [rootcentos7 ~]# rpm -ivh httpd-2.4.6-99.el7.centos.1.x86_64.rpm 错误依赖检测失败 /etc/mime.types 被 httpd-2.4.6-99.el7.centos.1.x86_64 需要 httpd-tools 2.4.6-99.el7.centos.1 被 httpd-2.4.6- 99.el7.centos.1.x86_64 需要 libapr-1.so.0()(64bit) 被 httpd-2.4.6-99.el7.centos.1.x86_64 需要 libaprutil-1.so.0()(64bit) 被 httpd-2.4.6-99.el7.centos.1.x86_64 需 要重新安装rpm {--reinstall} [install-options] PACKAGE_FILE ...示例[rootcentos7 ~]# rpm --reinstall -vh lrzsz* Verifying... ################################ [100%] 准备中... ################################ [100%] 正在升级/安装... 1:lrzsz-0.12.20-36.el7 ################################ [100%]提取 RPM 包中文件Windows 提取使用压缩工具例如360压缩打开rpm包浏览和提取。Linux 提取方法一分步骤提取# 将文件转换为cpio格式 [rootcentos7 ~]# rpm2cpio httpd-2.4.6-99.el7.centos.1.x86_64.rpm httpd-2.4.6-99.el7.centos.1.x86_64.cpio # 查询 cpio 格式一种打包格式文件中有哪些文件 [rootcentos7 ~]# cpio -t httpd-2.4.6-99.el7.centos.1.x86_64.cpio ./etc/httpd ./etc/httpd/conf ./etc/httpd/conf.d ./etc/httpd/conf.d/README ./etc/httpd/conf.d/autoindex.conf ...... # 配置管道查询特定文件 [rootcentos7 ~]# cpio -t httpd-2.4.6-99.el7.centos.1.x86_64.cpio |grep httpd\.conf ./etc/httpd/conf/httpd.conf ./usr/lib/tmpfiles.d/httpd.conf 19331 blocks # 提取所有文件-d选项指明提取过程中创建对应的目录分层结构 [rootcentos7 ~]# cpio -id * httpd-2.4.6- 99.el7.centos.1.x86_64.cpio # 提取特定文件 [rootcentos7 ~]# cpio -id ./etc/httpd/conf/httpd.conf httpd- 2.4.6-99.el7.centos.1.x86_64.cpio方法二一步提取所有文件[rootcentos7 ~]# rpm2cpio httpd-2.4.6-99.el7.centos.1.x86_64.rpm | cpio -id *使用 yum 管理软件包yum 介绍rpm 命令是一个管理软件包的工具不适用于软件包存储库或自动解决来自多个源的依赖项。YumYellowdog Updater Modified旨在成为管理基于RPM的软件安装和更新的更好系统。yum命令允许安装更新删除和获取有关软件包及其依赖项的信息。yum 命令# 查看yum命令帮助信息 [rootcentos7 ~]# yum help # 查看仓库中httpd包信息 [rootcentos7 ~]# 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 大小 9.4 M 源 installed 来自源updates 简介 Apache HTTP Server 网址 http://httpd.apache.org/ 协议 ASL 2.0 描述 The Apache HTTP Server is a powerful, efficient, and extensible : web server. # 查看仓库中http开头的包有哪些 [rootcentos7 ~]# yum list http* 已加载插件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 updates 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包有哪些版本 [rootcentos7 ~]# 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-99.el7.centos.1 updates 可安装的软件包 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 # 查看简介包含关键字的软件包 [rootcentos7 ~]# yum search web server # 查看描述和简介包含关键字的软件包 [rootcentos7 ~]# yum search all web server # 查看仓库中哪个包可以提供文件sar程序 [rootcentos7 ~]# yum provides sar 已加载插件fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com sysstat-10.1.5-19.el7.x86_64 : Collection of performance monitoring tools for Linux 源 base 匹配来源 文件名 /usr/bin/sar sysstat-10.1.5-20.el7_9.x86_64 : Collection of performance monitoring tools for Linux 源 updates 匹配来源 文件名 /usr/bin/sar # 安装sar工具对应的软件包 [rootcentos7 ~]# yum install -y sysstat # 只下载不安装将依赖软件包一并下载 [rootcentos7 ~]# yum install vsftpd --downloadonly -- downloaddir/root/ [rootcentos7 ~]# ls vsftpd-* vsftpd-3.0.2-29.el7_9.x86_64.rpm # 安装本地文件系统中vsftpd包 [rootcentos7 ~]# yum localinstall ./vsftpd-3.0.2-29.el7_9.x86_64.rpm # 降级 vsftpd 版本为 3.0.2-28.el7 [rootcentos7 ~]# yum downgrade -y vsftpd-3.0.2-28.el7 # 降级的时候要一并降级依赖软件包 # 升级 vsftpd 版本为 3.0.2-29.el7_9 [rootcentos7 ~]# yum update vsftpd-3.0.2-29.el7_9 # 升级系统中所有软件为最新版本 [rootcentos7 ~]# yum update # 卸载软件包 [rootcentos7 ~]# yum remove -y vsftpd依赖降级示例# 环境准备安装最新版httpd [rootcentos7 ~]# yum install -y httpd # 降级到特定版本降级失败因为已安装的 httpd-tools 无法满足当前httpd版本 [rootcentos7 ~]# yum downgrade -y httpd-2.4.6-97.el7.centos 已加载插件fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 正在解决依赖关系 -- 正在检查事务 --- 软件包 httpd.x86_64.0.2.4.6-97.el7.centos 将被 降级 -- 正在处理依赖关系 httpd-tools 2.4.6-97.el7.centos它被软件包 httpd- 2.4.6-97.el7.centos.x86_64 需要 --- 软件包 httpd.x86_64.0.2.4.6-99.el7.centos.1 将被 删除 -- 解决依赖关系完成 错误软件包httpd-2.4.6-97.el7.centos.x86_64 (updates) 需要httpd-tools 2.4.6-97.el7.centos 已安装: httpd-tools-2.4.6-99.el7.centos.1.x86_64 (updates) httpd-tools 2.4.6-99.el7.centos.1 可用: httpd-tools-2.4.6-95.el7.centos.x86_64 (base) httpd-tools 2.4.6-95.el7.centos ...... 可用: httpd-tools-2.4.6-98.el7.centos.7.x86_64 (updates) httpd-tools 2.4.6-98.el7.centos.7 您可以尝试添加 --skip-broken 选项来解决该问题 您可以尝试执行rpm -Va --nofiles --nodigest # 解决方法httpd-tools与httpd一起降级到相同版本 [rootcentos7 ~]# yum downgrade -y httpd-tools-2.4.6-97.el7.centos httpd-2.4.6-97.el7.centos软件包组管理# 查看仓库中软件包组清单 [rootcentos7 ~]# yum grouplist ...... 可用的环境分组 最小安装 基础设施服务器 ...... 带 GUI 的服务器 GNOME 桌面 KDE Plasma Workspaces 开发及生成工作站 可用组 Cinnamon Fedora Packager Haskell ...... 通用桌面 完成 [rootcentos7 ~]# yum grouplist -v ...... 可用的环境分组 最小安装 (minimal) 基础设施服务器 (infrastructure-server-environment) ...... 带 GUI 的服务器 (graphical-server-environment) GNOME 桌面 (gnome-desktop-environment) KDE Plasma Workspaces (kde-desktop-environment) 开发及生成工作站 (developer-workstation-environment) 可用组 Cinnamon (cinnamon-desktop) Fedora Packager (fedora-packager) Haskell (haskell) ...... 通用桌面 (general-desktop) 完成 [rootcentos7 ~]# unset LANG [rootcentos7 ~]# yum group list -v ...... Available Environment Groups: Minimal Install (minimal) Compute Node (compute-node-environment) ...... Server with GUI (graphical-server-environment) GNOME Desktop (gnome-desktop-environment) KDE Plasma Workspaces (kde-desktop-environment) Development and Creative Workstation (developer-workstationenvironment) Available Groups: Cinnamon (cinnamon-desktop) Compatibility Libraries (compat-libraries) Console Internet Tools (console-internet) ...... Xfce (xfce-desktop) Done # 查看仓库中软件包组信息 [rootcentos7 ~]# yum groupinfo tabtab [rootcentos7 ~]# yum groupinfo Server with GUI # 安装仓库中软件包组 [rootcentos7 ~]# yum groupinstall Server with GUI # 卸载仓库中软件包组 [rootcentos7 ~]# yum groupremove Server with GUI配置 yum 仓库yum 仓库配置yum 工具的配置文件是 /etc/yum.conf该文件包括两部分全局配置main 块提供每个仓库默认配置。每个仓库的独立配置。[rootcentos7 ~]# cat /etc/yum.conf [main] cachedir/var/cache/yum/$basearch/$releasever keepcache0 debuglevel2 logfile/var/log/yum.log exactarch1 obsoletes1 gpgcheck1 plugins1 installonly_limit5 bugtracker_urlhttp://bugs.centos.org/set_project.php? project_id23refhttp://bugs.centos.org/bug_report_page.php? categoryyum distroverpkgcentos-release # This is the default, if you make this bigger yum wont see if the metadata # is newer on the remote and so youll gain the bandwidth of not having to # download the new metadata and pay for it by yum not having correct # information. # It is esp. important, to have correct metadata, for distributions like # Fedora which dont keep old packages around. If you dont like this checking # interupting your command line usage, its much better to have something # manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire90m # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d使用如下命令查看完整的配置内容[rootcentos7 ~]# yum install -y yum-utils # 导出 yum 完整配置 [rootcentos7 ~]# yum-config-manager Loaded plugins: fastestmirror, langpacks main [main] alwaysprompt True assumeno False assumeyes False ...... repo: base [base] async True bandwidth 0 base_persistdir /var/lib/yum/repos/x86_64/7 ......main 部分设置全局配置enabled 1仓库默认启用。gpgcheck 1仓库默认启用gpg校验。keepcache 0不保存缓存。cachedir /var/cache/yum缓存文件保存的位置。reposdir /etc/yum.repos.d, /etc/yum/repos.d,yum仓库配置文件。yum管理的软件包存放在yum仓库yum仓库配置文件存放在/etc/yum.repos.d目录。[rootcentos7 ~]# ls /etc/yum.repos.d/ CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo CentOS-CR.repo CentOS-Media.repo CentOS-x86_64-kernel.repo CentOS-Debuginfo.repo CentOS-Sources.repo epel.repo [rootcentos7 ~]# ls /etc/yum/repos.d /etc/distro.repos.d ls: 无法访问/etc/yum/repos.d: 没有那个文件或目录 ls: 无法访问/etc/distro.repos.d: 没有那个文件或目录yum 仓库管理查看 yum 仓库# 查看启用的yum仓库 [rootserver ~]# yum repolist 源标识 源名称 状态 base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072 epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,791 extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 526 updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 6,173 repolist: 30,562 # 查看 yum 所有仓库包括未启用的仓库 [rootcentos7 ~]# yum repolist all启用和禁用仓库# 启用 [rootcentos7 ~]# yum-config-manager --enable epel-debuginfo # 禁用 [rootcentos7 ~]# yum-config-manager --disable epel-debuginfo也可以编辑仓库配置文件将仓库中enabled值设置为1启用设置为0禁用。# 查看禁用的仓库清单 [rootcentos7 ~]# vim /etc/yum.repos.d/epel.repo [epel] nameExtra Packages for Enterprise Linux 7 - $basearch baseurlhttp://mirrors.aliyun.com/epel/7/$basearch failovermethodpriority enabled1 gpgcheck0 gpgkeyfile:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-debuginfo] nameExtra Packages for Enterprise Linux 7 - $basearch - Debug baseurlhttp://mirrors.aliyun.com/epel/7/$basearch/debug failovermethodpriority # 将enabled设置为1启用设置为0禁用 enabled1 gpgkeyfile:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck0 [epel-source] nameExtra Packages for Enterprise Linux 7 - $basearch - Source baseurlhttp://mirrors.aliyun.com/epel/7/SRPMS failovermethodpriority enabled0 gpgkeyfile:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck0仓库缓存管理更新缓存后 yum install 命令可补全软件包名称。# 清理缓存数据 [rootcentos7 ~]# yum clean tabtab all dbcache headers packages cache expire-cache metadata # 清理所有缓存数据 [rootcentos7 ~]# yum clean all # 创建缓存数据 [rootserver ~]# yum makecache base | 3.6 kB 00:00:00 epel | 4.3 kB 00:00:00 epel-debuginfo | 3.0 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 元数据缓存已建立添加 kubernetes 仓库[rootcentos7 ~]# yum-config-manager --addrepo https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7- x86_64/ [rootcentos7 ~]# cat /etc/yum.repos.d/mirrors.aliyun.com_kubernetes_yum_repos_kubernetesel7- x86_64_.repo [mirrors.aliyun.com_kubernetes_yum_repos_kubernetes-el7-x86_64_] nameadded from: https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ baseurlhttps://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7- x86_64/ enabled1 # 安装 kubectl 包 [rootcentos7 ~]# yum install kubectl --nogpgcheck添加 docker-ce 仓库[rootcentos7 ~]# cat EOF /etc/yum.repos.d/docker-ce.repo [docker-ce-stable] nameDocker CE Stable - $basearch baseurlhttps://mirrors.aliyun.com/dockerce/ linux/centos/$releasever/$basearch/stable enabled1 gpgcheck0 EOF # 查看docker版本 [rootcentos7 ~]# yum list docker-ce Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.ustc.edu.cn * extras: mirrors.ustc.edu.cn * updates: mirrors.ustc.edu.cn Available Packages docker-ce.x86_64 3:20.10.22-3.el7 docker-ce-stablepel 仓库EPEL(Extra Packages for Enterprise Linux)是由Fedora Special Interest Group维护的Enterprise LinuxRHEL、CentOS中经常用到的包。# 直接使用aliyun的源 [rootcentos7 ~]# curl -s -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo其他问题关闭执行yum命令时开头的Loading 提示信息。编辑 /etc/yum.conf 文件在其中添加或修改 plugins 参数使其值为 0 。[rootcentos7 ~]# sudo sed -i s/plugins1/plugins0/g /etc/yum.conf源码安装软件源码安装 nginx介绍Nginx是一个高性能的HTTP和反向代理web服务器。官方地址https://nginx.org安装# 安装依赖 [rootcentos7 ~]# yum install gcc make pcre-devel zlib-devel # 下载 [rootcentos7 ~]# wget https://nginx.org/download/nginx-1.24.0.tar.gz # 解压 [rootcentos7 ~]# tar -xf nginx-1.24.0.tar.gz # 配置 [rootcentos7 ~]# cd nginx-1.24.0/ [rootcentos7 ~]# ./configure --prefix/usr/local/nginx # 将所有的nginx相关文件存放在/usr/local/nginx # 编译安装 [rootcentos7 nginx-1.24.0]# make make install [rootcentos7 ~]# ls /usr/local/nginx/ conf html logs sbin # 配置环境变量 [rootcentos7 nginx-1.24.0]# export PATH$PATH:/usr/local/nginx/sbin/ [rootcentos7 nginx-1.24.0]# echo export PATH$PATH:/usr/local/nginx/sbin/ ~/.bashrc使用# 启动服务 [rootcentos7 ~]# nginx # 验证 [rootcentos7 ~]# curl -s http://localhost | grep Thank pemThank you for using nginx./em/p命令总结nginx启动服务nginx -s quit待nginx进程处理任务完毕进行停止。nginx -s stop查出nginx进程id再使用kill命令强制杀掉进程。nginx -s reload重新加载服务。配置nginx服务[rootcentos7 ~]# cp /usr/lib/systemd/system/sshd.service /etc/systemd/system/nginx.service [rootcentos7 ~]# vim /etc/systemd/system/nginx.service[Unit] DescriptionNginx server daemon [Service] Typeforking ExecStart/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload/usr/local/nginx/sbin/nginx -s reload ExecStop/usr/local/nginx/sbin/nginx -s quit [Install] WantedBymulti-user.target[rootcentos7 ~]# systemctl daemon-reload [rootcentos7 ~]# systemctl enable nginx.service --now源码安装 cmatrix介绍Cmatrix 是一款 Linux 环境下的炫酷屏保软件其效果类似于黑客帝国电影中的代码雨。项目地址https://github.com/abishekvashok/cmatrix安装# 安装依赖包 [rootcentos7 ~]# yum -y install gcc make autoconf ncurses-devel # 下载 [rootcentos7 ~]# wget https://jaist.dl.sourceforge.net/project/cmatrix/cmatrix/1.2a/cmatrix- 1.2a.tar.gz # 解压 [rootcentos7 ~]# tar -xf cmatrix-1.2a.tar.gz # 配置软件 [rootcentos7 ~]# cd cmatrix-1.2a/ [rootcentos7 cmatrix-1.2a]# ./configure --prefix/usr/local/cmatrix # 编译并安装 [rootcentos7 cmatrix-1.2a]# make make install使用# 配置环境变量 [rootcentos7 ~]# export PATH$PATH:/usr/local/cmatrix/bin # 帮助信息 [rootcentos7 ~]# cmatrix --help Usage: cmatrix -[abBfhlsVx] [-u delay] [-C color] -a: Asynchronous scroll -b: Bold characters on -B: All bold characters (overrides -b) -f: Force the linux $TERM type to be on -l: Linux mode (uses matrix console font) -o: Use old-style scrolling -h: Print usage and exit -n: No bold characters (overrides -b and -B, default) -s: Screensaver mode, exits on first keystroke -x: X window mode, use if your xterm is using mtx.pcf -V: Print version information and exit -u delay (0 - 10, default 4): Screen update delay -C [color]: Use this color for matrix (default green) # 执行 [rootcentos7 ~]# cmatrix # 效果如下[rootcentos7 ~]# cmatrix -b -u 3 -C red # -b 加粗字体 # -u 滚动速度 # -C 字体颜色 绿色green、红色red、蓝色blue、白色white、黄色 yellow、青色cyan、洋红色magenta以及黑色black这些颜色。随时改变颜色当然你无需重新启动程序就可以随时改变显示的颜色。但需要记住不同的键位对应着不同的颜色。在 Cmatrix 未关闭的情况下如果你按下了存储在键位上的指令显示的颜色将会直接变更。颜色相应键位对应数字键红色!shift1绿色shift2黄色#shift3蓝色$shift4洋红色%shift5青色^shift6白色shift7黑色)shift8自由调整速度在 Cmatrix 运行的过程中你可以按 0 到 9 的任何一位数字键来随意改变当前的更新速度。自建仓库自建仓库流程1. 准备软件包2. 创建仓库索引信息3. 发布仓库4. 客户端配置验证详细操作步骤1. 准备软件包[rootserver ~]# mkdir rpms [rootserver ~]# cd rpms # 下载软件包以及依赖的软件包 [rootserver rpms]# yumdownloader vim open-vm-tools vsftpd lrzsz bash-completion # 注意 # 如果使用yum download 下载则不会下载依赖的软件包。 # 此时不要执行yum相关命令否则这里软件包会被清理掉。 # 移动软件包到发布目录 [rootserver ~]# mkdir -p /var/www/html/tools [rootserver ~]# mv rpms /var/www/html/tools/Packages2. 创建仓库# 安装创建仓库软件包 [rootserver ~]# yum install -y createrepo # 创建仓库索引信息 [rootserver ~]# createrepo /var/www/html/tools/3. 通过 web 服务器发布仓库# 部署 web 服务器 [rootserver ~]# yum install -y httpd [rootserver ~]# systemctl enable httpd --now #关闭防火墙和 SELinux [rootserver ~]# systemctl disable firewalld.service --now [rootserver ~]# setenforce 04. 客户端配置验证# 备份原有仓库 [rootclient ~]# mkdir /etc/yum.repos.d/old [rootclient ~]# mv /etc/yum.repos.d/*repo /etc/yum.repos.d/old # 添加新仓库 [rootclient ~]# cat EOF /etc/yum.repos.d/tools.repo [tools] namecentos7 tools from server.laoma.cloud baseurlhttp://server.laoma.cloud/tools/ enabled1 gpgcheck0 EOF [rootclient ~]# ls /etc/yum.repos.d/ old tools.repo # 安装软件包 [rootclient ~]# yum install -y vim同步仓库# 将仓库中软件包和元数据全部同步到本地 [rootclient ~]# reposync --repoidtools --download-metadata [rootclient ~]# createrepo tools [rootclient ~]# ls tools/ Packages repodata参考 yum-REPOSYNC(8) 。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询