CentOS6.5 编译安装lnmp环境
参考:http://54im.com/tag/libmcrypt
http://www.educity.cn/linux/1240338.html
- 设置防火墙,并开启3306 80端口:vi /etc/sysconfig/iptables && service iptables stop && service iptables start
- yum清缓存并更新:yum clean all && yum update
- 下载安装编译工具和依赖包 :
yum -y install cmake 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 nss_ldap openldap-clients openldap-servers libXpm* wget pcre-devel zlib-devel gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel bison automake zlib* libxml* ncurses-devel libtool-ltdl-devel* unzip
- 下载安装包
- 创建存放源码的目录
mkdir /opt/src && cd /opt/src
- wget下载程序源码
wget http://nginx.org/download/nginx-1.7.8.tar.gz #最新
wget http://cn2.php.net/distributions/php-5.4.36.tar.gz
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz #mysql5.6
wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F&ts=1418528625&use_mirror=tcpdiag
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
wget http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmhash%2Ffiles%2Fmhash%2F0.9.9.9%2F&ts=1418530194&use_mirror=hivelocity
wget http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FMCrypt%2F2.6.8%2F&ts=1418531968&use_mirror=softlayer-dal
wget http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gzwget http://www.cmake.org/files/v3.1/cmake-3.1.0.tar.gz
wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0"wget https://github.com/eaccelerator/eaccelerator/archive/master.zip -O eaccelerator.zip
#更名
mv libmcrypt-2.5.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F libmcrypt-2.5.8.tar.gz - 重命名压缩包
mv libmcrypt-2.5..tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F libmcrypt-2.5..tar.gz
mv mcrypt-2.6..tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FMCrypt%2F2.6.8%2F mcrypt-2.6..tar.gz
mv mhash-0.9.9.9.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmhash%2Ffiles%2Fmhash%2F0.9.9.%2F mhash-0.9.9.9.tar.gz
mv eaccelerator-0.9.6.1.tar.bz2\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Feaccelerator%2Ffiles%2Feaccelerator%2FeAccelerator%200.9.6.1%2F eaccelerator-0.9.6.1.tar.bz2 - 安装libiconv、libmcrypt、libltdl、mhash、mcrypt
tar zxvf mhash-0.9.9.9.tar.gz && cd mhash-0.9.9.9
./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. /usr/lib/libmcrypt.so.
ln -s /usr/local/lib/libmcrypt.so.4.4. /usr/lib/libmcrypt.so.4.4.
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. /usr/lib/libmhash.so.
ln -s /usr/local/lib/libmhash.so.2.0. /usr/lib/libmhash.so.2.0.
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-configtar zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8
./configure && make && make install
/sbin/ldconfig
cd libltdl/
./configure -enable-ltdl-install
make && make installtar zxvf libiconv-1.14.tar.gz && cd libiconv-1.14
./configure --prefix=/opt
make && make install tar zxvf mcrypt-2.6..tar.gz && cd mcrypt-2.6.
/sbin/ldconfig && ./configure && make && make install- 安装cmake
tar zxvf cmake-3.1..tar.gz && cd cmake-3.1. && ./configure --prefix=/usr && gmake && gmake install
- 安装bison
tar zxvf bison-3.0.tar.gz && cd bison-3.0
./configure && make && make install - 准备用户、目录
groupadd mysql
useradd -g mysql mysql
groupadd www
useradd -g www www
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
mkdir -p /data/www
chown -R www:www /data/www - 安装mysql
编译:
tar zxvf mysql-5.6..tar.gz && cd mysql-5.6.
cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql -DMYSQL_DATADIR=/data/mysql -DWITH_INNOBASE_STORAGE_ENGINE= -DWITH_MEMORY_STORAGE_ENGINE= -DWITH_MYISAM_STORAGE_ENGINE= -DSYSCONFDIR=/etc/ -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=on
make && make install && ln -s /opt/mysql/lib/lib* /usr/lib/配置:
/opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql/ --datadir=/data/mysql --user=mysql
cd /opt/mysql/support-files
cp my-default.cnf /etc/my.cnf初始化并自启动
#初始化
cp /opt/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
#启动mysql
/etc/rc.d/init.d/mysqld start
#设置mysql登录密码
cd /opt/mysql && bin/mysql_secure_installation- 安装php
编译:
tar zxvf php-5.4..tar.gz && cd php-5.4.
./configure --prefix=/opt/php --with-mysql=/opt/mysql --with-mysqli=/opt/mysql/bin/mysql_config --with-iconv-dir=/opt/src/libiconv-1.14 --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 --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap && make && make install- 或者:./configure --prefix=/usr/local/php --enable-fpm --with-iconv=/usr/local/bin/libiconv \--with-mcrypt=/usr/local/bin/libmcrypt \--enable-mbstring --disable-pdo --with-curl --disable-debug --disable-rpath \--enable-inline-optimization --with-bz2 --with-zlib --enable-sockets \--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex \--with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli \--with-gd --with-jpeg-dir
- 配置php.ini
cp php.ini-development /usr/local/php/etc/php.ini
安装扩展
#安装
unzip eaccelerator.zip && cd eaccelerator-master
./configure --enable-eaccelerator=shared --with-php-config=/opt/php/bin/php-config
make && make install #配置
zend_extension="/opt/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"#检查是否存在
eaccelerator.shm_size=""
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable=""
eaccelerator.optimizer=""
eaccelerator.check_mtime=""
eaccelerator.debug=""
eaccelerator.log_file = "/opt/php/var/log/eaccelerator_log"
eaccelerator.filter=""
eaccelerator.shm_max=""
eaccelerator.shm_ttl=""
eaccelerator.shm_prune_period=""
eaccelerator.shm_only=""
eaccelerator.compress=""
eaccelerator.compress_level="" #创建目录
mkdir -p /tmp/eaccelerator 配置php-fpm
cp /opt/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf
vi /opt/php/etc/php-fpm.conf
#几处修改,user/group要设好,其它选项可以自己调整
[global]
pid = run/php-fpm.pid
error_log = log/php-fpm.log
emergency_restart_threshold =
emergency_restart_interval = 1m
process_control_timeout = 5s
[www]
user = www
group = www更改php.ini 设置时区
vi etc/php.ini
date.timezone = PRC
- 安装nginx
安装PCRE
wget http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F&ts=1418696677&use_mirror=iwebhttp://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F&ts=1418696677&use_mirror=iweb -O pcre-8.36.tar.gz
mv pcre-8.36.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.%2F pcre-8.36.tar.gz
tar zxvf pcre-8.36.tar.gz && cd pcre-8.36
./configure make && make install- 安装nginx
tar zxvf nginx-1.7..tar.gz && cd nginx-1.7.
./configure --user=www --group=www --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install - 配置nginx
- vim /usr/local/nginx/conf/nginx.conf
user www www;
worker_processes ; error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; pid logs/nginx.pid; events {
use epoll;
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ; gzip on;
gzip_min_length 1k;
gzip_buffers 16k;
gzip_comp_level ;
gzip_types text/plain application/x-javascript text/css application/xml;
server {
listen ;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root /data/www;
index index.html index.htm index.php;
} error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
include fastcgi_params;
} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}启动nginx和php-fpm
/opt/nginx/sbin/nginx
/opt/php/sbin/php-fpm
- 创建存放源码的目录
CentOS6.5 编译安装lnmp环境的更多相关文章
- CentOS编译安装LNMP环境
这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开 ...
- Centos 6.8编译安装LNMP环境
Centos 6.8编译安装LNMP环境 参考资料: http://www.jb51.net/article/107429.htm https://phperzh.com/articles/1360 ...
- SaltStack之编译安装LNMP环境
使用saltstack编译安装LNMP环境 一,系统版本查看 二,安装salt-master和salt-minion 安装配置过程参考SaltStack概述及安装 三,修改配置文件 /etc/salt ...
- centos6源码编译安装lnmp环境
操作系统 版本 64位 CentOS-6.6 10.0.0.20 安装环境所需依赖包 yum -y install gcc automake autoconf libtool make gcc- ...
- centos6.6编译安装lnmp系列之mysql
简介: 环境:虚拟机+centos6.6 Mysql版本:5.6.21 Mysql下载地址:http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.21.t ...
- 源码编译安装lnmp环境(nginx-1.14.2 + mysql-5.6.43 + php-5.6.30 )------踩了无数坑,重装了十几次服务器才会的,不容易啊!
和LAMP不同的是,LNMP中的N指的是Nginx(类似于Apache的一种web服务软件),并且php是作为一个独立服务存在的,这个服务叫做php-fpm,Nginx直接处理静态请求,动态请求会转发 ...
- CentOS6.8 编译安装LNMP
思路:根据Linux系统以及公司网站系统的信息,选择合适的安装包进行安装 一.查看系统信息 # uname -a # 查看内核/操作系统/CPU信息 # /etc/issue # 查看操作系统版本 # ...
- CentOS 6.5 编译安装 LNMP环境
建立一个软件包目录存放 mkdir -p /usr/local/src/ 清理已经安装包 rpm -e httpd rpm -e mysql rpm -e php yum -y remove http ...
- 源码编译安装lnmp环境
一.源码编译安装步骤 首先说明源码安装的好处 速度快,可自定义路径 主要有三步:1.配置 进入源码安装包 ./configure --prefix=/uer/local/nginx 可指定参数 ...
随机推荐
- B树,B-树,B+树,B*树
B树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right): 2.所有结点存储一个关键字: 3.非叶子结点的左指针指向小于其关键字的子树,右指针指向大于其关键字的子树: 如: B ...
- jni cocos2d-x移植到android:helloworld
前面搭建好了android开发环境 jni开发环境,那么就来用一用目前火热的cocos2d的游戏引擎吧 所需资料: cocos2d :下载地址 http://www.oschina.net/p/co ...
- Idea实现WebService实例 转
作者:http://blog.csdn.net/dreamfly88/article/details/52350370 因为工作需要,数据传输部分需要使用webservice实现,经过两天的研究,实现 ...
- 阅读《effective java-第17条》遇到的问题解决与分享
问题背景 最近这2天准备重新看一遍<effective java>,发现这些经典的书籍真的是看一遍又有一遍的感受.也越来越觉的学习的过程是一个重复的过程.这次遇到的问题是在第17条中看到的 ...
- 使用js实现html锚功能,可以任意定位锚的位置,比锚更加灵活
今天记录一个js功能,发现该功能很实用,拿出来跟大家分享. 这里我使用js的window.scrollTo()函数,该函数的用法给大家重复一下,语法为scrollTo(x,y),这里x表示在窗口文档显 ...
- tcpdump来抓取执行的sql语句
# tcpdump -n -nn -tttt -i eth1 -s 65535 'port 3306' -w tcpdump_mysql.ret -C 100 一个TCP包中包含多个mysql协议包, ...
- 通讯录改造——MVC设计模式
将之前用servlet写的程序转化为jsp+servlet的简单的MVC的三层结构.项目中程序的包如图 首先是实体对象: package com.contactSystem.entiey; publi ...
- Android开发环境搭建(图文教程)
昨天又搭建了一次Android的开发环境,尝试了好几种方式,也遇到了一些问题,在此分享一下. 注意:官网公布的最新版本号的SDK和ADT(23.0.0),对于和Eclipse集成的开发环境是有BUG存 ...
- window下手动搭建 PHP+Nginx+Mysql(转)
首先还是下载 nginx: http://nginx.org/en/download.html php : http://windows.php.net/download/ mysql: ht ...
- cocos2dx游戏项目总结(持续更新)
1.在一个layer里面,尽量只使用一种按钮类型.如MenuItem or CCControlButton.因为这两种按钮的优先级不同,在使用过程中会互相影响到事件触发的先后顺序. 2.细节的问题要一 ...