当前位置: 首页 > news >正文

【内网】服务器升级nginx1.17.0

今天用rpm包升级内网nginx版本,上来就给我报错

警告:nginx-1.27.0-2.el7.ngx.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 7bd9bf62: NOKEY
错误:依赖检测失败:
    libcrypto.so.10()(64bit) 被 nginx-1:1.27.0-2.el7.ngx.x86_64 需要
    libcrypto.so.10(OPENSSL_1.0.2)(64bit) 被 nginx-1:1.27.0-2.el7.ngx.x86_64 需要
    libcrypto.so.10(libcrypto.so.10)(64bit) 被 nginx-1:1.27.0-2.el7.ngx.x86_64 需要
    libssl.so.10()(64bit) 被 nginx-1:1.27.0-2.el7.ngx.x86_64 需要
    libssl.so.10(libssl.so.10)(64bit) 被 nginx-1:1.27.0-2.el7.ngx.x86_64 需要

根据文章error: Failed dependencies libcrypto.so.10()(64bit) is needed, libssl.so.10()(64bit) is needed-CSDN博客 去

https://pkgs.org/download/libcrypto.so.10()(64bit)

 下载新的包并且安装

然后又报了新的错

file /etc/logrotate.d/nginx from install of nginx-1:1.27.0-2.el7.ngx.x86_64 conflicts with file from package nginx-1:1.21.5-2.p01.ky10.x86_64
    file /etc/nginx/nginx.conf from install of nginx-1:1.27.0-2.el7.ngx.x86_64 conflicts with file from package nginx-1:1.21.5-2.p01.ky10.x86_64
    file /usr/lib/systemd/system/nginx.service from install of nginx-1:1.27.0-2.el7.ngx.x86_64 conflicts with file from package nginx-1:1.21.5-2.p01.ky10.x86_64
    file /usr/sbin/nginx from install of nginx-1:1.27.0-2.el7.ngx.x86_64 conflicts with file from package nginx-1:1.21.5-2.p01.ky10.x86_64
    file /usr/share/nginx/html/50x.html from install of nginx-1:1.27.0-2.el7.ngx.x86_64 conflicts with file from package nginx-1:1.21.5-2.p01.ky10.x86_64
    file /usr/share/nginx/html/index.html from install of nginx-1:1.27.0-2.el7.ngx.x86_64 conflicts with file from package nginx-1:1.21.5-2.p01.ky10.x86_64
    file /var/log/nginx from install of nginx-1:1.27.0-2.el7.ngx.x86_64 conflicts with file from package nginx-1:1.21.5-2.p01.ky10.x86_64

 看意思是旧的nginx包依赖和新的包依赖冲突了

把旧的依赖包删了安装新的依赖包


整合脚本如下

#!/bin/bash# 定义rpm包文件名
RPM_FILE="nginx-1.27.0-2.el7.ngx.x86_64.rpm"# 检查是否为root用户
if [ "$EUID" -ne 0 ]; thenecho "请使用root权限运行此脚本。"exit 1
fi# 检查RPM文件是否存在
if [ ! -f "$RPM_FILE" ]; thenecho "找不到文件 $RPM_FILE。请确保文件存在并重试。"exit 1
fi# 备份当前配置文件
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
cp -r /usr/lib64/nginx/modules/ /usr/lib64/nginx/modules_bak/
rm -rf modules# 安装依赖
rpm -ivh "compat-openssl10-1.0.2o-8.ky10.x86_64.rpm"
echo "正在安装nginx..."# 依赖包覆盖安装新的nginx
rpm -ivh --replacefiles "$RPM_FILE"
# 检查安装是否成功
if [ $? -eq 0 ]; thenecho "nginx安装成功!"
elseecho "nginx安装失败。请检查错误信息。"exit 1
fi# 启动nginx服务
echo "正在启动nginx服务..."/usr/sbin/nginx -c /etc/nginx/nginx.conf
/usr/sbin/nginx -s reload
systemctl daemon-reload
systemctl restart nginx# 设置nginx开机自启动
echo "正在设置nginx开机自启动..."
systemctl enable nginxecho "nginx安装和配置完成。"

http://www.lryc.cn/news/425886.html

相关文章:

  • 歌曲爬虫下载
  • transformer-explainer
  • C#中的S7协议
  • 2024-08-16升级记录:使用Android RecyclerView控件显示列表型信息
  • 通义千问 ( 一 ) 基础实例
  • docker 修改数据目录
  • r4s软路由写入iStoreOS镜像
  • [C++][opencv]基于opencv实现photoshop算法灰度化图像
  • Emacs23.x版本之重要特性及用法实例(一百五十六)
  • 机器学习 第11章-特征选择与稀疏学习
  • Grok 2携AI图片生成重生
  • 使用Nexus搭建Maven私服仓库
  • 云计算day27
  • 关于HTTP HEAD介绍
  • WPF Mvvm
  • pnpm【实用教程】2024最新版
  • C#的前沿技术有哪些?
  • Vue2移动端(H5项目)项目基于vant封装图片上传组件(支持批量上传、单个上传、回显、删除、预览、最大上传数等功能)---解决批量上传问题
  • ELK整合实战,filebeat和logstash采集SpringBoot项目日志发送至ES
  • 网络编程:OSI协议,TCP/IP协议,IP地址,UDP编程
  • QtExa001自动包装流水线的框架设计vs2019QT
  • SpringBoot拦截器的使用介绍
  • Spring Boot应用中的资源分离与高效打包实践
  • 分析 avformat_open_input 数据读取过程
  • Apache HOP (Hop Orchestration Platform) VS Data Integration (通常被称为 Kettle)
  • 如何判断一个dll/exe是32位还是64位
  • 加速网页加载,提升用户体验:HTML、JS 和 Vue 项目优化全攻略
  • LVS服务器基础环境配置
  • 【Python OpenCV】使用OpenCV实现两张图片拼接
  • springboot jar -jar centos后台运行的几种方式