编译安装centos7 php7.2 mysql5.7 nginx1.9.9

时间:2022-01-24 10:00:37

2018年3月12日 14:09:39

注意时效

centos7

网卡

cd /etc/sysconfig/network-scripts/

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens160
UUID=90a09195-c24e-401d-bf4e-8c846539b130
DEVICE=ens160
ONBOOT=yes
IPADDR=172.17.1.253
GATEWAY=172.17.1.1
NETMASK=255.255.255.255
DNS1=8.8.8.8
DNS2-172.17.1.1 关闭firewall
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动 yum install -y apr* autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libxml* libtiff libtiff* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget zlib-devel yum -y groupinstall "Development Tools" yum install -y gcc gcc-c++ make cmake automake autoconf gd file bison patch mlocate flex \
diffutils zlib zlib-devel pcre pcre-devel \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \
glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \
ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel \
krb5 krb5-devel openssl openssl-devel \
openldap openldap-devel nss_ldap openldap-clients openldap-servers \
openldap-devellibxslt-devel kernel-devel libtool-libs \
readline-devel gettext-devel libcap-devel php-mcrypt libmcrypt libmcrypt-devel recode-devel yum install -y libxml2 libxml2* openssl-dev libcurl3-openssl-dev openssl-devel.i686 \
openssl-perl.i686 libcurl-devel.i686 libjpeg-turbo-devel.i686 libpng.i686 libpng-devel.i686l freetype-devel php-gd yum -y install cmake ncurses ncurses-devel bison bison-devel boost boost-devel 安装MySQL groupadd mysql #添加mysql组 useradd -g mysql mysql -s /bin/false #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统 mkdir -p /data/mysql #创建MySQL数据库存放目录 chown -R mysql:mysql /data/mysql #设置MySQL数据库存放目录权限 mkdir -p /usr/local/mysql #创建MySQL安装目录 mkdir -p /usr/local/boost cd /usr/local/boost
wget http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz tar -xvzf boost_1_59_0.tar.gz 编译 cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0 \
-DWITH_SSL=system \
-DWITH_BOOST=/usr/local/boost pid =/www/lanmps/php5.6.31/var/run/php-fpm.pid
error_log = /www/lanmps/php5.6.31/var/log/php-fpm.log
log_level = notice [www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 80
pm.start_servers = 40
pm.min_spare_servers = 40
pm.max_spare_servers = 80
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log #修改/usr/local/mysql权限
chmod +w /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql mv /etc/my.cnf /etc/my.cnf.bak
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #拷贝mysql安装目录下support-files服务脚本到init.d目录
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
#赋予权限
chmod +x /etc/rc.d/init.d/mysqld
#设置开机启动
chkconfig mysqld on #执行初始化配置脚本,创建系统自带的数据库和表,注意配置文件的路径 ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 确保/usr/local/mysql/data为空
./bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data vi /etc/my.cnf [mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock symbolic-links=0 [mysqld_safe]
;log-error=/var/log/mariadb/mariadb.log
pid-file=/usr/local/mysql/data/localhost.localdomain.pid #修改/etc/profile文件
vi /etc/profile
#在文件末尾添加
PATH=/usr/local/mysql/bin:$PATH
export PATH
#让配置立即生效 source /etc/profile /usr/local/mysql/bin/mysqladmin -uroot -p password 'root'; /usr/local/mysql/bin/mysqladmin -uroot -p password 'root'; flush privileges; 重新授权用户 mysqld --skip-grant-tables 回车 --skip-grant-tables 的意思是启动MySQL服务的时候跳过权限表认证 GRANT ALL PRIVILEGES ON *.* TO 'zx'@'%'IDENTIFIED BY 'zx' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'root' WITH GRANT OPTION; nginx安装
yum -y install yasm libmcrypt libvpx tiff libpng freetype jpeg libgd t1lib ./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module vi /etc/init.d/nginx chmod +x /etc/init.d/nginx chkconfig nginx on ./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=www \
--group=www \
--with-pcre \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-http_v2_module \
--with-threads \
--with-stream \
--with-stream_ssl_module yum -y install libicu-devel make[2]: *** [progname.o] 错误 1
make[2]:正在离开目录 `/home/lmos/libiconv-1.14/srclib'
make[1]: *** [all] 错误 2
make[1]:正在离开目录 `/home/lmos/libiconv-1.14/srclib'
make: *** [all] 错误 2 进入srclib目录 执行 sed -i -e '/gets is a security/d' ./stdio.in.h Cannot find ldap.h
复制代码 代码如下:
yum -y install openldap
yum -y install openldap-devel configure: error: Cannot find ldap libraries in /usr/lib
复制代码 代码如下:
cp -frp /usr/lib64/libldap* /usr/lib/ http://www.bkjia.com/PHPjc/1008013.html 参考bug解决办法 yum install -y epel-release
yum install -y libmcrypt-devel export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH ./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql-sock=/tmp/mysql.sock \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-mysqlnd-compression-support \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--enable-intl \
--with-mcrypt \
--with-libmbfl \
--enable-ftp \
--with-gd \
--enable-gd-jis-conv \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--enable-fileinfo \
--enable-opcache \
--with-pear \
--enable-maintainer-zts \
--with-ldap=shared \
--without-gdbm nodejs
curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - 8是版本系列
yum install -y nodejs npm install -g cnpm --registry=https://registry.npm.taobao.org
注意fpm版本也就是php版本
nginx使用sock形式调用php-fpm vi /etc/php-fpm.d/www.conf
listen = /tmp/php-fpm.sock 建议放在这个目录,不容易有权限问题,也要主要有没有定期清理tmp的脚本或者代码
vi /etc/nginx/conf.d/default.conf
fastcgi_pass   unix:/tmp/php-fpm.sock;

注意可不是就这么就完了
还有需要配置的

listen.owner = www
listen.group = www
listen.mode = 0660

listen.allowed_clients = 127.0.0.1

listen = /tmp/php-fpm.sock

listen.backlog = -1

nginx 做服务的脚本是有问题的请参看

http://bbs.qcloud.com/thread-10429-1-1.html

vim /usr/lib/systemd/system/nginx.service

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

 

其实版本差距不大,就是centos的系统操作有写区别,其他没什么

编译安装centos7 php7.2 mysql5.7 nginx1.9.9的更多相关文章

  1. centos6.8 编译安装lnmp php7.2 mysql5.6 nginx1.1.4

    编译操作参考版,没有每一步详细操作,慎入 关闭selinux和防火墙 service iptables stop chkconfig iptables off vi /etc/selinux/conf ...

  2. CentOS 6.8编译安装httpd2.2.31+MySQL5.6.31+PHP5.3.27

    CentOS 6.8编译安装httpd2.2.31+MySQL5.6.31+PHP5.3.27   说明:   操作系统:CentOS 6.8 32位 准备篇: 一.系统约定    软件源代码包存放位 ...

  3. 在已经编译安装好php7场景下,install gd库 with free-type (解决Call to undefined function imagettftext())

    在已经编译安装好php7场景下,install gd库 with free-type (解决Call to undefined function   imagettftext()) install g ...

  4. LNMP编译安装(centos7+nginx1.9+mysql5.6+php5.5)

    LNMP编译安装 # 需先配置IP # 软件包的路径 /usr/local/src yum install -y libjpeg-devel libpng-devel freetype-devel c ...

  5. 分布式架构高可用架构篇_06_MySQL源码编译安装(CentOS-6.7+MySQL-5.6)

    redhat: 下载:http://dev.mysql.com/downloads/mysql/ 选择5.6 source包 解压 cmake . -DCMAKE_INSTALL_PREFIX=/us ...

  6. LANMP系列教程之MySQL编译安装CentOS7环境

      以MySQL5.5.33版本为例 1.准备工作: 1.首先准备好源代码包 2.并且确保已安装好 "开发工具" 包组和cmake编译工具 3.确保安装好ncurses-devel ...

  7. 2018/04/25 基于 编译安装的 PHP7 安装 swoole 扩展

    在上一篇文章我们知道了如何去编译安装一个自己需要的 PHP 版本. 2018/04/25 PHP7的编译安装 这里还没有完,我们还需要安装我们的扩展,才算完成今天的任务. -- 下载扩展 还是官网下载 ...

  8. LANMP系列教程之php编译安装CentOS7环境

    前提:必须先安装好MySQL以及Apache   1.准备好源码包并配置好yum源,需要的源码包包括: libmcrypt-2.5.8-9.el6.x86_64.rpm libmcrypt-devel ...

  9. LANMP系列教程之Apache编译安装CentOS7环境

      1.准备好源码包并配置好yum源,需要的源码包包括:httpd-2.4.18.apr-1.5.2.tar.gz.apr-util-1.5.4.tar.gz 2.准备用户 groupadd -r a ...

随机推荐

  1. Unity Aspect

    Unity封装的东西太多,所以在很多情况下回忽略这些基本的事情.游戏窗口的中Aspect是通过Game窗口中进行选择,但对于相机的Aspect Unity并没有暴露接口在设置界面中,至少在编辑器下进行 ...

  2. 我是如何用Go语言搭建自己的博客的

    前言: 话说,已经很久没有在博客园更新博客了,之前写的关于go语言的系列学习文章<让我们一起Go>也由于种种原因一度中断.但是,正如我之前在文章中所写,可以慢慢来,但是对于Go语言的学习却 ...

  3. Objective-C语言控制语句

    • 分支语句• 循环语句• 跳转语句 Objective-C中的控制语句有以下几类:• 分支语句:if-else, switch• 循环语句:while, do-while, for• 与程序转移有关 ...

  4. 启动一个新的activity并携带数据,返回数据给上一个activity

    一.在启动一个新的activity的时候可以通过Intent携带数据,通过Intent.putExtra()方法通过键值对的形势装入数据.在新启动的activity中通过           getI ...

  5. js正则匹配查找

    var pattern1 = /好/g; console.log(pattern1.test("你好")); 字符串查找: var pattern1 = /\w/; console ...

  6. jps 显示process information unavailable解决方法

    jps 显示process information unavailable解决办法jps时出现如下信息: 4791 -- process information unavailable 解决办法: 进 ...

  7. 关于eclipse几种插件的安装方法

    首先这里的安装方法按文件类型和安装方式来分 首先介绍按不同安装方式来分: 1.利用eclipse自带插件安装功能: 以jode插件为例,启动eclipse,help -> Software Up ...

  8. String对象常用的一些方法

    anchor() 创建 HTML 锚. big() 用大号字体显示字符串. blink() 显示闪动字符串. bold() 使用粗体显示字符串. charAt() 返回在指定位置的字符. charCo ...

  9. Taffy Web开发,Python Flask实践详解

    1. 前言 最近为Taffy自动化测试框架写了个页面,主要实现了用例管理.执行,测试报告查看管理.发送邮件及配置等功能. 2. 实现细节 页面使用Python Flask +Bootstrap开发,还 ...

  10. 多种Timer的场景应用

    前言 今天讲讲各种Timer的使用. 三种Timer组件 .Net框架提供了三种常规Timer组件,分别是System.Windows.Forms.Timer.System.Timers.Timer和 ...