CentOS7 编译安装LNMP

LNMP(Linux-Nginx-Mysql-PHP),本文在CentOS7.0上编译LNMP尝尝鲜,全文基本上都是采用手动编译部署...依赖yum帮我安装了GCC和automake..写这个东西耗时有点久了...尼玛 太花时间啦,Linux运维交流群:344177552

主要软件版本:

nginx-1.6.0php-5.3.5mysql-5.5.6

yum源配置(其实没什么改动)

[[email protected] ~]# cat /etc/yum.repos.d/1.repo [1]name=1baseurl=file:///mediaenabled=1gpgcheck=0

[[email protected] ~]# mount /dev/cdrom /media && yum clean allmount: /dev/sr0 is write-protected, mounting read-onlyLoaded plugins: fastestmirrorCleaning repos: 1Cleaning up everything

编译工具安装

[[email protected] ~]# yum install gcc-c++ automake autoconf bzip2

zlib库(提供数据压缩用的函式库):

[[email protected] lnmp]# tar zxf zlib-1.2.8.tar.gz [[email protected] lnmp]# cd zlib-1.2.8[[email protected] zlib-1.2.8]# ./configure --prefix=/software/sharelib[[email protected] zlib-1.2.8]# make && make install

pcre库(rewrite的支持)

[[email protected] lnmp]# tar zxf pcre-8.35.tar.gz [[email protected] lnmp]# cd pcre-8.35[[email protected] pcre-8.35]# ./configure --prefix=/software/pcre --enable-utf8 --enable-unicode-properties[[email protected] pcre-8.35]# make && make install

OpenSSL库(https的支持)

[[email protected] lnmp]# tar zxf openssl-1.0.1h.tar.gz [[email protected] lnmp]# cd openssl-1.0.1h[[email protected] openssl-1.0.1h]# ./config --prefix=/software/openssl[[email protected] openssl-1.0.1h]# make && make install

TCMalloc工具(google内存管理套件)

[[email protected] lnmp]# tar zxf libunwind-1.1.tar.gz [[email protected] lnmp]# cd libunwind-1.1[[email protected] libunwind-1.1]# CFLAGS=-fPIC ./configure --prefix=/software/google-libunwind[[email protected] libunwind-1.1]# make CFLAGS=-fPIC && make CFLAGS=-fPIC install

[[email protected] lnmp]# tar zxf gperftools-2.2.tar.gz [[email protected] lnmp]# cd gperftools-2.2[[email protected] gperftools-2.2]# LDFLAGS="-L/software/google-libunwind/lib" CPPFLAGS="-I/software/google-libunwind/include" ./configure --prefix=/software/google-perftools[[email protected] gperftools-2.2]# make && make install

###路径加到动态链接库###[[email protected] gperftools-2.2]# echo "/software/google-libunwind/lib/" >> /etc/ld.so.conf[[email protected] gperftools-2.2]# echo "/software/google-perftools/lib/" >> /etc/ld.so.conf[[email protected] gperftools-2.2]# echo "/software/sharelib/lib/" >> /etc/ld.so.conf && ldconfig

Nginx(不解释)

[[email protected] lnmp]# groupadd -g 1500 nginx[[email protected] lnmp]# useradd -M -u 1500 -g nginx -s /sbin/nologin nginx[[email protected] lnmp]# mkdir /var/tmp/nginx[[email protected] lnmp]# chown nginx:nginx /var/tmp/nginx/[[email protected] lnmp]# tar zxf nginx-1.6.0.tar.gz [[email protected] lnmp]# cd nginx-1.6.0[[email protected] nginx-1.6.0]# sed -i ‘s/CFLAGS="$CFLAGS -g"/#CFLAGS="$CFLAGS -g"/‘ auto/cc/gcc[[email protected] nginx-1.6.0]# sed -i "s#/usr/local#/software/google-perftools#" auto/lib/google-perftools/conf##配置参数有点长##[[email protected] nginx-1.6.0]# ./configure --prefix=/software/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre=/root/lnmp/pcre-8.35 --with-openssl=/root/lnmp/openssl-1.0.1h --with-zlib=/root/lnmp/zlib-1.2.8 --with-google_perftools_module[[email protected] nginx-1.6.0]# make && make install

