centos 8 安装一个lnmp环境

centos8 已经发布一段时间,今天体验下,在centos8下安装一个 lnmp 环境。感觉比centos7编译安装php方便点。好多软件的版本都升级,使用比较方便。

# author shelljiaoben.com


cat /etc/redhat-release
# CentOS Linux release 8.2.2004 (Core)

yum update -y

yum groupinstall "Development Tools" -y


yum install mysql mysql-server -y


systemctl start mysqld.service
# 1G内存 mysql占用 47%


dd if=/dev/zero of=/var/swap bs=2M count=1024
mkswap /var/swap
swapon /var/swap


yum install epel-release -y
dnf config-manager --set-enabled PowerTools
yum install libacl libacl-devel -y
yum install libxml2 libxml2-devel -y
yum install openssl openssl-devel -y
yum install sqlite sqlite-devel -y
yum install libcurl  libcurl-devel -y
yum install libpng libpng-devel -y
yum install libwebp libwebp-devel -y
yum install libjpeg libjpeg-devel -y
yum install oniguruma oniguruma-devel -y
yum install libzip libzip-devel -y


useradd wsite


cd ~
wget https://www.php.net/distributions/php-7.4.8.tar.gz

tar -zxvf php-7.4.8.tar.gz
cd php-7.4.8



./configure \
    --prefix=/usr/local/php748 \
    --enable-fpm \
    --with-fpm-user=nobody \
    --with-fpm-group=nobody \
    --with-fpm-acl \
    --enable-calendar \
    --with-iconv \
    --enable-mbstring \
    --enable-pcntl \
    --enable-soap \
    --enable-bcmath \
    --enable-gd \
    --with-webp \
    --with-jpeg \
    --disable-cgi \
    --with-curl \
    --enable-exif \
    --enable-ftp \
    --with-openssl \
    --with-pdo-sqlite \
    --with-pdo-mysql \
    --with-mysqli \
    --with-mysql-sock \
    --with-zip \
    --with-zlib \
    --with-zlib-dir 


make install



echo "PATH=\$PATH:/usr/local/php748/bin/:/usr/local/php748/sbin/" >> /etc/profile
. /etc/profile


cd ~

git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
git clone https://github.com/openresty/echo-nginx-module


wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar -xzvf nginx-1.18.0.tar.gz
cd nginx-1.18.0

yum install gd  gd-devel -y
yum install pcre-devel -y


./configure \
        --prefix=/usr/local/nginx \
    --conf-path=/etc/nginx/nginx.conf \
    --user=wsite \
    --group=wsite \
        --without-select_module \
        --without-http_autoindex_module \
        --with-poll_module \
        --with-http_ssl_module \
        --with-http_v2_module \
        --with-http_image_filter_module \
        --with-http_sub_module \
        --with-http_flv_module \
        --with-http_mp4_module \
        --with-http_gunzip_module \
        --with-http_auth_request_module \
        --with-http_random_index_module \
        --with-pcre \
        --with-openssl= \
        --with-http_realip_module \
        --with-http_addition_module \
        --with-http_gzip_static_module \
        --with-http_sub_module \
        --add-module=../ngx_http_substitutions_filter_module \
        --add-module=../echo-nginx-module 



make 
make install 



echo "PATH=\$PATH:/usr/local/nginx/sbin" >> /etc/profile
. /etc/profile

发表评论

电子邮件地址不会被公开。 必填项已用*标注