标签:lnmp
搭建环境:Centos 6.8,nginx 1.9.14,mysql 5.6.23,php 5.6.17
目的:LNMP如今已成为主流的web服务器搭建方案,如公司内部的ECstore,Discuz,计划用来替代nagios+check_mk监控平台的Zabbix。均可以基于LNMP。本次单机LNMP搭建为熟悉电商集群做准备,顺便记录下搭建过程,省的每次搭建完后,下回搭建又得重头再来。
LNMP安装环境准备:
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers make libtool* git tree bision pcre-devel perl
安装libiconv
cd /usr/local/src wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxvf libiconv-1.14.tar.gz cd libiconv-1.14/ ./configure --prefix=/usr/local make && make install
安装libmcrypt
cd /usr/local/src wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz tar -zxvf libmcrypt-2.5.7.tar.gz cd libmcrypt-2.5.7 ./configure make make install cd libltdl/ ./configure --enable-ltdl-install make make install
安装mhash
wget http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download tar xfmhash-0.9.9.9.tar.bz2 cd mhash-0.9.9.9 ./configure make&& make install
安装mcript
cd /usr/local/src tar zxvf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8/ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH #注意一下这步运行下,不然下面可能报错 ./configure make make install
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
MySQL编译安装
安装cmake(记得好像从mysql 5.5开始需要cmake编译安装),可从https://cmake.org/download/ 中下载。
tar zxvfcmake-3.4.1.tar.gz cd cmake-3.4.1 ./bootstrap make && make install
二、创建用户及MySQL所需目录
新增mysql用户
groupadd -r mysql useradd -r -g mysql mysql
新建MySQL所需目录
mkdir -p /usr/local/mysql mkdir -p /data/mysqldb
数据库文件目录创建可参照http://zhoufan.blog.51cto.com/4278592/1790308创建LVM并挂载。
三、编译安装MySQL
可从http://dev.mysql.com/downloads/mysql/ 下载mysql源码。
tar zxvf mysql-5.6.23.tar.gzcd mysql-5.6.23 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ -DDEFAULT_CHARSET=utf8\ -DDEFAULT_COLLATION=utf8_general_ci\ -DWITH_INNOBASE_STORAGE_ENGINE=1\ -DWITH_ARCHIVE_STORAGE_ENGINE=1\ -DWITH_BLACKHOLE_STORAGE_ENGINE=1\ -DMYSQL_DATADIR=/data/mysqldb\ -DMYSQL_TCP_PORT=3306\ -DENABLE_DOWNLOADS=1\ -DSYSCONFDIR=/etc\ -DWITH_SSL=system\ -DWITH_ZLIB=system\ -DWITH_LIBWRAP=0make&& make install
本文出自 “Frank” 博客,请务必保留此出处http://zhoufan.blog.51cto.com/4278592/1793095
标签:lnmp
原文地址:http://zhoufan.blog.51cto.com/4278592/1793095