[[email protected] nginx-1.6.0]# mkdir /tmp/tcmalloc[[email protected] nginx-1.6.0]# chmod 0777 /tmp/tcmalloc/###这文件在附件里###[[email protected] nginx-1.6.0]# cp ../nginx.conf /software/nginx/conf/[[email protected] nginx-1.6.0]# cp ../fcgi.conf /software/nginx/conf/[[email protected] nginx-1.6.0]# chmod 755 /etc/init.d/nginx[[email protected] nginx-1.6.0]# mkdir /data/{logs,www.ipython.me}[[email protected] nginx-1.6.0]# /software/nginx/sbin/nginx[[email protected] nginx-1.6.0]# iptables -F[[email protected] nginx-1.6.0]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT[[email protected] nginx-1.6.0]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT[[email protected] nginx-1.6.0]# ps aux|grep nginxroot     61291  0.0  0.0  31120   896 ?        Ss   15:36   0:00 nginx: master process /software/nginx/sbin/nginx -c /software/nginx/conf/nginx.confnginx    61293  0.0  0.1  31560  1612 ?        S    15:36   0:00 nginx: worker process

ncurses库(字符终端处理库)

[[email protected] lnmp]# tar jxf ncurses-5.9.tar.bz2 [[email protected] lnmp]# cd ncurses-5.9[[email protected] ncurses-5.9]# ./configure --prefix=/software/ncurses --with-shared --without-debug[[email protected] ncurses-5.9]# make && make install

Mysql(数据库)

[[email protected] lnmp]# /usr/sbin/groupadd mysql[[email protected] lnmp]# /usr/sbin/useradd -s /sbin/nologin -g mysql mysql[[email protected] lnmp]# tar zxf mysql-5.5.6-rc.tar.gz [[email protected] lnmp]# cd mysql-5.5.6-rc[[email protected] mysql-5.5.6-rc]# ./configure --prefix=/software/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg --with-named-curses-libs=/software/ncurses/lib/libncurses.so.5[[email protected] mysql-5.5.6-rc]# make && make install[[email protected] mysql-5.5.6-rc]# mkdir /data/mysql/{binlog,relaylog} -p[[email protected] mysql-5.5.6-rc]# chown -R mysql:mysql /data/mysql[[email protected] mysql-5.5.6-rc]# /software/mysql/bin/mysql_install_db --basedir=/software/mysql/ --datadir=/data/mysql/ --user=mysql###这文件在附件里###[[email protected] mysql-5.5.6-rc]# \cp ../my.cnf /etc/my.cnf[[email protected] mysql-5.5.6-rc]# \cp ../mysqld /etc/init.d/mysqld[[email protected] mysql-5.5.6-rc]# chmod 755 /etc/init.d/mysqld [[email protected] mysql-5.5.6-rc]# systemctl enable mysqld[[email protected] mysql-5.5.6-rc]# systemctl start mysqld

[[email protected] mysql-5.5.6-rc]# ps aux | grep mysqldroot     55475  0.1  0.1 115348  1696 ?        S    16:07   0:00 /bin/sh /software/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/mysql.pidmysql    56342  2.7 11.9 1918248 120680 ?      Sl   16:07   0:01 /software/mysql/libexec/mysqld --basedir=/software/mysql --datadir=/data/mysql --plugin-dir=/software/mysql/lib/mysql/plugin --user=mysql --log-error=/data/mysql/mysql_error.log --open-files-limit=10240 --pid-file=/data/mysql/mysql.pid --socket=/tmp/mysql.sock --port=3306

libiconv库(字符编码转换)

[[email protected] lnmp]# tar zxf libiconv-1.14.tar.gz###打补丁吧,避免手动修改隐患逻辑错误###[[email protected] lnmp]# gzip -d libiconv-glibc-2.16.patch.gz  [[email protected] lnmp]# cd libiconv-1.14/srclib[[email protected] srclib]# patch -p1 < ../../libiconv-glibc-2.16.patch patching file stdio.in.h[[email protected] libiconv-1.14]# cd ..[[email protected] libiconv-1.14]# ./configure --prefix=/software/sharelib/[[email protected] libiconv-1.14]# make && make install

libxml库(XML库)

[[email protected] lnmp]# tar jxf libxml2-2.8.0.tar.bz2 [[email protected] lnmp]# cd libxml2-2.8.0[[email protected] libxml2-2.8.0]# ./configure --prefix=/software/sharelib[[email protected] libxml2-2.8.0]# make && make install

libpng库(图片库)

[[email protected] lnmp]# tar jxf libpng-1.6.8.tar.bz2 [[email protected] lnmp]# cd libpng-1.6.8[[email protected] libpng-1.6.8]# LDFLAGS="-L/software/sharelib/lib/" CPPFLAGS="-I/software/sharelib/include" ./configure --prefix=/software/sharelib[[email protected] libpng-1.6.8]# make && make install

jpeg库(图片库)

