关闭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. 关于prototype以及继承方面的理解

    学习笔记(致 渐悟) 写在前面的话 今天看<javascript高级程序设计>的时候,看到有关继承和原型链prototype时遇到些疑问,特回来研究下,同时也感谢JS群网友"渐悟 ...

  2. hdu 4412 Sky Soldiers DP

    动态规划,主要是用单调性求区间的最小期望. 代码如下: #include<iostream> #include<stdio.h> #include<algorithm&g ...

  3. hdu 1713 相遇周期

    求分数的最小公倍数.对于a/b c/d 先化简为最简分数,分数最小公倍数=分子的最小公倍数/分母的最大公约数. ;}

  4. mapreduce程序编写(WordCount)

    折腾了半天.终于编写成功了第一个自己的mapreduce程序,并通过打jar包的方式运行起来了. 运行环境: windows 64bit eclipse 64bit jdk6.0 64bit 一.工程 ...

  5. Ubuntu 12.04LTS 找不到eth0网卡

    我的机器是DELL 14R INSPRION 7420 笔记本.试了好多方法都不行,比如这个教程: . sudo ifconfig -a //查看所有网卡现状,看eth0是否存在,在结果列表应该找不到 ...

  6. tornado nginx supervisor

    安装:sudo apt-get install python-tornado sudo apt-get install nginx sudo apt-get install supervisor 1. ...

  7. 用Eclipse编写运行Java程序

    1.选择一个空的文件夹,作为workspace工作空间,用来存放你以后用eclipse写的Java程序.(一个workspace可以放很多很多project项目) 2.新建java项目:File-&g ...

  8. MultiSelectListPreference 的使用心得

    最近在学习Android上的开发,打算做一个app.在做之前感觉很简单的功能,自己也有几年的C++经验,应该学起来很容易.但是事实告诉我,要注意的细节还是很多的. 大部分的app都会有设置页面, 用来 ...

  9. 配置Excel的DCOM权限

    异常详细信息: System.UnauthorizedAccessException: 检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000-00000000004 ...

  10. 34. Search for a Range

    题目: Given a sorted array of integers, find the starting and ending position of a given target value. ...