缘由:因为8.2版OO在docker下运行,无法接入api,用命令查看,发现提示以下错误,网友博主提示是因为docker版本低,那么只好升级docker,升级docker就要升级centos,升级centos后,删除已有docker,最好做一下镜像的备份,如果容器有修改,将容器导出为镜像保存。删除docker后,直接安装docker出错,需要清理,再安装。本文就是这么个过程。

首先,centos的升级有下面3种,我们选择第二种。
一、yum安装;二、安装指定内核版本rpm;三、源码安装。本文是第二种方式,rpm安装。

1 手动升级centos7内核(版本自行选择,亲测内核下载链接有效)

lianglove7

一、下载centos内核rpm安装包

查半天也没查出5.10.222是什么版本,反正能用最新的docker。
1.内核下载地址:https://dl.lamp.sh/kernel/el7/

wget https://dl.lamp.sh/kernel/el7/kernel-ml-5.10.222-1.el7.x86_64.rpm
wget https://dl.lamp.sh/kernel/el7/kernel-ml-devel-5.10.222-1.el7.x86_64.rpm

二、安装RPM包

yum localinstall -y kernel-ml-5.10.222-1.el7.x86_64.rpm kernel-ml-devel-5.10.222-1.el7.x86_64.rpm
#安装完毕后查看系统可用启动内核
awk -F\' '$1=="menuentry " {print  $2}' /etc/grub2.cfg

三、修改默认启动用的内核版本

默认启动项由/etc/default/grub中的GRUB_DEFAULT控制,可使用grub2-editenv list查看:

[root@localhost ~]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)

通过grub2-editenv list查看当前使用的内核,通过grub2-set-default命令修改启动用内核(通过内核名称设置)

[root@localhost ~]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
[root@localhost ~]# grub2-set-default 'CentOS Linux (5.10.222-1.el7.x86_64) 7 (Core)'
[root@localhost ~]# grub2-editenv list
saved_entry=CentOS Linux (5.10.222-1.el7.x86_64) 7 (Core)

重启并查看内核版本

[root@localhost ~]# reboot
#重启后使用命令查看当前内核版本
[root@localhost ~]# uname -r
5.10.222-1.el7.x86_64

原文链接:https://blog.csdn.net/lianglove7/article/details/143734553

四、实际操作过程记录

[root@localhost src]# wget https://dl.lamp.sh/kernel/el7/kernel-ml-5.10.222-1.el7.x86_64.rpm
--2025-03-11 10:38:33--  https://dl.lamp.sh/kernel/el7/kernel-ml-5.10.222-1.el7.x86_64.rpm
正在解析主机 dl.lamp.sh (dl.lamp.sh)... 192.99.37.188, 2607:5300:60:4cbc::1
正在连接 dl.lamp.sh (dl.lamp.sh)|192.99.37.188|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:57507844 (55M) [application/x-rpm]
正在保存至: “kernel-ml-5.10.222-1.el7.x86_64.rpm”

100%[============================================================================================================================>] 57,507,844  3.24MB/s 用时 18s    

2025-03-11 10:38:55 (3.10 MB/s) - 已保存 “kernel-ml-5.10.222-1.el7.x86_64.rpm” [57507844/57507844])

[root@localhost src]# 
[root@localhost src]# wget https://dl.lamp.sh/kernel/el7/kernel-ml-devel-5.10.222-1.el7.x86_64.rpm
--2025-03-11 10:39:16--  https://dl.lamp.sh/kernel/el7/kernel-ml-devel-5.10.222-1.el7.x86_64.rpm
正在解析主机 dl.lamp.sh (dl.lamp.sh)... 192.99.37.188, 2607:5300:60:4cbc::1
正在连接 dl.lamp.sh (dl.lamp.sh)|192.99.37.188|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:14178892 (14M) [application/x-rpm]
正在保存至: “kernel-ml-devel-5.10.222-1.el7.x86_64.rpm”

100%[============================================================================================================================>] 14,178,892  2.66MB/s 用时 6.0s   

2025-03-11 10:39:23 (2.24 MB/s) - 已保存 “kernel-ml-devel-5.10.222-1.el7.x86_64.rpm” [14178892/14178892])

