#!/bin/bash
soft_num=0
yum install -y vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools iotop bc zip unzip zlib-devel bash-completion nfs-utils automake libxml2 libxml2-devel libxslt libxslt-devel perl perl-ExtUtils-Embed
for i in vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools iotop bc zip unzip zlib-devel bash-completion nfs-utils automake libxml2 libxml2-devel libxslt libxslt-devel perl perl-ExtUtils-Embed
do
let soft_num++
done
echo $soft_num
sleep 5
rpm -q vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools iotop bc zip unzip zlib-devel bash-completion nfs-utils automake libxml2 libxml2-devel libxslt libxslt-devel perl perl-ExtUtils-Embed | wc -l
sleep 5
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.18.0.tar.gz -O /usr/local/src/nginx-1.18.0.tar.gz
tar xf nginx-1.18.0.tar.gz
cd nginx-1.18.0
./configure --prefix=/apps/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module
make && make install
id nginx || useradd nginx -s /sbin/nologin -u 2000
chown nginx.nginx -R /apps/nginx
cat > /usr/lib/systemd/system/nginx.service << EOF
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF
echo "PATH=/apps/nginx/sbin/:$PATH" > /etc/profile.d/nginx.sh
source /etc/profile.d/nginx.sh
sed -Ei '/#pid/s/logs/\/run/' /tmp/nginx.conf
sed -Ei.bak '/#user/s/nobody/nginx nginx/' /tmp/nginx.conf
nginx1.18 centos7 编译安装脚本
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
虚拟机安装CentOS7
本章节我们将学习如何安装创建一个Linux学习环境。
CentOS VMware 云计算 系统 运维 -
Centos7安装python3.12
centos7 安装高版本的python3.12的方法和过程;
python 软链接 python3 -
编译安装nginx1.18
编译安装nginx1.18
编译安装nginx1.18 -
编译安装nginx centos7
centos7下编译安装nginx
centos7 nginx编译安装 -
nginx的编译安装 centos7
nginx 编译安装 centos7 简单 明了 献丑了
nginx; 编译安装 centos7 -
Centos7上Nginx的编译安装
Centos7上Nginx的编译安装 添加第三方Nginx模块
Centos7上Nginx的编译安装 -
centos7 nginx1.18安装教程
centos7 nginx1.18安装教程
nginx c++ linux ip地址 80端口