一,下载所需安装包
LNMP2.2
OpenCloudOS-9.0-minimal-x86_64.iso
二,在Win11 Hyper-v上安装 OpenCloudOS-9.0
安装完成后进如系统
执行:yum update -y
执行:yum install wget -y
三,将LNMP2.2上传到你想要的目录,这里我放到了 /home/目录下;或者直接使用官网的连续命令下载
如果是自己上传到服务器上的,需要执行
chmod -R +x /home/lnmp2.2/*.sh
chmod +x /home/lnmp2.2/include/*
四,我安装的是 10: Install MariaDB 10.11.7 ,由于下载太慢,直接用迅雷下载号了,直接上传到 lnmp2.2/src目录了
Nginx 默认是 1.26.0
PHP 我选的是 8.3.7
MariaDB 10.11.7
五,执行安装
不出意外就可以完成了。
意外情况:
1,PHP 安装失败 提示类似以下错误:
checking whether to build with LIBXML support... yes checking for libxml-2.0 >= 2.9.0... no configure: error: Package requirements (libxml-2.0 >= 2.9.0) were not met: Package 'libxml-2.0', required by 'virtual:world', not found
执行以下命令,
pkg-config --modversion libxml-2.0
如果命令成功返回版本号(例如 2.11.5),则表明问题已解决,如显示的不是版本号,那么应该就是 版本不对或者没有安装成功。
输入 xml2-config --version 后显示版本号 并不代表 libxml2-devel 安装成功了。
sudo yum clean all
sudo yum update
sudo yum install libxml2-devel
我第一次执行安装 libxml2-devel后显示的是以下内容
file /usr/share/doc/xz/AUTHORS from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/NEWS from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/README from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/THANKS from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/annotated.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/base_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/bcj_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/block_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/check_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/classes.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/container_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/delta_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/dir_b17a1d403082bd69a703ed987cf158fb.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/doxygen.css from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/files.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/filter_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/functions.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/functions_vars.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/globals.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/globals_defs.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/globals_enum.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/globals_eval.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/globals_func.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/globals_type.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/hardware_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/index.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/index_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/index__hash_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/lzma12_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/lzma_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/stream__flags_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__allocator.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__block.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__filter.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__index__iter.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__mt.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__options__bcj.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__options__delta.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__options__lzma.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__stream.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/structlzma__stream__flags.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/tabs.css from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/version_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/api/vli_8h.html from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/lzma-file-format.txt from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64 file /usr/share/doc/xz/xz-file-format.txt from install of xz-devel-5.4.7-6.oc9.x86_64 conflicts with file from package xz-5.4.4-1.oc9.x86_64
再次执行检查 是否已经正确输出版本号
pkg-config --modversion libxml-2.0
如果还不行,就执行卸载
sudo yum remove libxml2-devel -y
sudo yum remove xz -y
sudo yum remove xz-devel -y
在执行安装 (我是到这一步才成功的)
sudo yum install libxml2-devel
2,Nginx安装失败
最先想到的是用最新版的Nginx 1.28.0
如果是Nginx里出现拼写错误
我是修改/home/lnmp2.2/include/nginx.sh 在Install_Nginx()方法里 109行作用加入以下代码
if [ -f "${cur_dir}/src/nginx-${Nginx_Ver}/src/os/unix/ngx_process.c" ]; then
# 修复拼写错误
sed -i 's/tatic int/ static int/' "${cur_dir}/src/nginx-${Nginx_Ver}/src/os/unix/ngx_process.c"
# 修复逻辑错误
sed -i 's/while (&tv\[0\])/while (1)/' "${cur_dir}/src/nginx-${Nginx_Ver}/src/os/unix/ngx_process.c"
fi
保存后, 先卸载之前安装的lnmp,重启系统,再重新安装lnmp2.2 至此成功