[root@localhost src]# yum localinstall -y kernel-ml-5.10.222-1.el7.x86_64.rpm kernel-ml-devel-5.10.222-1.el7.x86_64.rpm
已加载插件:fastestmirror, langpacks
正在检查 kernel-ml-5.10.222-1.el7.x86_64.rpm: kernel-ml-5.10.222-1.el7.x86_64
kernel-ml-5.10.222-1.el7.x86_64.rpm 将被安装
正在检查 kernel-ml-devel-5.10.222-1.el7.x86_64.rpm: kernel-ml-devel-5.10.222-1.el7.x86_64
kernel-ml-devel-5.10.222-1.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 kernel-ml.x86_64.0.5.10.222-1.el7 将被 安装
---> 软件包 kernel-ml-devel.x86_64.0.5.10.222-1.el7 将被 安装
--> 解决依赖关系完成
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的名称或服务"
http://mirrors.163.com/centos/7.9.2009/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
正在尝试其它镜像。
To address this issue please refer to the below wiki article 

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

base/7/x86_64                                                                                                                                  | 3.6 kB  00:00:00     
docker-ce-stable/x86_64                                                                                                                        | 3.5 kB  00:00:00     
docker-ce-stable/x86_64/primary_db                                                                                                             | 152 kB  00:00:00     
epel/x86_64/metalink                                                                                                                           | 5.1 kB  00:00:00     
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的名称或服务"
http://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
正在尝试其它镜像。
extras/7/x86_64                                                                                                                                | 2.9 kB  00:00:00     
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的名称或服务"
updates/7/x86_64                                                                                                                               | 2.9 kB  00:00:00     

依赖关系解决

======================================================================================================================================================================
 Package                             架构                       版本                                 源                                                          大小
======================================================================================================================================================================
正在安装:
 kernel-ml                           x86_64                     5.10.222-1.el7                       /kernel-ml-5.10.222-1.el7.x86_64                           256 M
 kernel-ml-devel                     x86_64                     5.10.222-1.el7                       /kernel-ml-devel-5.10.222-1.el7.x86_64                      53 M

事务概要
======================================================================================================================================================================
安装  2 软件包

总计:308 M
安装大小:308 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : kernel-ml-devel-5.10.222-1.el7.x86_64                                                                                                             1/2 
  正在安装    : kernel-ml-5.10.222-1.el7.x86_64                                                                                                                   2/2 
  验证中      : kernel-ml-5.10.222-1.el7.x86_64                                                                                                                   1/2 
  验证中      : kernel-ml-devel-5.10.222-1.el7.x86_64                                                                                                             2/2 

已安装:
  kernel-ml.x86_64 0:5.10.222-1.el7                                              kernel-ml-devel.x86_64 0:5.10.222-1.el7                                             

完毕!
[root@localhost src]# 
[root@localhost src]# awk -F\' '$1=="menuentry " {print  $2}' /etc/grub2.cfg
CentOS Linux (5.10.222-1.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-a9324175f378456fbe6bda50a0e45a75) 7 (Core)
[root@localhost src]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)
[root@localhost src]# grub2-set-default 'CentOS Linux (5.10.222-1.el7.x86_64) 7 (Core)'
[root@localhost src]# grub2-editenv list
saved_entry=CentOS Linux (5.10.222-1.el7.x86_64) 7 (Core)
[root@localhost src]# reboot

https://www.cnblogs.com/guuyoog/p/17666449.html

2 解决yum报错:错误:Invalid version flag: if

1. 备份默认的yum:

mv /etc/yum.repos.d /etc/yum.repos.d.backup

2. 设置新的yum目录:

mkdir /etc/yum.repos.d

3. 下载阿里yum配置到该目录中,用wget,进行下载

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

4. 重建缓存

yum clean all
yum makecache

5. 升级所有包

yum upgrade -y
下面这2步没做
yum -y update:升级所有包同时,也升级软件和系统内核;(时间比较久)
yum -y upgrade:只升级所有包,不升级软件和系统内核,软件和内核保持原样

原文链接:https://blog.csdn.net/weixin_56781779/article/details/132258636

3 CentOS安装Docker