[[email protected] lnmp]# tar jxf jpegsrc.v9a.tar.bz2[[email protected] lnmp]# cd jpeg-9a/ [[email protected] jpeg-9a]# ./configure --prefix=/software/sharelib/[[email protected] jpeg-9a]# make && make install

freetype(字库)

[[email protected] lnmp]# tar jxf freetype-2.5.2.tar.bz2 [[email protected] lnmp]# cd freetype-2.5.2[[email protected] freetype-2.5.2]# LIBPNG_CFLAGS="-I/software/sharelib/include/" LIBPNG_LDFLAGS="-L/software/sharelib/lib/" ./configure --prefix=/software/sharelib[[email protected] freetype-2.5.2]# make && make install[[email protected] freetype-2.5.2]# ln -s /software/sharelib/include/freetype2 /software/sharelib/include/freetype2/freetype

libmcrypt库(加密算法)

[[email protected] lnmp]# tar jxf libmcrypt-2.5.8.tar.bz2 [[email protected] lnmp]# cd libmcrypt-2.5.8[[email protected] libmcrypt-2.5.8]# ./configure --prefix=/software/sharelib[[email protected] libmcrypt-2.5.8]# make && make install

mhash库(加密)

[[email protected] lnmp]# tar jxf mhash-0.9.9.9.tar.bz2[[email protected] lnmp]# cd mhash-0.9.9.9[[email protected] mhash-0.9.9.9]# ./configure --prefix=/software/sharelib/[[email protected] mhash-0.9.9.9]# make && make install

curl库(URL传输)

[[email protected] lnmp]# tar jxf curl-7.36.0.tar.bz2[[email protected] lnmp]# cd curl-7.36.0[[email protected] curl-7.36.0]# ./configure --prefix=/software/curl[[email protected] curl-7.36.0]# make && make install

gd库(绘图)

[[email protected] lnmp]# tar zxf gd-2.0.35.tar.gz [[email protected] lnmp]# cd gd-2.0.35[[email protected] gd-2.0.35]# LDFLAGS="-L/software/sharelib/lib" CPPFLAGS="-I/software/sharelib/include" ./configure --prefix=/software/sharelib --enable-shared --with-png=/software/sharelib --with-freetype=/software/sharelib --with-libiconv-prefix=/software/sharelib --with-jpeg=/software/sharelib[[email protected] gd-2.0.35]# make && make install

libtool(库编译支持)

[[email protected] lnmp]# tar zxf libtool-2.4.2.tar.gz [[email protected] lnmp]# cd libtool-2.4.2[[email protected] libtool-2.4.2]# ./configure --prefix=/software/sharelib/ --enable-ltdl-install[[email protected] libtool-2.4.2]# make && make install

将mysql的库文件加入动态共享

[[email protected] lnmp]# echo "/software/mysql/lib/mysql/" >> /etc/ld.so.conf && ldconfig

PHP(一种语言吧)

[[email protected] lnmp]# tar zxf php-5.3.5.tar.gz [[email protected] lnmp]# cd php-5.3.5[[email protected] php-5.3.5]# sed -i s"#mysql/psi/psi.h#/software/mysql/include/mysql/psi/psi.h#" /software/mysql/include/mysql/my_sys.h[[email protected] php-5.3.5]# sed -i s"#mysql/plugin.h#/software/mysql/include/mysql/plugin.h#" /software/mysql/include/mysql/m_string.h[[email protected] php-5.3.5]# sed -i s"#mysql/services.h#/software/mysql/include/mysql/services.h#" /software/mysql/include/mysql/plugin.h[[email protected] php-5.3.5]# sed -i s"#mysql/service_my_snprintf.h#/software/mysql/include/mysql/service_my_snprintf.h#" /software/mysql/include/mysql/services.h[[email protected] php-5.3.5]# sed -i s"#mysql/service_thd_alloc.h#/software/mysql/include/mysql/service_thd_alloc.h#" /software/mysql/include/mysql/services.h[[email protected] php-5.3.5]# ./configure --prefix=/software/php --with-config-file-path=/software/php/etc --with-mysql=/software/mysql --with-mysqli=/software/mysql/bin/mysql_config --with-iconv-dir=/software/sharelib --disable-ipv6 --with-freetype-dir=/software/sharelib/ --with-jpeg-dir=/software/sharelib/ --with-png-dir=/software/sharelib/ --with-zlib=/software/sharelib/ --with-libxml-dir=/software/sharelib/ --disable-rpath --enable-bcmath --enable-safe-mode --enable-shmop --enable-sysvsem --with-curl=/software/curl/ --enable-fpm --enable-mbstring  --with-mcrypt=/software/sharelib/ --with-gd=/software/sharelib/ --enable-gd-native-ttf --with-openssl=/software/openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-inline-optimization --with-curlwrappers --enable-mbregex --with-gettext[[email protected] php-5.3.5]# make install

