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 ...
随机推荐
- Heartbeat+DRBD+MySQL高可用方案【转】
转自Heartbeat+DRBD+MySQL高可用方案 - yayun - 博客园 http://www.cnblogs.com/gomysql/p/3674030.html 1.方案简介 本方案采用 ...
- 把perl脚本编译成exe
来源:http://www.veryhuo.com/a/view/38338.html 今天想把 perl 脚本编译成 exe 以便脱离 perl 解释器独立运行.都可以生成PERL的PE文件,在PE ...
- sdio/sd/mmc architecture
三个驱动mmc_core.ko mmc_block.ko omap_hsmmc.ko 读懂一个协议的架构有利于学习源码 参考了 http://processors.wiki.ti.com/index. ...
- bjective-C 中核心处理字符串的类是 NSString 与 NSMutableString
Objective-C 中核心处理字符串的类是 NSString 与 NSMutableString ,这两个类最大的区别就是NSString 创建赋值以后该字符串的内容与长度不能在动态的更改,除非重 ...
- spring @Component
使用 @Component <context:component-scan base-package="dao" /> 虽 然我们可以通过@Autowired或@R ...
- HDU2199,HDU2899,HDU1969,HDU2141--(简单二分)
二分是一种很有效的减少时间开销的策略, 我觉得单列出二分专题有些不太合理, 二分应该作为一中优化方法来考虑 这几道题都是简单的使用了二分方法优化, 二分虽然看似很简单, 但一不注意就会犯错. 在写二分 ...
- lucene3.6.1 经典案例 入门教程 (包含从文件中读取content)
转载http://liqita.iteye.com/blog/1676664 第一步:下载lucene的核心包 lucene-core-3.6.1-javadoc.jar (3.5 MB) lucen ...
- cocos2d-x 3.3 显示中文
Resources文件夹下的strings.xml: <dict> <key>targetScore</key> <string>目标分数</st ...
- 栅栏cyclicbarrier
栅栏类似闭锁,但是它们是有区别的. 1.闭锁用来等待事件,而栅栏用于等待其他线程.什么意思呢?就是说闭锁用来等待的事件就是countDown事件,只有该countDown事件执行后所有之前在等待的线程 ...
- Vim插件管理 -- Vundle
1 插件目录 -/.vim/bundle/ 没有可自行创建 2 安装Vundle $ git clone https://github.com/VundleVim/Vundle.vim.git ...