Docker CE 支持 64 位版本 CentOS 7,并且要求内核版本不低于 3.10, CentOS 7 满足最低内核的要求,所以我们在CentOS 7安装Docker。

3.1.卸载(可选)

如果之前安装过旧版本的Docker,可以使用下面命令卸载:

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine \
                  docker-ce

3.2.安装docker

首先需要大家虚拟机联网,安装yum工具

yum install -y yum-utils \
           device-mapper-persistent-data \
           lvm2 --skip-broken

然后更新本地镜像源:

# 设置docker镜像源
yum-config-manager \
    --add-repo \
    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
yum makecache fast

然后输入命令:
yum install -y docker-ce
docker-ce为社区免费版本。稍等片刻,docker即可安装成功。

3.3.启动docker

Docker应用需要用到各种端口,逐一去修改防火墙设置。非常麻烦,因此建议大家直接关闭防火墙!
启动docker前,一定要关闭防火墙后!!
启动docker前,一定要关闭防火墙后!!
启动docker前,一定要关闭防火墙后!!

# 关闭防火墙
`systemctl stop firewalld`
# 禁止开机启动防火墙
`systemctl disable firewalld`
查看docker是否启动
`docker images`

通过命令启动docker:

systemctl start docker  # 启动docker服务
systemctl stop docker  # 停止docker服务
systemctl restart docker  # 重启docker服务

如果启动时出现错误
提示:Job for docker.service failed because the control process exited with error code. See “systemctl status docker.service” and “journalctl -xe” for details.

# 进入docker目录
`cd /etc/docker/`
# 修改daemon的类型
`mv daemon.json daemon.conf`
# 重启docker
`systemctl restart docker`
然后输入命令,可以查看docker版本:
`docker -v`

3.4.配置镜像加速

阿里云
docker官方镜像仓库网速较差,我们需要设置国内镜像服务:
参考阿里云的镜像加速文档:
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
腾讯云
配置使用腾讯云 Docker 镜像源加速镜像下载(可跳过)
执行以下命令,打开 /etc/docker/daemon.json 配置文件
vim /etc/docker/daemon.json
按 i 切换至编辑模式,添加以下内容,并保存。
{ "registry-mirrors": [ "https://mirror.ccs.tencentyun.com" ] }
重启Dockersystemctl restart docker
我的安装过程如下:

替代:
  caribou.x86_64 0:0.4.21-1.el7                              caribou-gtk2-module.x86_64 0:0.4.21-1.el7       caribou-gtk3-module.x86_64 0:0.4.21-1.el7               
  gnome-dictionary-libs.x86_64 0:3.20.0-1.el7                gnome-tweak-tool.noarch 0:3.22.0-1.el7          grub2.x86_64 1:2.02-0.65.el7.centos.2                   
  grub2-tools.x86_64 1:2.02-0.65.el7.centos.2                iwl7265-firmware.noarch 0:22.0.7.0-62.el7       mesa-libwayland-egl.x86_64 0:17.2.3-8.20171019.el7      
  pyatspi.noarch 0:2.20.3-1.el7                              python2-caribou.noarch 0:0.4.21-1.el7           urw-fonts.noarch 0:2.4-16.el7                           
  webkitgtk4-plugin-process-gtk2.x86_64 0:2.16.6-6.el7      

完毕!
[root@localhost ~]# sudo 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@localhost ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo: [Errno 14] curl#35 - "TCP connection reset by peer"
[root@localhost ~]# sudo yum install docker-ce docker-ce-cli containerd.io -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
没有可用软件包 docker-ce。
没有可用软件包 docker-ce-cli。
没有可用软件包 containerd.io。
错误:无须任何处理

[root@localhost ~]# sudo yum install -y yum-utils device-mapper-persistent-data lvm2
已加载插件: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 已安装并且是最新版本
软件包 device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64 已安装并且是最新版本
软件包 7:lvm2-2.02.187-6.el7_9.5.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo: [Errno 14] curl#35 - "TCP connection reset by peer"
[root@localhost ~]# docker
bash: docker: 未找到命令...

[root@localhost ~]# yum-config-manager \
>     --add-repo \
>     https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo

yum makecache fast
已加载插件:fastestmirror, langpacks
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

[root@localhost ~]# sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo

[root@localhost ~]# yum makecache fast
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                           | 3.6 kB  00:00:00
docker-ce-stable                                                                                                                               | 3.5 kB  00:00:00
extras                                                                                                                                         | 2.9 kB  00:00:00
updates                                                                                                                                        | 2.9 kB  00:00:00
元数据缓存已建立
[root@localhost ~]# yum install -y docker-ce
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-ce.x86_64.3.26.1.4-1.el7 将被 安装
--> 正在处理依赖关系 container-selinux >= 2:2.74,它被软件包 3:docker-ce-26.1.4-1.el7.x86_64 需要
--> 正在处理依赖关系 containerd.io >= 1.6.24,它被软件包 3:docker-ce-26.1.4-1.el7.x86_64 需要
--> 正在处理依赖关系 docker-ce-cli,它被软件包 3:docker-ce-26.1.4-1.el7.x86_64 需要
--> 正在处理依赖关系 docker-ce-rootless-extras,它被软件包 3:docker-ce-26.1.4-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.119.2-1.911c772.el7_8 将被 安装
---> 软件包 containerd.io.x86_64.0.1.6.33-3.1.el7 将被 安装
---> 软件包 docker-ce-cli.x86_64.1.26.1.4-1.el7 将被 安装
--> 正在处理依赖关系 docker-buildx-plugin,它被软件包 1:docker-ce-cli-26.1.4-1.el7.x86_64 需要
--> 正在处理依赖关系 docker-compose-plugin,它被软件包 1:docker-ce-cli-26.1.4-1.el7.x86_64 需要
---> 软件包 docker-ce-rootless-extras.x86_64.0.26.1.4-1.el7 将被 安装
--> 正在处理依赖关系 fuse-overlayfs >= 0.7,它被软件包 docker-ce-rootless-extras-26.1.4-1.el7.x86_64 需要
--> 正在处理依赖关系 slirp4netns >= 0.4,它被软件包 docker-ce-rootless-extras-26.1.4-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 docker-buildx-plugin.x86_64.0.0.14.1-1.el7 将被 安装
---> 软件包 docker-compose-plugin.x86_64.0.2.27.1-1.el7 将被 安装
---> 软件包 fuse-overlayfs.x86_64.0.0.7.2-6.el7_8 将被 安装
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.2)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.0)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3()(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
---> 软件包 slirp4netns.x86_64.0.0.4.3-4.el7_8 将被 安装
--> 正在检查事务
---> 软件包 fuse3-libs.x86_64.0.3.6.1-4.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

======================================================================================================================================================================
 Package                                       架构                       版本                                             源                                    大小
======================================================================================================================================================================
正在安装:
 docker-ce                                     x86_64                     3:26.1.4-1.el7                                   docker-ce-stable                      27 M
为依赖而安装:
 container-selinux                             noarch                     2:2.119.2-1.911c772.el7_8                        extras                                40 k
 containerd.io                                 x86_64                     1.6.33-3.1.el7                                   docker-ce-stable                      35 M
 docker-buildx-plugin                          x86_64                     0.14.1-1.el7                                     docker-ce-stable                      14 M
 docker-ce-cli                                 x86_64                     1:26.1.4-1.el7                                   docker-ce-stable                      15 M
 docker-ce-rootless-extras                     x86_64                     26.1.4-1.el7                                     docker-ce-stable                     9.4 M
 docker-compose-plugin                         x86_64                     2.27.1-1.el7                                     docker-ce-stable                      13 M
 fuse-overlayfs                                x86_64                     0.7.2-6.el7_8                                    extras                                54 k
 fuse3-libs                                    x86_64                     3.6.1-4.el7                                      extras                                82 k
 slirp4netns                                   x86_64                     0.4.3-4.el7_8                                    extras                                81 k

事务概要
======================================================================================================================================================================
安装  1 软件包 (+9 依赖软件包)

总下载量:114 M
安装大小:401 M
Downloading packages:
No Presto metadata available for docker-ce-stable
(1/10): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                                   |  40 kB  00:00:04     
(2/10): docker-buildx-plugin-0.14.1-1.el7.x86_64.rpm                                                                                           |  14 MB  00:00:12     
(3/10): containerd.io-1.6.33-3.1.el7.x86_64.rpm                                                                                                |  35 MB  00:00:25     
(4/10): docker-ce-26.1.4-1.el7.x86_64.rpm                                                                                                      |  27 MB  00:00:15     
(5/10): docker-ce-rootless-extras-26.1.4-1.el7.x86_64.rpm                                                                                      | 9.4 MB  00:00:05     
(6/10): docker-ce-cli-26.1.4-1.el7.x86_64.rpm                                                                                                  |  15 MB  00:00:08     
(7/10): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                                                                                                |  54 kB  00:00:03     
(8/10): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                                                      |  82 kB  00:00:03     
(9/10): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                                                   |  81 kB  00:00:00     
(10/10): docker-compose-plugin-2.27.1-1.el7.x86_64.rpm                                                                                         |  13 MB  00:00:05     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                  2.9 MB/s | 114 MB  00:00:38     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                               1/10 
  正在安装    : containerd.io-1.6.33-3.1.el7.x86_64                                                                                                              2/10 
  正在安装    : docker-buildx-plugin-0.14.1-1.el7.x86_64                                                                                                         3/10 
  正在安装    : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                 4/10 
  正在安装    : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                    5/10 
  正在安装    : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                              6/10 
  正在安装    : docker-compose-plugin-2.27.1-1.el7.x86_64                                                                                                        7/10 
  正在安装    : 1:docker-ce-cli-26.1.4-1.el7.x86_64                                                                                                              8/10 
  正在安装    : docker-ce-rootless-extras-26.1.4-1.el7.x86_64                                                                                                    9/10 
  正在安装    : 3:docker-ce-26.1.4-1.el7.x86_64                                                                                                                 10/10 
  验证中      : docker-compose-plugin-2.27.1-1.el7.x86_64                                                                                                        1/10 
  验证中      : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                    2/10 
  验证中      : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                              3/10 
  验证中      : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                 4/10 
  验证中      : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                               5/10 
  验证中      : containerd.io-1.6.33-3.1.el7.x86_64                                                                                                              6/10 
  验证中      : 3:docker-ce-26.1.4-1.el7.x86_64                                                                                                                  7/10 
  验证中      : 1:docker-ce-cli-26.1.4-1.el7.x86_64                                                                                                              8/10 
  验证中      : docker-ce-rootless-extras-26.1.4-1.el7.x86_64                                                                                                    9/10 
  验证中      : docker-buildx-plugin-0.14.1-1.el7.x86_64                                                                                                        10/10 

已安装:
  docker-ce.x86_64 3:26.1.4-1.el7

作为依赖被安装:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8        containerd.io.x86_64 0:1.6.33-3.1.el7                  docker-buildx-plugin.x86_64 0:0.14.1-1.el7
  docker-ce-cli.x86_64 1:26.1.4-1.el7                       docker-ce-rootless-extras.x86_64 0:26.1.4-1.el7        docker-compose-plugin.x86_64 0:2.27.1-1.el7
  fuse-overlayfs.x86_64 0:0.7.2-6.el7_8                     fuse3-libs.x86_64 0:3.6.1-4.el7                        slirp4netns.x86_64 0:0.4.3-4.el7_8

完毕!
[root@localhost ~]# yum install -y docker-ce
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
软件包 3:docker-ce-26.1.4-1.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# systemctl start docker

4 协作页面提示下载失败

页面打开文档协作,提示下载失败,是因为OO里的default文件需要更改允许下载私有ip服务器上的文件
Error: DNS lookup 192.168.100.37(family:undefined, host:undefined) is not allowed. Because, It is private IP address.
https://www.cnblogs.com/wxwgk/p/17982561
https://blog.csdn.net/m0_53401243/article/details/133869439

[root@localhost engineercms]# docker logs -f 826
Generating WOPI private key...Done
Generating WOPI public key...Done
[ OK ]rting PostgreSQL 14 database server        
[ OK ]rting RabbitMQ Messaging Server rabbitmq-server        
psql:/var/www/onlyoffice/documentserver/server/schema/postgresql/removetbl.sql:4: NOTICE:  table "doc_callbacks" does not exist, skipping
psql:/var/www/onlyoffice/documentserver/server/schema/postgresql/removetbl.sql:9: NOTICE:  function merge_db(pg_catalog.varchar,int2,int8,pg_catalog.timestamp,pg_catalog.varchar,int8,int8) does not exist, skipping
psql:/var/www/onlyoffice/documentserver/server/schema/postgresql/removetbl.sql:10: NOTICE:  function merge_db(pg_catalog.varchar,int2,int4,pg_catalog.timestamp,pg_catalog.varchar,int4,int4) does not exist, skipping
psql:/var/www/onlyoffice/documentserver/server/schema/postgresql/removetbl.sql:11: NOTICE:  function merge_db(pg_catalog.varchar,int2,int4,pg_catalog.timestamp,int4,int4,text,text) does not exist, skipping
Starting supervisor: supervisord.
[ OK ]rting periodic command scheduler cron        
[ OK ]rting nginx nginx        
Generating AllFonts.js, please wait...Done
Generating presentation themes, please wait...Done
Generating js caches, please wait...Done
/usr/bin/documentserver-generate-allfonts.sh: 65: /var/www/onlyoffice/documentserver/sdkjs/slide/themes/themes.js.gz: not found
ds:docservice: stopped
ds:docservice: started
ds:converter: stopped
ds:converter: started
[ OK ]oading nginx configuration nginx        
Installing plugins, please wait...Done
[ OK ]oading nginx configuration nginx        
JWT is enabled by default. A random secret is generated automatically. Run the command "docker exec 826ce03a8378 sudo documentserver-jwt-status.sh" to get information about JWT.
==> /var/log/onlyoffice/documentserver/converter/err.log <==

==> /var/log/onlyoffice/documentserver/converter/out.log <==
[2025-03-11T06:16:58.020] [WARN] [localhost] [docId] [userId] nodeJS - num of CPUs: 4; availableParallelism: undefined
[2025-03-11T06:16:58.035] [WARN] [localhost] [docId] [userId] nodeJS - update cluster with 1 workers
[2025-03-11T06:16:58.065] [WARN] [localhost] [docId] [userId] nodeJS - worker 786 started.
[2025-03-11T06:16:58.079] [WARN] [localhost] [docId] [userId] nodeJS - num of CPUs: 4; availableParallelism: undefined
[2025-03-11T06:16:58.080] [WARN] [localhost] [docId] [userId] nodeJS - update cluster with 1 workers
[2025-03-11T06:17:51.380] [WARN] [localhost] [docId] [userId] nodeJS - num of CPUs: 4; availableParallelism: undefined
[2025-03-11T06:17:51.384] [WARN] [localhost] [docId] [userId] nodeJS - update cluster with 1 workers
[2025-03-11T06:17:51.393] [WARN] [localhost] [docId] [userId] nodeJS - worker 909 started.
[2025-03-11T06:17:51.394] [WARN] [localhost] [docId] [userId] nodeJS - num of CPUs: 4; availableParallelism: undefined
[2025-03-11T06:17:51.395] [WARN] [localhost] [docId] [userId] nodeJS - update cluster with 1 workers

==> /var/log/onlyoffice/documentserver/docservice/err.log <==

==> /var/log/onlyoffice/documentserver/docservice/out.log <==
[2025-03-11T06:16:59.495] [WARN] [localhost] [docId] [userId] nodeJS - Express server starting...
[2025-03-11T06:16:59.497] [WARN] [localhost] [docId] [userId] nodeJS - Set services.CoAuthoring.token.enable.browser, services.CoAuthoring.token.enable.request.inbox, services.CoAuthoring.token.enable.request.outbox in the Document Server config to prevent an unauthorized access to your documents and the substitution of important parameters in Document Server requests.
[2025-03-11T06:16:59.498] [WARN] [localhost] [docId] [userId] nodeJS - Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability
[2025-03-11T06:16:59.694] [WARN] [localhost] [docId] [userId] nodeJS - Express server listening on port 8000 in production-linux mode. Version: 8.2.0. Build: 1
[2025-03-11T06:17:50.544] [WARN] [localhost] [docId] [userId] nodeJS - Express server starting...
[2025-03-11T06:17:50.546] [WARN] [localhost] [docId] [userId] nodeJS - Set services.CoAuthoring.token.enable.browser, services.CoAuthoring.token.enable.request.inbox, services.CoAuthoring.token.enable.request.outbox in the Document Server config to prevent an unauthorized access to your documents and the substitution of important parameters in Document Server requests.
[2025-03-11T06:17:50.547] [WARN] [localhost] [docId] [userId] nodeJS - Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability
[2025-03-11T06:17:50.694] [WARN] [localhost] [docId] [userId] nodeJS - Express server listening on port 8000 in production-linux mode. Version: 8.2.0. Build: 1

==> /var/log/onlyoffice/documentserver/nginx.error.log <==
2025/03/11 06:31:17 [error] 10008#10008: *5 open() "/var/www/onlyoffice/documentserver/web-apps/vendor/socketio/socket.io.min.js.map" failed (2: No such file or directory), client: 192.168.9.13, server: , request: "GET /8.2.0-fe3258694c051949279b3285420cfca5/web-apps/vendor/socketio/socket.io.min.js.map HTTP/1.1", host: "192.168.100.37:9002"

==> /var/log/onlyoffice/documentserver/converter/out.log <==
[2025-03-11T06:31:22.771] [ERROR] [localhost] [1741224439356100011] [0] nodeJS - error downloadFile:url=http://192.168.100.37/attachment/onlyoffice/广州东部水源工程文件领号登记v9.docx?hotqinsessionid=;attempt=1;code:null;connect:null Error: DNS lookup 192.168.100.37(family:undefined, host:undefined) is not allowed. Because, It is private IP address.
    at validateIPAddress (/snapshot/server/Common/node_modules/request-filtering-agent/lib/request-filtering-agent.js:71:20)
    at Socket.<anonymous> (/snapshot/server/Common/node_modules/request-filtering-agent/lib/request-filtering-agent.js:125:29)
    at Object.onceWrapper (node:events:641:28)
    at Socket.emit (node:events:539:35)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1173:10)
