centos6搭建lnmp环境

Nginx安装

  • yum install -y pcre pcre-devel openssl openssl-devel gcc gcc-c++
  • wget https://nginx.org/download/ng…
  • tar zxf nginx-1.14.0.tar.gz
  • cd nginx-1.14.0
  • groupadd www
  • useradd -g www www
  • ./configure –prefix=/usr/local/nginx –sbin-path=/usr/local/nginx/sbin/nginx –conf-path=/usr/local/nginx/nginx.conf –pid-path=/usr/local/nginx/nginx.pid –user=www –group=www –with-http_ssl_module –with-http_stub_status_module –with-http_gzip_static_module –with-http_realip_module –http-client-body-temp-path=/var/tmp/nginx/client/ –http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ –http-uwsgi-temp-path=/var/tmp/nginx/uwsgi/ –http-scgi-temp-path=/var/tmp/nginx/scgi/
  • make && make install
  • mkdir -p /var/tmp/nginx/client/
  • /usr/local/nginx/sbin/nginx -c /usr/local/nginx/nginx.conf

PHP安装

  • yum -y install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel epel-release icu libicu
  • wget https://ftp.gnu.org/pub/gnu/l…
  • tar zxf libiconv-1.15.tar.gz
  • ./configure –prefix=/usr/local/libiconv
  • make && make install
  • yum -y install mhash
  • wget -O php-7.2.8.tar.gz http://cn2.php.net/get/php-7….
  • tar zxf php-7.2.8.tar.gz
  • ./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-curl –with-freetype-dir –with-gd -with-gettext –with-iconv-dir –with-libdir=lib64 –with-libxml-dir –with-openssl –with-pcre-regex –with-pdo-mysql –with-png-dir –with-xmlrpc –with-zlib –with-mhash –with-jpeg-dir –enable-fpm –enable-bcmath –enable-libxml –enable-inline-optimization –enable-mbregex –enable-mbstring –enable-opcache –enable-pcntl –enable-xml –enable-zip –enable-intl –enable-mysqlnd –disable-rpath –disable-fileinfo –with-fpm-user=www –with-fpm-group=www
  • make
  • http://bbs.xiuno.com/thread-1…
  • make install
  • cp php.ini-production /usr/local/php/etc/php.ini
  • cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  • cd /usr/local/php/etc
  • cp php-fpm.conf.default php-fpm.conf
  • cp php-fpm.d/www.conf.default php-fpm.d/www.conf
  • chmod +x /etc/init.d/php-fpm
  • /usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php-fpm.conf

Redis安装

  • wget http://download.redis.io/rele…
  • tar zxf redis-4.0.11.tar.gz
  • cd redis-4.0.11
  • make
  • cd src
  • make install
  • mkdir -p /usr/local/redis/bin
  • mkdir -p /usr/local/redis/etc
  • cd ..
  • cp redis.conf /usr/local/redis/etc/
  • cd src
  • cp mkreleasehdr.sh redis-benchmark redis-check-aof redis-cli redis-server /usr/local/redis/bin
  • vi /usr/local/redis/etc/redis.conf
  • daemonize yes
  • /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
  • /usr/local/php/bin/pecl install redis
  • extension=redis.so

MySQL安装

  • yum -y install gcc gcc-c++ ncurses ncurses-devel cmake bison make
  • groupadd mysql
  • useradd -g mysql mysql
  • wget https://sourceforge.net/proje…
  • tar zxf boost_1_59_0.tar.gz
  • wget https://cdn.mysql.com//archiv…
  • tar zxf mysql-5.7.9.tar.gz
  • cd mysql-5.7.9
  • mkdir -p /data/mysql
  • mkdir -p /usr/local/mysql
  • cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/data/mysql \
-DWITH_BOOST=../boost_1_59_0 \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DWITH_EMBEDDED_SERVER=1

  • make
  • make install
  • cd /usr/local/mysql/
  • chown -R root.mysql .
  • chown -R mysql.mysql /data/
  • cp support-files/my-default.cnf /etc/my.cnf
  • cp support-files/mysql.server /etc/init.d/mysqld
  • /usr/local/mysql/bin/mysqld –initialize-insecure –user=mysql –basedir=/usr/local/mysql/ –datadir=/data/mysql/
  • /usr/local/mysql/support-files/mysql.server –initialize-insecure –user=mysql –basedir=/usr/local/mysql –datadir=/data/mysql
  • /usr/local/mysql/support-files/mysql.server start
  • echo “/usr/local/mysql/lib” > /etc/ld.so.conf.d/mysql.conf

Composer安装

系统命令添加

  • cp /usr/local/php/bin/php /usr/local/bin/
  • cp /usr/local/mysql/support-files/mysql.server /usr/local/bin/
  • cp /usr/local/mysql/bin/mysql /usr/local/bin/
  • cp /usr/local/nginx/sbin/nginx /usr/local/bin/
    原文作者:孙志超
    原文地址: https://segmentfault.com/a/1190000016115428
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