ls0398 发表于 2018-10-8 09:14:16

mysql+php+mem+openresty

  ###########mysql###########
  1. mysql安装
  (1)tar zxf mysql-boost-5.7.17.tar.gz
  (2)yum install cmake-2.8.12.2-4.el6.x86_64.rpm-y
  cd mysql-5.7.17/
  (3)cmake-DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql-DMYSQL_DATADI=/usr/local/lnmp/mysql/data-DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_NGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_BOOST=boost/boost_1_59_0/
  (4)根据报错依次安装需要的包,没有错误之后执行下一步
  (5)myaqlMake && make install
  2.Mysql 配置
  # groupadd -g 27 myaql
  # useradd -u 27 -g 27 -s /sbin/nologin -M -d /usr/local/lnmp/mysql/ mysql
  # id mysql
  uid=27(mysql) gid=27(myaql) groups=27(myaql)
  # cd /usr/local/lnmp/mysql/
  # chown mysql.mysql . -R
  # cd support-files/
  # ls
  magicmy-default.cnfmysqld_multi.servermysql-log-rotatemysql.server
  # ll /etc/my.cnf
  -rw-r--r--. 1 root root 251 Aug92013 /etc/my.cnf
  # cp my-default.cnf /etc/my.cnf
  cp: overwrite `/etc/my.cnf'? y
  # cp mysql.server /etc/init.d/mysqld
  # mysqld --initialize --user=mysql    ##进行初始化
  # chown root.root . -R
  # chown mysql data -R
  # ll

  # /etc/init.d/mysqld start
  Starting MySQL.Logging to '/usr/local/lnmp/mysql/data/server1.err'.
  SUCCESS!
  # mysql_secure_installation   ##密码设置由大小写数字符号组成
  3..php安装
  Tar zxf php-5.6.20.tar.bz2
  Cd php-5.6.20
  ./configure--prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-gmp --with-gettext --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-fpm --enable-mbstring --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash
  随着提示安装所需要的包
  yum install libmcrypt-2.5.8-9.el6.x86_64.rpm libmcrypt-devel-2.5.8-9.el6.x86_64.rpm -y
  yum install libxml2-devel -y
  yum install -y bison
  yum install curl-devel freetype-devel gmp-devel net-snmp-devel -y
  yum install re2c-0.13.5-1.el6.x86_64.rpm -y
  yum provides */png.h
  yum install -y libpng-devel-1.2.49-1.el6_2.x86_64
  yum provides */jpeglib.h
  yum install libjpeg-turbo-devel -y
  Make && make install
  4.php配置
  # cd php-5.6.20
  # cd sapi/
  # cd fpm/
  # file init.d.php-fpm
  init.d.php-fpm: POSIX shell script text executable
  # cp init.d.php-fpm /etc/init.d/php-fpm
  # chmod +x /etc/init.d/php-fpm
  # cd /usr/local/
  # cd lnmp/php/etc/
  # vim php.ini

  # cp php-fpm.conf.default php-fpm.conf
  # vim php-fpm.conf

  # /etc/init.d/php-fpm start
  Starting php-fpmdone
  # vim ~/.bash_profile

  # source ~/.bash_profile
  # netstat -antlp |grep :9000
  tcp      0      0 127.0.0.1:9000            0.0.0.0:*                   LISTEN      1374/php-fpm
  # ln -s /usr/local/lnmp/nginx/sbin/nginx /sbin/
  # vim nginx.conf


  # nginx
  # netstat -antlp| grep :80
  Active Internet connections (servers and established)
  Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
  tcp      0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      1418/nginx
  # vim index.php

  # /etc/init.d/iptables stop
  测试:

  5..论坛
  # unzip Discuz_X3.2_SC_UTF8.zip
  # mv upload/ /usr/local/lnmp/nginx/html/bbs
  # cd /usr/local/lnmp/nginx/html/bbs
  # chmod 777 config/ data/ uc_client/ uc_server/ -R
  # cd /usr/local/lnmp/php/etc/
  # vim php.ini



  # chmod 755 /usr/local/lnmp/mysql/data/
  # /etc/init.d/php-fpm reload
  测试:

  6.Memcache
  # tar zxf memcache-2.2.5.tgz
  # cd memcache-2.2.5
  # phpize
  Configuring for:
  PHP Api Version:         20131106
  Zend Module Api No:      20131226
  Zend Extension Api No:   220131226
  # ./configure
  # make && make install
  # which php
  /usr/local/lnmp/php/bin/php
  # cd /usr/local/lnmp/php/etc/
  # rpm -e `rpm -qa|grep php`
  # vim php.ini

  # /etc/init.d/php-fpm reload
  Reload service php-fpmdone
  # php -m |grep memcache
  memcache
  # cd memcache-2.2.5
  # yum install -y memcached
  # /etc/init.d/memcached start
  Starting memcached:                                       
  # cp example.php memcache.php/usr/local/lnmp/nginx/html/
  # cd /usr/local/lnmp/nginx/html/
  # ls
  50x.htmlbbsexample.phpindex.htmlindex.phpmemcache.php
  # vim memcache.php

  # /etc/init.d/memcached reload
  Stopping memcached:                                       
  Starting memcached:                                       
  测试:

  7.openresty   ##openresty是一个基于nginx的可伸缩web平台,使用lua并编写脚本,然后部署到ngnix web容器中运行,从而能更轻松开发出高性能的web服务
  tar zxf openresty-1.11.2.3.tar.gz
  cd openresty-1.11.2.3
  ./configure
  Gmake && gmake install
  cd /usr/local/openresty/nginx/conf/
  vim nginx.conf



  # netstat -antlp | grep :11211

  nginx -s reload
  /etc/init.d/memcachedreload
  测试:
  $ ab -c10 -n5000 http://172.25.254.11/index.php


页: [1]
查看完整版本: mysql+php+mem+openresty