[2025-03-11T06:31:23.780] [ERROR] [localhost] [1741224439356100011] [0] nodeJS - error downloadFile:url=http://192.168.100.37/attachment/onlyoffice/广州东部水源工程文件领号登记v9.docx?hotqinsessionid=;attempt=2;code:null;connect:null Error: DNS lookup 192.168.100.37(family:undefined, host:undefined) is not allowed. Because, It is private IP address.

[root@localhost engineercms]# docker exec -it 826 /bin/bash
root@826ce03a8378:/# ls
app        bin   dev  home  lib32  libx32  mnt  proc  run   sqlplus.zip  sys  usr
basic.zip  boot  etc  lib   lib64  media   opt  root  sbin  srv          tmp  var
root@826ce03a8378:/# cd etc
root@826ce03a8378:/etc# cd onlyoffice
root@826ce03a8378:/etc/onlyoffice# cd documentserver
root@826ce03a8378:/etc/onlyoffice/documentserver# ls
default.json            development-mac.json      local.json  logrotate  production-linux.json
development-linux.json  development-windows.json  log4js      nginx      production-windows.json
root@826ce03a8378:/etc/onlyoffice/documentserver# exit
exit
[root@localhost engineercms]# docker cp 826:/etc/onlyoffice/documentserver/default.json ./
                                               Successfully copied 18.9kB to /usr/src/engineercms/./
[root@localhost engineercms]# docker cp ./default.json 826:/etc/onlyoffice/documentserver/default.json
                                             Successfully copied 18.9kB to 826:/etc/onlyoffice/documentserver/default.json
[root@localhost engineercms]# docker restart 826
826
[root@localhost engineercms]#

5 服务端接口调整

从5.3到现在的8.3,OnlyOffice的API接口最大的变化是documentType,变成了word,cell,slide和pdf,其他可以不动,但是要禁止token。否则要在服务端开发好token。前端协作页面,如果带有历史版本对比功能的,要调整,接口应该也发生了变化,如果不改变,则导致word协作页面无法编辑,excel不受影响。

作者:秦晓川  创建时间:2025-03-11 11:05
最后编辑:秦晓川  更新时间:2025-03-14 15:22
上一篇:
下一篇: