1、创建自动安装脚本
这里我们使用 openresty来做讲解演示。 (OpenResty(又称:ngx_openresty) 是一个基于 NGINX 的可伸缩的 Web 平台,由中国人章亦春发起,提供了很多高质量的第三方模块)。
首先创建安装文件vim openresty.sh,将以下代码复制到安装文件里。
yum install -y pcre-devel openssl-devel gcc curlcd /home/softwget https://openresty.org/download/openresty-1.17.8.2.tar.gzcd /home/softtar -zxvf openresty-1.17.8.2.tar.gzcd /home/softmv openresty-1.17.8.2 openrestymkdir -p /home/soft/openresty-configcd /home/soft/openresty/./configure --prefix=/home/soft/openresty-config \--with-luajit \--without-http_redis2_module \--with-http_iconv_modulecd /home/soft/openresty/make && make install
2、赋予执行权限,并运行该文件
chmod +x openresty.sh./openresty.sh
3、配置环境变量
vim ~/.bash_profileexport PATH=/home/soft/openresty-config/nginx/sbin:$PATHsource ~/.bash_profile
4、运行
cd /home/soft/openresty-config/nginx/sbin./nginx
4、查看结果
访问http://47.104.146.31/,出现以下截图画面,即是正常。