##创建PHP-FPM配置文件,参数什么的自己根据配置调整##[[email protected] php-5.3.5]# cat >> /software/php/etc/php-fpm.conf <

好了...看图

CentOS7 编译安装LNMP

时间: 2024-10-04 02:17:40

CentOS7 编译安装LNMP的相关文章

centos7编译安装LNMP(nginx-1.16.0,mysql8.0.16,php-7.3.6)常见问题报错及解决方法

LNMP的安装与配置 nginx-1.16.0安装及配置: 第一步:前往官网下载nignx源码包 下载完毕后上传至服务器(先安装lrzsz) yum -y install lrzsz 安装完毕后执行: rz 找到nginx包后点击确定,即可上传成功 第二步: 解压: tar zxvf nginx-1.16.0.tar.gz 进入: cd nginx-1.16.0/ 创建用户.用户组: groupadd nginx useradd -g nginx nginx -s /sbin/nologin 第

centos7编译安装LNMP

系统环境 最小化安装64位Centos7.1(已安装开发工具包) 部分安装包下载地址 wget http://ncu.dl.sourceforge.net/project/re2c/re2c/0.14.2/re2c-0.14.2.tar.gz wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/ 源码包存放目录 /usr/local/src 安装NGIX及P

centos7编译安装lnmp环境

mysql版本:wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.30.tar.gz /home/ 准备工作,安装依赖库 关闭防火墙 Redirecting to /bin/systemctl stop  iptables.service service iptables stop 安装环境需要的依赖: yum -y install gcc automake autoconf libtool make gcc-c++ glib

阿里云centos6.5实践编译安装LNMP架构web环境

LNMP 代表的就是:Linux系统下Nginx+MySQL+PHP这种网站服务器架构. 本次测试需求: **实践centos6.5编译安装 LNMP生产环境 架构 web生产环境 使用 ngx_pagespeed 优化前端 xcache 优化php 用 google_perftools 优化nginx 和 php内存分配 ** 作为 Web 服务器:相比 Apache,Nginx 使用更少的资源,支持更多的并发连接,体现更高的效率. 作为负载均衡服务器:Nginx 既可以在内部直接支持Rail

CentOS编译安装LNMP环境

这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables   #编辑防火墙配置文件 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT(允许80端口通过防火墙) -A INPUT -m state -

Centos 7.0 编译安装LNMP(Linxu+nginx+mysql+php)之源码安装nginx (一)

nginx简介:       Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,第一个公开版本0.1.0发布于2004年10月4日. 其将源代码以类BSD许可证的形式发布,因它的稳定性.丰富的功能集.示例配置文件和低系统资源的消耗而闻名.2011年6月1日,nginx 1.0.4发布. Nginx是一款轻量级的Web 服务器

centos下编译安装LNMP环境

自PHP-5.3.3起,PHP-FPM加入到了PHP核心,编译时加上--enable-fpm即可提供支持. PHP-FPM以守护进程在后台运行,Nginx响应请求后,自行处理静态请求,PHP请求则经过fastcgi_pass交由PHP-FPM处理,处理完毕后返回. Nginx和PHP-FPM的组合,是一种稳定.高效的PHP运行方式,效率要比传统的Apache和mod_php高出不少. 二.依赖环境 yum -y install gcc gcc-c++ make cmake automake au

源码编译安装lnmp架构

lnmp的架构 lnmp架构为:linux +nginx +mysql+php/perl/python,我们将只用linux(rhel6.5)+nginx+mysql+php构建企业web架构 环境:RHEL6.5 iptables -F selinux is  disabled 注意:在搭建lnmp环境前,必须检测系统内部不能存在相关的软件:(纯净搭建) #rpm -qa | grep php #rpm -qa | grep httpd #rpm -qa | grep mysql 1.ngin

实践centos6.5编译安装LNMP架构web环境

LNMP 代表的就是:Linux系统下Nginx+MySQL+PHP这种网站服务器架构. 本次测试需求: **实践centos6.5编译安装 LNMP生产环境 架构 web生产环境 使用 ngx_pagespeed 优化前端 xcache 优化php 用 google_perftools 优化nginx 和 php内存分配 ** 作为 Web 服务器:相比 Apache,Nginx 使用更少的资源,支持更多的并发连接,体现更高的效率. 作为负载均衡服务器:Nginx 既可以在内部直接支持Rail