前言:
默认所有安装包下载至登录用户的/home/登录用户/目录下,即执行 cd ~
本次安装基于更多的实验目的,所以使用的版本都比较新,生产环境不推荐使用最新版本。请按需使用符合个人需求的版本
一、nginx 安装(使用版本:nginx-1.17.4)
1.下载官网:http://nginx.org/en/download.html
2.安装步骤:
wget http://nginx.org/download/nginx-1.17.4.tar.gz
tar zxvf nginx-1.17.4.tar.gz
cd nginx-1.17.4
./configure --prefix=/usr/local/nginx
make && make install
groupadd www
useradd -g www www -s /sbin/nologin
sed -i "s/#user nobody;/user www www;/g" /usr/local/nginx/conf/nginx.conf //修改nginx用户组
/usr/local/nginx/sbin/nginx
//设置开机自启
vi /lib/systemd/system/nginx.service
文件内容:
[Unit]
Description=nginx service
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl enable nginx
附:
添加自动后nginx的启动,重启,停用
systemctl start nginx
systemctl reload nginx
systemctl stop nginx
3./configure报错解决
缺少编译器,错误信息如下:
./configure: error: C compiler cc is not found
解决方法:
yum -y install gcc-c++ autoconf automake
PCRE缺失
/configure: error: the HTTP rewrite module requires the PCRE library.
解决方法:
yum -y install pcre pcre-devel
zlib缺失:
./configure: error: the HTTP gzip module requires the zlib library.
解决方法:
yum install zlib-devel
二、安装php(7.3.10)
1.下载官网:https://www.php.net/downloads.php
2.安装步骤:
wget https://www.php.net/distributions/php-7.3.10.tar.gz
tar zxvf php-7.3.10.tar.gz
cd php-7.3.10
./configure --prefix=/usr/local/php7.3.10 --with-mysql --with-pdo-mysql -with-mysqli --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/ --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp --with-iconv --disable-fileinfo
make && make install
cp /usr/local/php7.3.10/bin/php /usr/local/bin/
php-fpm添加开机自启
[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/php7.3.10/sbin/php-fpm
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3.报错解决:
libxml2缺失:
configure: error: libxml2 not found. Please check your libxml2 installation.
安装:yum install libxml2 libxml2-devel
OpenSSL缺失:
configure: error: Cannot find OpenSSL's <evp.h>
安装:yum install openssl openssl-devel
cUrl版本问题:
checking for cURL 7.15.5 or greater... configure: error: cURL version 7.15.5 or later is required to compile php with cURL support
yum install curl-devel
jpeglib.h缺失:
configure: error: jpeglib.h not found.
安装:yum install libjpeg libjpeg-devel
png.h缺失
configure: error: jpeglib.h not found.
yum install libpng libpng-devel
configure: error: freetype-config not found.
安装:yum install freetype-devel
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
安装:yum -y install libxslt libxslt-devel
configure: error: Please reinstall the libzip distribution
安装:yum install libzip libzip-devel
checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11
安装:
移除旧版本:yum remove -y libzip
安装新版本:
cd ~
yum remove -y libzip
wget https://libzip.org/download/libzip-1.5.2.tar.gz
tar zxvf libzip-1.5.2.tar.gz
cd libzip-1.5.2
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make
make install
cmake缺失安装:
yum install -y gcc gcc-c++
cd ~
wget https://cmake.org/files/v3.12/cmake-3.12.0-rc1.tar.gz
tar -zxvf cmake-3.12.0-rc1.tar.gz
cd cmake-3.12.0-rc1
./bootstrap
gmake
gmake install
三.mysql 安装(8.0.18)
1.官网: