关闭SELINUX

vi /etc/selinux/config

#SELINUX=enforcing #注释掉

#SELINUXTYPE=targeted #注释掉

SELINUX=disabled #增加

:wq!  #保存退出

setenforce 0 #使配置立即生效

mysql 5.5.28安装

安装路径:/usr/local/mysql
数据库路径:/usr/local/mysql/data/

mysql从5.5版本开始,不再使用./configure编译,而是使用cmake编译器,具体的cmake编译参数可以参考mysql官网文档
http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html

添加MYSQL用户和组
[root@localhost tools]#groupadd mysql
[root@localhost tools]#useradd mysql -g mysql -s /sbin/nologin

[root@localhost tools]#yum install cmake make -y
[root@localhost tools]#yum -y install gcc gcc-c++ autoconf bison automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*  #安装依赖包
[root@localhost tools]# cd mysql-5.5.28-linux2.6-i686

配置编译参数
[root@localhost tools]#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
                    -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
                    -DDEFAULT_CHARSET=utf8 \
                    -DDEFAULT_COLLATION=utf8_general_ci \
                    -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
                    -DWITH_INNOBASE_STORAGE_ENGINE=1 \
                    -DWITH_READLINE=1 \
                    -DENABLED_LOCAL_INFILE=1 \
                    -DMYSQL_DATADIR=/usr/local/mysql/data/ \
                    -DMYSQL_TCP_PORT=3306
                    
[root@localhost tools]#CMake Error: The source directory "/root/tools/mysql-5.5.28-linux2.6-x86_64" does not appear to contain CMakeLists.txt.
编译安装时出现上述错误,GOOGLE了一下,发现是下载的包有问题,重新到http://downloads.mysql.com/archives/community/下载源码,版本选5.5.28,
Select Platform:这里选择Source Code,然后在底部找到Generic Linux (Architecture Independent), Compressed TAR Archive(mysql-5.5.28.tar.gz)选下载

[root@localhost tools]#make && make install
[root@localhost tools]#cd /usr/local
[root@localhost tools]#chown mysql.mysql -R mysql  #设置MYSQL目录权限
[root@localhost tools]#cd mysql
[root@localhost tools]#cp support-files/my-medium.cnf /etc/my.cnf  #复制配置文件
[root@localhost tools]#./scripts/mysql_install_db  --user=mysql  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
[root@localhost tools]#cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost tools]#chkconfig mysqld on  #设置开机启动
[root@localhost tools]#service mysqld start   #启动mysql服务
[root@localhost tools]#/usr/local/mysql/bin/mysqladmin -u root password '123456789'  #设置mysql root用户密码

删除root密码为空的记录
[root@localhost tools]#/usr/local/mysql/bin/mysql -u root -p #输入刚才设置的密码
mysql> use mysql;
mysql> delete from user where password='';
mysql> flush privileges;      #更新权限
mysql> grant all privileges on *.* to root@'%' identified by "root";  #允许ROOT用户远程登陆
mysql> flush privileges;
mysql> quit

php-5.3.28安装

安装依赖包
[root@localhost tools]#yum -y install 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 
[root@localhost tools]#yum -y install gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel curl-devel freetype-devel 
#Nginx
[root@localhost tools]#yum -y install pcre-devel 
#下载PHP库文件
wget http://ncu.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
wget http://ncu.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
wget http://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz 
wget http://nchc.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2
#Nginx
wget http://nginx.org/download/nginx-1.5.10.tar.gz 
#Nginx(pcre)
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz

解压下载的库文件夹

[root@localhost tools]#cd libiconv-1.14
[root@localhost tools]#./configure --prefix=/usr/local
[root@localhost tools]#make && make install
[root@localhost tools]#cd ../

[root@localhost tools]#cd libmcrypt-2.5.8
[root@localhost tools]#./configure
[root@localhost tools]#make && make install
[root@localhost tools]#/sbin/ldconfig  #使所有的库文件都被缓存到ld.so.cache中,避免编译过程中报错找不到库文件
[root@localhost tools]#cd ../
[root@localhost tools]#cd libltdl
[root@localhost tools]#./configure --enable-ltdl-install
[root@localhost tools]#make && make install
[root@localhost tools]#cd ../../

[root@localhost tools]#cd mhash-0.9.9.9
[root@localhost tools]#./configure
[root@localhost tools]#make && make install
[root@localhost tools]#cd ../

[root@localhost tools]#ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
[root@localhost tools]#ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
[root@localhost tools]#ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
[root@localhost tools]#ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
[root@localhost tools]#ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
[root@localhost tools]#ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
[root@localhost tools]#ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
[root@localhost tools]#ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
[root@localhost tools]#ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
[root@localhost tools]#ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
[root@localhost tools]#ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib/
[root@localhost tools]#ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

[root@localhost tools]#cd mcrypt-2.6.8
[root@localhost tools]#/sbin/ldconfig
[root@localhost tools]#./configure
[root@localhost tools]#make && make install
[root@localhost tools]#cd ../

[root@localhost tools]#cd php-5.3.28
[root@localhost tools]#./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --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
[root@localhost tools]#make && make install
[root@localhost tools]#
[root@localhost tools]#cp php.ini-production /usr/local/php/etc/php.ini
[root@localhost tools]#ln -s /usr/local/php/etc/php.ini /etc/php.ini
[root@localhost tools]#cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost tools]# chmod a+x /etc/init.d/php-fpm
[root@localhost tools]#chkconfig php-fpm on
[root@localhost tools]#cd /usr/local/php/etc/
[root@localhost tools]#cp php-fpm.conf.default php-fpm.conf
[root@localhost tools]#vi php-fpm.conf

把;pid = run/php-fpm.pid前面的分号去掉=>pid = run/php-fpm.pid
user = nobody 改为user = www
group = nobody 改为group = www
保存退出
[root@localhost tools]#cd /root/tool
[root@localhost tools]#tar -xjvf eaccelerator-0.9.6.1.tar.bz2
[root@localhost tools]#cd eaccelerator-0.9.6.1
[root@localhost tools]#/usr/local/php/bin/phpize
[root@localhost tools]#./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
[root@localhost tools]# make && make install
[root@localhost tools]#mkdir /tmp/eaccelerator
[root@localhost tools]#chmod 0777 /tmp/eaccelerator
[root@localhost tools]#vi /etc/php.ini
修改;extension_dir = "./" 为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626"

在结尾处添加
[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
:x保存退出

重启PHP
[root@localhost tools]#/etc/rc.d/init.d/php-fpm restart

安装NGINX 1.2.9
[root@localhost tools]# cd pcre-8.34
[root@localhost tools]# ./configure
[root@localhost tools]# make && make install
[root@localhost tools]# cd ..
[root@localhost tools]# cd nginx-1.2.9
[root@localhost tools]# ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre
[root@localhost tools]# make && make install
[root@localhost tools]# ulimit -SHn 65535
[root@localhost tools]# ln -s /usr/local/lib/libpcre.so.1 /lib #解决启动时找不到libpcre.so.1这个模块的问题
[root@localhost tools]# vi /usr/local/nginx/conf/nginx.conf
#nginx配置文件内容
user  www www;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;
worker_rlimit_nofile 65535;

events {
    use epoll;
    worker_connections  65535;
}

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  ;
    charset utf-8;
    server_names_hash_bucket_size 128;#服务器名字的hash表大小
    client_header_buffer_size 32k;#设置客户端的请求头的header buffer的大小
    large_client_header_buffers 4 64k;#用来指定客户端请求中较大的消息头缓存的最大数量和大小
    client_max_body_size 8m;#设置允许客户端请求的最大的单个文件的字节数
    sendfile        on;#开启高效文件传输模式
    tcp_nopush     on;#防止网络阻塞
    tcp_nodelay on; #防止网络阻塞
    keepalive_timeout 60; #长连接超时时间,单位是秒
    #FastCGI相关参数是为了改善网站的性能:减少资源占用,提高访问速度。下面参数看字面意思都能理解。
    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模块设置
    gzip on; #开启gzip压缩输出
    gzip_min_length 1k; #最小压缩文件大小
    gzip_buffers 4 16k; #压缩缓冲区
    #gzip_http_version 1.0; #压缩版本(默认1.1,前端如果是squid2.5请使用1.0)
    gzip_comp_level 2; #压缩等级
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;
    
  
    server {
        listen       80;
        server_name  www.test.com test.com 192.168.1.33;
        root /home/web/test;
        #charset utf-8;

access_log  logs/test.access.log ;
    index index.php index.html index.htm;
        location / {
            root   /home/web/test;
            index  index.php index.html index.htm;
        }

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
        #    root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi.conf;
        }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
              expires      30d;
        }
    location ~ .*\.(js|css)?$
    {
          expires      1h;
        }

# deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
}

[root@localhost tools]#service iptables stop #关闭防火墙,不然访问不到网站目录

安装memcache,imagemagick php扩展

wget wget http://monkey.org/~provos/libevent-2.0.12-stable.tar.gz
wget http://www.memcached.org/files/memcached-1.4.17.tar.gz
wget http://pecl.php.net/get/memcache-3.0.8.tgz
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
wget http://pecl.php.net/get/imagick-3.1.2.tgz

[root@localhost tools]# cd libevent-2.0.12-stable
[root@localhost tools]# ./configure
[root@localhost tools]# make && make install
[root@localhost tools]# cd ..

[root@localhost tools]# cd memcached-1.4.17
[root@localhost tools]# ./configure
[root@localhost tools]# make && make install
[root@localhost tools]# cd ..

[root@localhost tools]# ldconfig /usr/local/lib
[root@localhost tools]# /usr/local/bin/memcached -d -m 128 -l 192.168.1.33 -p 11211 -u www  #d daemon 以守护程序(daemon)方式运行 memcached -l监听地址 -m内存
[root@localhost tools]# cd memcache-3.0.8  #安装PHP扩展
[root@localhost tools]# /usr/local/php/bin/phpize
[root@localhost tools]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@localhost tools]# make && make install
[root@localhost tools]# cd ..

安装imagemagick,linux下的图片处理程序和PDO PHP扩展
 
[root@localhost tools]# cd ImageMagick-6.8.9-0
[root@localhost tools]# ./configure
[root@localhost tools]# make && make install
[root@localhost tools]# cd ..

[root@localhost tools]# cd imagick-3.1.2 #安装PHP下的扩展
[root@localhost tools]# /usr/local/php/bin/phpize
[root@localhost tools]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@localhost tools]# make && make install
[root@localhost tools]#cd ..

[root@localhost tools]#cd php-5.3.28/ext/pdo_mysql
[root@localhost tools]#/usr/local/php/bin/phpize
[root@localhost tools]#./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql/
[root@localhost tools]#make && make install
[root@localhost tools]# vi /etc/php.ini

添加extension=memcache.so
     extension=imagick.so
     extension=pdo_mysql.so

linux lnmp编译安装的更多相关文章

  1. LNMP编译安装教程

    LNMP编译安装教程 此次安装在Centos上,我采用的CentOS的版本是:CentOS release 6.5 (Final) 可以通过以下命令查看:lsb_release -a 一.准备工作: ...

  2. LINUX下编译安装PHP各种报错大集合

    本文为大家整理汇总了一些linux下编译安装php各种报错大集合 ,感兴趣的同学参考下. nginx1.6.2-mysql5.5.32二进制,php安装报错解决: 123456 [root@clien ...

  3. linux下编译安装vim7.4并安装clang_complete插件

    linux下编译安装vim7.4并安装clang_complete插件 因为debian里软件仓库中下载安装的vim是不支持python写的插件的(可以打开vim,在命令模式先输入:py测试一下),导 ...

  4. linux PHP 编译安装参数详解

    linux PHP 编译安装参数详解 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc -- ...

  5. linux下编译安装curl

    linux下编译安装curl 1.下载curl git clone https://github.com/curl/curl.git 2.在curl目录下生成configure文件 ./buldcon ...

  6. linux下编译安装boost库

    linux下编译安装boost库 linux下编译安装boost库 1.下载并解压boost 1.58 源代码 下载 解压 2.运行bootstrap.sh 3.使用b2进行构建 构建成功的提示 4. ...

  7. Linux下编译安装Apache Http Server

    Linux下编译安装Apache Http Server [TOC] 1.下载httpd-2.4.12.tar.bz2 wget http://mirror.bit.edu.cn/apache/htt ...

  8. Linux下编译安装qemu和libvirt

    目录 [hide] 1 安装qemu 1.1 qemu介绍 1.2 下载源文件 1.3 编译安装 2 安装libvirt 2.1 libvirt介绍 2.2 下载libvirt 2.3 编译安装 3  ...

  9. linux下编译安装nginx

    1.首先下载稳定版nginx1.10.2 使用wget命令下载 wget http://nginx.org/download/nginx-1.10.2.tar.gz 2.然后解压 tar -zxvf  ...

随机推荐

  1. Window 2008 R2 + IIS7.5 + VS2013 错误代码 0x80070002

    HTTP 错误 404.0 - Not Found 您要找的资源已被删除.已更名或暂时不可用.详细错误信息模块 IIS Web Core通知 MapRequest Handler处理程序 Static ...

  2. windows下创建.htaccess文件之讲解

    如果想在Windows操作系统下新增一个.htaccess 文件实现对页面的rewrite,任你如何右点鼠标或者选文件->新增去新增都不会成功的,Windows都会要求给个文件名称.如果你想通过 ...

  3. SystemInfo.deviceUniqueIdentifier 返回机器码

    SystemInfo.deviceUniqueIdentifier 返回机器码

  4. ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):

    eclipse中进行java debug调试时出现上述问题. solution:请在代码最后加入以下语句:System.exit(0)即可.

  5. zoj 2777 Visible Lattice Points(欧拉函数,基础)

    题目 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> #include<algo ...

  6. Struts 2知识回顾----拦截器(Intercept)总结

    什么是Struts 2拦截器? 从软件构架上来说,拦截器是实现了面向方面编程的组件.它将影响了多个业务对象的公共行为封装到一个个可重用的模块,减少了系统的重复代码,实现功能的高度内聚,确保了业务对象的 ...

  7. Android ActionBar 关于tab的应用 以及 TabListener的方法详解

    actionBar的tab标签应用以及TabListener的方法详解 package com.example.actionBarTest.actionBarTab; import android.a ...

  8. Thread的第四天学习

    线程通信 wait notify synchronized + 同对象 才可 互斥 锁不是放在线程上的,放在共享资源内部的. wait 线程等待 notify 线程唤醒

  9. 李洪强iOS开之【零基础学习iOS开发】【02-C语言】04-常量、变量

    在我们使用计算机的过程中,会接触到各种各样的数据,有文档数据.图片数据.视频数据,还有聊QQ时产生的文字数据.用迅雷下载的文件数据等.这讲我们就来介绍C语言中数据的处理. 一.数据的存储 1.数据类型 ...

  10. linux服务器下发送邮件

    系统管理人员经常会遇到对于设备或者任务的预警与通知,通常情况有发送短信.邮件等方式.发送短信一般来说需要有短信猫(硬件)或者调用libfetion给飞信用户发送.本文介绍几种简单的发送邮件的方式. 本 ...