码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS6.5 编译安装lnmp环境

时间:2014-12-16 00:57:41      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   color   os   sp   for   

  1. yum -y install gcc gcc-c++ automake autoconf libtool glibc make
  2. libmcrypt安装
    1. mkdir /usr/local/source && cd /usr/local/source #创建并进入源文件目录
    2. [root@localhost source ]# wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0 #下载libmcrypt
    3. [root@localhost source ]# mv libmcrypt-2.5.7.tar.gz\?modtime\=1171868460\&amp\;big_mirror\=0 libmcrypt-2.5.7.tar.gz #重命名
    4. tar – –zxvf libmcrypt-2.5.7.tar.gz #解压
    5. cd libmcrypt-2.5.7 #进入解压目录
    6. ./configure --prefix=/usr/local/libmcrypt && make && make install #安装

因为编译安装libmcrypt一直出错,运行rpm –q libmcrypt 查看安装的rpm包 发现失败

所以参考了另一篇安装lnmp的文章http://54im.com/tag/libmcrypt

  1. yum -y install 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* #下载安装编译工具和依赖包
  2. yum -y update #更新yum
  3. 下载安装包
    1. mkdir /tmp/source
    2. cd /tmp/source
    3. wget http://nginx.org/download/nginx-1.7.8.tar.gz #最新
    4. wget http://cn2.php.net/distributions/php-5.4.35.tar.bz2#php5.4稳定版 因为php5.5不支持mysql扩展了,暂时不用最新的
    5. wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz #mysql5.6
    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
      1. 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 #删除多余参数的文件名
    7. wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz 
    8. 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
      1. mv mhash-0.9.9.9.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmhash%2Ffiles%2Fmhash%2F0.9.9.9%2F mhash-0.9.9.9.tar.gz #删除多余参数的文件名
    9. 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
      1. mv mcrypt-2.6.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FMCrypt%2F2.6.8%2F mcrypt-2.6.8.tar.gz #删除多余参数的文件名
    10. wget http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
    11. ###暂没有下载 memcache pcre eaccelerator
  4. 安装libiconv、libmcrypt、(#没安装libltdl)、mhash、(#安装make没效果mcrypt),bison
        845  tar zxvf libmcrypt-2.5.8.tar.gz 
        846  cd libmcrypt-2.5.8
        847  ./configure --prefix=/usr/local/libmcrypt
        848  make && make install
       836  tar zxvf libiconv-1.14.tar.gz 
       837  cd libiconv-1.14
       838  ./configure --prefix=/usr/local
       839  make && make install
        850  tar zxvf mhash-0.9.9.9.tar.gz 
        851  cd mhash-0.9.9.9
        854  ./configure --prefix=/usr/mhash
        855  make && make install
  5. 安装cmake

      cd /tmp/
      tar zxvf cmake-2.8.3.tar.gz
      cd cmake-2.8.3/
      ./configure --prefix=/usr
      gmake
      gmake install

  6. 准备用户、目录

    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

  7. 安装mysql
    1. 编译:

    2. tar zxvf mysql-5.6.22.tar.gz
    3. cd mysql-5.6.22
    4. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DSYSCONFDIR=/usr/local/mysql/etc/ -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=on
    5. make && make install
    6. ln -s /usr/local/mysql/lib/lib* /usr/lib/
    7. 配置:

    8. /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql

    9. 自启动

      1. cp /opt/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
        chkconfig --add mysqld
        chkconfig mysqld on
        /etc/rc.d/init.d/mysqld start
        cd /opt/mysql/
        bin/mysql_secure_installation #设置mysql账号密码

  8. 安装php
    1. 编译:

    2. cd /tmp/
      tar zxvf php-5.3.5.tar.gz
      cd php-5.3.5
      ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/opt/mysql --with-mysqli=/usr/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 --disable-safe-mode --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

    3. ./configure --prefix=/usr/local/php  --enable-fpm --with-iconv=/usr/local/libiconv \--with-mcrypt=/usr/local/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

    4. make && make install

      1. 出现undefined reference to `libiconv_open‘错误,需安装libiconv (参考:http://www.weste.net/2013/6-9/92049.html)

      2. wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

      3. tar xzf libiconv-1.14.tar.gz

      4. ./configure --prefix=/soft/lib/libiconv-1.14

      5. make && make install

jdhu 标记:

CentOS6.5 编译安装lnmp环境

标签:style   blog   http   io   ar   color   os   sp   for   

原文地址:http://www.cnblogs.com/jdhu/p/4166190.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!