【原】LNMP编译安装
in 备忘 with 2 comments

【原】LNMP编译安装

in 备忘 with 2 comments

常用的LANMP一键安装包有Oneinstack和LNMP一键安装包,如果遇到新版本的安装问题可以参照一键安装包脚本

关闭SELinux[Ubuntu默认没有安装SELinux]

vim /etc/selinux/config
SELINUX=disabled

允许防火墙80端口访问

iptables  -Ziptables  -X4

安装各必要组件

yum -y install make pcre-devel cmake gcc gcc-c++ flex bison libaio file libtool libtool-libs autoconf kernel-devel patch wget libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel unzip tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl libjpeg libjpeg-devel libpng libpng-devel curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel aspell-devel libcap diffutils net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel freetype-devel libxslt libxslt-devel

编译安装PHP7.1

./configure --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-gd --enable-gd-native-ttf --with-freetype-dir --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-xsl --prefix=/opt/php --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-gd-jis-conv
make
make install

* 安装完记得将php.ini移动到指定目录
* 安装完记得修改php-fpm的配置文件
* 安装完记得启动php-fpm

编译安装PHP7.2

./configure --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-gd --with-freetype-dir --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-xsl --prefix=/opt/php --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-gd-jis-conv
make
make install

* 安装完记得将php.ini移动到指定目录
* 安装完记得修改php-fpm的配置文件
* 安装完记得启动php-fpm

编译安装Nginx

./configure --prefix=/opt/nginx --user=www --group=www --error-log-path=/usr/local/log/nginx_error.log --with-http_mp4_module --with-http_flv_module --pid-path=/var/run/nginx.pid --with-http_ssl_module
location ~ \.php$ {            
    root           html;           
    fastcgi_pass   127.0.0.1:9000;            
    fastcgi_index  index.php;            
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;           
    include        fastcgi_params;
}

安装MySQL(centos)这里使用Yum安装。

** 当前示例只支持64位系统,别的系统的rpm包请去MySQL官网获取
wget http://mirrors.ustc.edu.cn/mysql-repo/mysql80-community-release-el7-1.noarch.rpm
rpm -Uvh mysql80-community-release-el7-1.noarch.rpm
// 找出maria相关的包
rpm -qa | grep mariadb

// 移除上面找出的mariadb的包
yum erase -y mariadb*

// 最后在检查下还有没有mariadb
rpm -qa | grep mariadb
// 禁用MySQL模块
yum module disable mysql

// 如果出现下载速度慢,可以杀掉进程,重新install,会快很多
yum install mysql-community-server
systemctl start mysqld.service
# 查看默认密码
grep 'temporary password' /var/log/mysqld.log
# 修改默认密码,先登录再修改
mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
systemctl enable mysqld.service

判断是否编译完成

需要注意的

Comments are closed.
  1. rx

  2. 喵喵