CentOS tengine mysql 5.7 php 5.6
CentOS 7.x 编译安装 LNMP
L 版本是 CentOS 7.x x64版本,
N 我们使用tengine 的最新版本,主要原因是因为tengine 默认支持很多的模块。
M 这里我们选用 mysql 5.7 的版本,mysql 5.7 性能提升非常之多。
p 这里就选用了 php 5.6 版本,至于5.7 是因为 很多扩展支持的还不好。
一、下载相应软件包:
下载 php 5.6.19
http://cn2.php.net/distributions/php-5.6.19.tar.gz
下载 mysql 5.7
ftp://ftp.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.7/mysql-5.7.14.tar.gz
下载 tengine 2.1.1
http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
二、安装必要支持库,以及软件。
yum install -y gcc gcc-c++ cmake ncurses-devel
三、编译安装 Mysql 5.7
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
mkdir -p /opt/local/mysql/data
mkdir -p /opt/local/mysql/binlog
mkdir -p /opt/local/mysql/logs
mkdir -p /opt/local/mysql/relaylog
mkdir -p /var/lib/mysql
mkdir -p /opt/local/mysql/etc/
tar zxvf mysql-5.7.14.tar.gz
cd mysql-5.7.14
cmake -DCMAKE_INSTALL_PREFIX="/opt/local/mysql" -DDEFAULT_CHARSET=utf8 -DMYSQL_DATADIR="/opt/local/mysql/data/" -DCMAKE_INSTALL_PREFIX="/opt/local/mysql" -DINSTALL_PLUGINDIR=plugin -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_COLLATION=utf8_general_ci -DENABLE_DEBUG_SYNC=0 -DENABLED_LOCAL_INFILE=1 -DENABLED_PROFILING=1 -DWITH_ZLIB=system -DWITH_EXTRA_CHARSETS=none -DMYSQL_MAINTAINER_MODE=OFF -DEXTRA_CHARSETS=all -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
( -DDOWNLOAD_BOOST=1 会自动下载boost 到 DWITH_BOOST= 指定目录 或者自行下载,存放于指定目录 )
make -j `cat /proc/cpuinfo | grep processor| wc -l`
make install
ln -s /opt/local/mysql/lib/mysql /usr/lib/mysql
ln -s /opt/local/mysql/include/mysql /usr/include/mysql
ln -s /opt/local/mysql/bin/mysql /usr/bin/mysql
ln -s /opt/local/mysql/bin/mysqldump /usr/bin/mysqldump
ln -s /opt/local/mysql/bin/myisamchk /usr/bin/myisamchk
ln -s /opt/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
rm -rf /etc/my.cnf
cp /opt/local/mysql/support-files/my-default.cnf /opt/local/mysql/etc/my.cnf
cd /opt/local/mysql/bin/
chmod +w /opt/local/mysql
chown -R mysql:mysql /opt/local/mysql
chmod +w /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
./mysqld --initialize --user=mysql --basedir=/opt/local/mysql --datadir=/opt/local/mysql/data
( 系统会自动生成一个随机密码,在logs 文件里面可以查看 )
cp ./support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
echo 'basedir=/opt/local/mysql-5.6.15/' >> /etc/init.d/mysqld
echo 'datadir=/opt/local/mysql-5.6.15/data' >>/etc/init.d/mysqld
service mysqld start
/opt/local/mysql/bin/mysql_secure_installation -uroot -p
修改密码,加固密码,设置密码级别,删除测试库
四、编译安装php 5.6
1. 安装php所需的依赖
yum -y install libXpm-devel zlib zlib-devel libzip libzip-devel autoconf ImageMagick-devel
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
tar zxvf libiconv-1.9.2.tar.gz
cd libiconv-1.9.2
./configure --prefix=/usr/local
make && make install
tar zxvf php-5.6.19.tar.gz
cd php-5.6.19
cp -frp /usr/lib64/libldap* /usr/lib/
vi /etc/ld.so.conf.d/local.conf
添加:
/usr/local/lib
执行
ldconfig -v
mkdir /opt/local/php/logs
./configure --prefix=/opt/local/php --with-config-file-path=/opt/local/php/etc --with-mysql=/opt/local/mysql --with-mysqli=/opt/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --with-xpm-dir=/usr/lib --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --disable-phar --enable-opcache=no --with-pdo-mysql --enable-maintainer-zts
------------------------------------------------------------------------------------------------------------------------------------------------
1. 报错:
configure: error: Cannot find libmysqlclient_r under /opt/local/mysql.
Note that the MySQL client library is not bundled anymore!
创建一个软链接
ln -s /opt/local/mysql/lib/libmysqlclient.so.20.2.0 /opt/local/mysql/lib/libmysqlclient_r.so
ldconfig
2. 报错:
undefined reference to symbol 'ber_strdup'
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
vi Makefile
找到 EXTRA_LIBS 行,
在行末添加 ‘ -llber ‘ 保存退出再次make
------------------------------------------------------------------------------------------------------------------------------------------------
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-production /opt/local/php/etc/php.ini
2. 安装 php 扩展
wget http://pecl.php.net/get/memcache-3.0.8.tgz
tar zxvf memcache-3.0.8.tgz
cd memcache-3.0.8/
/opt/local/php/bin/phpize
./configure --with-php-config=/opt/local/php/bin/php-config
make && make install
wget http://pecl.php.net/get/mongo-1.6.12.tgz
tar zxvf mongo-1.6.12.tgz
cd mongo-1.6.12
/opt/local/php/bin/phpize
./configure --with-php-config=/opt/local/php/bin/php-config
make && make install
wget http://pecl.php.net/get/imagick-3.4.1.tgz
tar zxvf imagick-3.4.1.tgz
cd imagick-3.4.1
./configure --with-php-config=/opt/local/php/bin/php-config
make && make install
wget https://github.com/phpredis/phpredis/archive/develop.zip
unzip develop.zip
cd phpredis-develop/
/opt/local/php/bin/phpize
./configure --with-php-config=/opt/local/php/bin/php-config
make && make install
echo extension_dir = '"/opt/local/php/lib/php/extensions/no-debug-zts-20131226/"' >> /opt/local/php/etc/php.ini
echo extension = '"memcache.so"' >> /opt/local/php/etc/php.ini
echo extension = '"imagick.so"' >> /opt/local/php/etc/php.ini
echo extension = '"mongo.so"' >> /opt/local/php/etc/php.ini
echo extension = '"redis.so"' >> /opt/local/php/etc/php.ini
echo open_basedir = '"/opt/htdocs/"' >> /opt/local/php/etc/php.ini
cp /opt/software/php-5.6.19/sapi/fpm/php-fpm.conf /opt/local/php/etc/
/usr/sbin/groupadd upload
/usr/sbin/useradd -g upload upload
五、安装编译 tengine
1. 安装所需依赖
yum -y install pcre gd-devel
2. 安装 tengine
tar zxvf tengine-2.1.2.tar.gz
cd tengine-2.1.2
vi src/core/nginx.h
查找 #define TENGINE 与 #define TENGINE_VERSION
修改 版本号与显示信息
./configure --user=upload --group=upload --prefix=/opt/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module
make && make install
cd /opt/local/nginx/conf
vi nginx.conf
----------------------------------------------------------------------------------------------
user upload upload;
error_log /opt/local/nginx/logs/nginx_error.log crit;
pid /opt/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 65535;
events
{
reuse_port on;
worker_connections 65535;
}
http
{
include mime.types;
default_type application/octet-stream;
#charset gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 100m;
sendfile on;
server_tokens off;
tcp_nopush on;
keepalive_timeout 120;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for "$request_time"';
include vhost/*.conf;
}
-----------------------------------------------------------------------------------------------------
mkdir -p /opt/local/nginx/conf/vhost
cd /opt/local/nginx/conf/vhost
vi www.xxx.com.conf
---------------------------------------------------------------------------------------------------
server
{
listen 80;
server_name www.xxx.com;
index index.html index.htm index.php;
root /opt/htdocs/;
access_log /opt/local/nginx/logs/www.xxx.com.log main;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
------------------------------------------------------------------------------------------------------
六、启动服务
启动php-fpm
/opt/local/php/sbin/php-fpm
启动 tengine
/opt/local/nginx/sbin/nginx
CentOS tengine mysql 5.7 php 5.6的更多相关文章
- CentOS 下 MySQL DateBasic 抢救
CentOS 下 MySQL DateBasic 抢救 强 Kill 数据库进程. 分析问题:确定报错内容 报错信息:The server quit without updating PID file ...
- centos安装 mysql
centos安装 mysql 1. 下载mysqlmysql被oracle收购后现在退出了企业版和社区版本,社区版本是开源的,企业版是收费的.社区版可以下载源码也可以下载二进制文件包.源码安装比较麻烦 ...
- tengine + mysql + nginx + php
tengine + mysql + nginx + php 1.配置防火墙vim /etc/sysconfig/iptables # 允许80端口通过防火墙-A INPUT -m state --st ...
- centOS安装Mysql指南
centOS安装Mysql指南 说明:使用操作系统centOS6.4 32位系统:mysql:mysql-5.7.10-linux-glibc2.5-i686.tar.gz; 一.准备 下载mysql ...
- windows下的mysql客户端mysqlworkbench链接虚拟机上CentOS的mysql服务器
本人在虚拟机上CentOS的Linux环境下安装了mysql服务器,在本地Windows下安装了mysql的客户端mysqlworkbench ,所以就想让windows下的mysql客户端mysql ...
- 【Linux】Centos部署MySQL
将CentOS部署MySQL需要本地配置环境.本地编译MySQL,耗时较长的情况,优化为编译成型MySQL并打包,推送并按配置部署. 首先需要在一台机器配置好环境,搭个YUM源,并将所需要的包取出备用 ...
- Centos系统mysql 忘记root用户的密码
Centos系统mysql 忘记root用户的密码: 第一步:(停掉正在运行的mysql) [root@maomao ~]# /etc/init.d/mysqld stop Stopping MySQ ...
- CentOS下MySQL 5.7编译安装
CentOS下MySQL 5.7编译安装 文章目录 安装依赖包 下载相应源码包 添加mysql用户 预编译 编译安装 启动脚本,设置开机自启动 /etc/my.cnf,仅供参考 初始化数据库 设置 ...
- CentOS安装MySQL问题汇总
遇到的错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) denied for ...
随机推荐
- JavaConcurrentHashMap
JavaConcurrentHashMap 大滕翼不自觉地往前探了探身子可还没等他听到唐寅说到 兆咒耶Т √靼脶摹 す宿坩曹 '字'心'上都有横您老瞧瞧这个'宣德 炔灌莞 蹇忄в 幼銮亿辽 仄黛境 ...
- iOS中的多线程基础
NSThread NSThread是一个苹果封装过的,面向对象的线程对象.但是它的生命周期需要我们自己来手动管理,所以使用不是很常见,比如[NSThread currentThread],它可以获取当 ...
- HttpWebRequest 抓取页面异常处理办法
抓取页面异常处理办法 public static string GetHtmlTest(string URI) { string fullhtml = null; while (true) { try ...
- 【最短路】 poj 2387
#include <iostream> #include <stdlib.h> #include <limits.h> #include <string.h& ...
- 【滚动数组】 dp poj 1036
题意:一群匪徒要进入一个酒店.酒店的门有k+1个状态,每个匪徒的参数是:进入时间,符合的状态,携带的钱. 酒店的门刚开始状态0,问最多这个酒店能得到的钱数. 思路: dp数组为DP[T][K]. 转移 ...
- OpenLayer 3 鹰眼控件和全屏显示
<body> <div id="map"></div> <script> var map=new ol.Map({ target:& ...
- 使用VS2013编译webkit
环境: win7_x64.VS2013 开始: 一.下载webkit 从网站"https://github.com/WebKit/webkit"下载webkit,我下载的版本最后的 ...
- Swift 学习笔记(五)
126. 协议(Protocols) 协议语法(Protocol Syntax) 属性要求(Property Requirements) 方法要求(Method Requirements) Mutat ...
- SQL Server触发器的禁用和启用
禁用: ALTER TABLE trig_example DISABLE TRIGGER trig1 GO 恢复: ALTER TABLE trig_example ENABLE TRIGGER tr ...
- cocos2d3.8.1 使用prebuild提升发布android速度
1.生成cocos prebuild库 cocos gen-libs -m debug或 cocos gen-libs -m release 2.使用命令创建test项目 cocos new test ...