centos6.9 Lnmp环境搭建

所需软件

Tengine 2.2.3
PHP 5.6.36
PHP-Ext
imagick-3.4.3
memcache-2.2.7
memcached-2.2.0
redis-2.2.8
sphinx-1.3.3
MySQL 5.6.x

################Tengine部署#####################

安装依赖

yum install openssl-devel pcre-devel pcre gcc zlib -y

Nginx部署

cd /opt/lnmp
unzip ngx_http_substitutions_filter_module-master.zip
tar xzf tengine-2.2.3.tar.gz
tar xzf pcre-8.42.tar.gz

编译

cd /opt/lnmp/tengine-2.2.3
./configure
–prefix=/usr/local/tnginx
–with-http_concat_module
–with-http_realip_module
–with-http_sub_module
–add-module=/opt/lnmp/ngx_http_substitutions_filter_module-master

安装

make & make install

################PHP部署#####################

安装依赖

yum install -y libjpeg-turbo-devel gd-devel libcurl-devel libmcrypt libmcrypt-devel mhash mhash-devel libxslt-devel gcc gcc-c++ make 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 e2fsprogs e2fsprogs-devel krb5-devel krb5-libs openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers mcrypt libtidy* libtool-ltdl-devel yasm perl-devel readline-devel cyrus-sasl cyrus-sasl-devel bitmap-fonts fontconfig flex bison gperf ruby fontconfig-devel libicu-devel sqlite-devel xorg-x11-fonts-Type1 libfontenc bitstream-vera-fonts xorg-x11-fonts-base xorg-x11-font-utils urw-fonts libXfont libXfontcache chkfontpath

#可选参数 ImageMagick ImageMagick-devel ImageMagick-perl

编译

cd /opt/lnmp && tar xzf php-5.6.36.tar.gz && cd php-5.6.36

./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc
–with-bz2
–with-curl
–with-fpm-group=nobody
–with-fpm-user=nobody
–with-freetype-dir
–with-gd
–with-gettext
–with-iconv
–with-iconv
–with-jpeg-dir
–with-libxml-dir
–with-mcrypt
–with-mhash
–with-mysql=mysqlnd
–with-mysqli=mysqlnd
–with-openssl
–with-pcre-dir
–with-pdo-mysql=mysqlnd
–with-pear
–with-png-dir
–with-readline
–with-tidy
–with-xmlrpc
–with-xsl
–with-zlib
–enable-bcmath
–enable-cli
–enable-exif
–enable-fpm
–enable-ftp
–enable-gd-native-ttf
–enable-inline-optimization
–enable-mbregex
–enable-mbstring
–enable-mbstring=all
–enable-pcntl
–enable-pdo
–enable-shared
–enable-shmop
–enable-short-tags
–enable-soap
–enable-sockets
–enable-static
–enable-sysvmsg
–enable-sysvsem
–enable-sysvshm
–enable-xml
–enable-zip
–disable-debug
–disable-ipv6
–disable-rpath
–enable-opcache

make && make install
ln -s /usr/local/php/bin/php* /usr/bin/

复制配置文件
cp /opt/lnmp/php-5.6.36/php.ini-development /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

设置php-fpm 服务
cp /opt/lnmp/php-5.6.36/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
service php-fpm start

################安装其他服务####################

phantomjs

wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2

cd /opt/lnmp/
tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2
mv /opt/lnmp/phantomjs-2.1.1-linux-x86_64 /usr/local/phantomjs-2.1.1-linux-x86_64
cd /usr/local/phantomjs-2.1.1-linux-x86_64
cp /opt/lnmp/html2Image.js /usr/local/phantomjs-2.1.1-linux-x86_64
echo “export PATH=$PATH:/usr/local/phantomjs-2.1.1-linux-x86_64/bin” >> /etc/profile
source /etc/profile
phantomjs -v 如果能看到版本说明OK了
启动服务,端口9777:nohup phantomjs /usr/local/phantomjs-2.1.1-linux-x86_64/html2Image.js 9777 &

安装Redis服务
yum install redis
chkconfig redis on
/etc/init.d/redis restart
安装Memcache服务
yum install memcached
/usr/bin/memcached -d -l 127.0.0.1 -p 11211 -m 150 -u root

安装ImageMagick

cd /opt/lnmp/
tar xf ImageMagick-6.9.6-8.tar
cd ImageMagick-6.9.6-8
./configure -prefix=/usr/local/imageMagick --disable-openmp
make && make install

安装coreseek
CoreSeek

yum install make gcc gcc++ gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel
cd /opt/lnmp/
tar -xzvf coreseek-3.2.14.tar.gz
cd /opt/lnmp/coreseek-3.2.14/mmseg-3.2.14/
./bootstrap
./configure --prefix=/usr/local/mmseg3
make && make install

cd /opt/lnmp/coreseek-3.2.14/csft-3.2.14

GCC版本大于4.7的需要打补丁######

cd /opt/lnmp/coreseek-3.2.14/csft-3.2.14
patch -p1 < /opt/sphinxexpr.cpp-csft-3.2.13.patch
输入:/opt/lnmp/coreseek-3.2.14/csft-3.2.14/src/sphinxexpr.cpp
#####################################
sh buildconf.sh
./configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql
make && make install

################PHP扩展安装#####################

cd /opt/lnmp/phpext/
tar xzf imagick-3.4.3.tgz
tar xzf libevent-2.0.22-stable.tar.gz
tar xzf libmemcached-1.0.18.tar.gz
tar xzf memcache-2.2.7.tgz
tar xzf memcached-2.2.0.tgz
tar xzf redis-2.2.8.tgz
tar xzf sphinx-1.3.3.tgz
tar xzf swoole-1.8.3.tgz
tar xzf xhprof-0.9.4.tgz

安装libevent

cd /opt/lnmp/phpext/libevent-2.0.22-stable
./configure --prefix=/usr/local/libevent && make && make install

安装libmemcache

cd /opt/lnmp/phpext/libmemcached-1.0.18
./configure -prefix=/usr/local/libmemcached -with-memcached && make && make install

安装Memcached-2.2.0

cd /opt/lnmp/phpext/memcached-2.2.0
/usr/local/php/bin/phpize
./configure -enable-memcached -with-php-config=/usr/local/php/bin/php-config -with-zlib-dir -with-libmemcached-dir=/usr/local/libmemcached -prefix=/usr/local/phpmemcached
make && make install

安装memcache

cd /opt/lnmp/phpext/memcache-2.2.7
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config && make && make install

安装Redis扩展

cd /opt/lnmp/phpext/redis-2.2.8
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-redis
make && make install

安装imagic扩展

cd /opt/lnmp/phpext/imagick-3.4.3
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imageMagick/
make && make install

安装sphinx

cd /opt/lnmp/phpext/sphinx-1.3.3
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config && make && make install

安装xhprof-0.9.4

cd /opt/lnmp/phpext/xhprof-0.9.4/extension/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config && make && make install

安装swoole

cd /opt/lnmp/phpext/swoole-1.8.3
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config && make && make install

安装gmp

yum install -y gmp-devel
vim /usr/local/php/etc/php.ini
cd /opt/lnmp/php-5.6.*/ext/gmp
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-gmp && make && make install

配置文件末尾增加扩展

extension_dir = /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

[imagick]
extension=imagick.so
[memcache]
extension=memcache.so
extension=memcached.so
[redis]
extension=redis.so
[swoole]
extension=swoole.so
[xhprof]
extension=xhprof.so
[sphinx]
extension=sphinx.so

[gmp]
extension=gmp.so

[opcache]
zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=0
opcache.fast_shutdown=1
opcache.enable_cli=1

################ MySQL 部署#####################
cd /opt/lnmp
添加MySQL用户
groupadd mysql
useradd -r -g mysql -s /bin/false mysql

tar xzf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.40-linux-glibc2.12-x86_64 /usr/local/mysql
mkdir /data/mysql_data/
上传配置文件到/data/mysql_data/

初始化数据库,过程中有两个ok标识成功
cd /usr/local/mysql/scripts/mysql_install_db --defaults-file=/data/mysql_data/my.cnf --user=mysql
启动数据库
cd /usr/local/mysql/ && ./bin/mysqld_safe --defaults-file=/data/mysql_data/my.cnf &
进入数据库
/usr/local/mysql/bin/mysql -uroot -S /tmp/mysql3306.sock

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

weixin_42094600

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值