LNMP

每次安装源码都会有一些忘记的模块开启;和需要插件;
上次完全做已经多年了,在总结下;

nginx1.10.0
安装目录 /usr/local/nginx
*为支持rewrite安装pcre
# yum install pcre* -y
# yum installl openssl*
yum install gcc gcc-c++ gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel -y
yum install –y autoconf automake imake libxml* expat-devel cmake libaio libaio-devel bzr bison libtool* ncurses5-devel zlib*
# tra -xf nginx-1.10.1.tar.gz 
# cd nginx-1.10.1
# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre 
# yum install make
# make
# make install
查看安装信息;
# /usr/local/nginx/sbin/nginx -V
启动 nginx 
# /usr/local/nginx/sbin/nginx

  启动参数:

-?,-h           : 打开帮助信息
-v              : 显示版本信息并退出
-V              : 显示版本和配置选项信息,然后退出
-t              : 检测配置文件是否有语法错误,然后退出
-q              : 在检测配置文件期间屏蔽非错误信息
-s signal       : 给一个 nginx 主进程发送信号:stop(停止), quit(退出), reopen(重启), reload(重新加载配置文件)
-p prefix       : 设置前缀路径(默认是:/usr/local/nginx/)
-c filename     : 设置配置文件(默认是:/usr/local/nginx/conf/nginx.conf)
-g directives   : 设置配置文件外的全局指令

  直接使用curl命令来读取web信息

# curl -s http://localhost | grep nginx.com
# lsof -i :80
# /usr/local/nginx/sbin/nginx -s stop
# lsof -i :80
重启
# /usr/local/nginx/sbin/nginx -s reload
links 127.0.0.1
mysql 5.6安装;
# yum install –y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses5-devel
# groupadd mysql
# useradd mysql -g mysql -M -s /sbin/login 
(-g 新用户所属的用户组,-M 不建立根目录 /sbin/nologin 不能登录系统 )
wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/mysql-
tar -xf mysql* -C /usr/local/
# tar -xf /root/mysql-5.6.10.tar.gz -C /usr/local/
# cd mysql-5.6.10/
如果发生错误查看:
。。。/mysql-5.6.15/CMakeFiles下的CMakeError.log、CMakeOutput.log文件
注意事项:
重新编译时,需要清除旧的对象文件和缓存信息
find / -name CMakeCache.txt
# rm -rf CMakeCache.txt
# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mysql/data
# make install
# cd /usr/local/mysql
# cd scripts
# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/
提示:
You can start the MySQL daemon with:

cd . ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!
# /usr/local/mysql/bin/mysqld_safe 开启mysql 
# /usr/local/mysql/bin/mysqld_safe --user=mysql (--user=root --datadir )
# /usr/local/mysql/bin/mysqladmin -uroot -p password 'mysql'

  远程连接;

mysql -h 192.168.0.1 -u root -p password

1.显示MYSQL的版本
mysql> select version();


2. 显示当前时间
mysql> select now();

3. 显示年月日
SELECT DAYOFMONTH(CURRENT_DATE); 
SELECT MONTH(CURRENT_DATE); 
SELECT YEAR(CURRENT_DATE);

4. 显示字符串
mysql> SELECT "welecome to my blog!";

5. 当计算器用
select ((4 * 4) / 10 ) + 25;


6. 串接字符串
select CONCAT(f_name, " ", l_name) 
AS Name 
from employee_data 
where title = 'Marketing Executive'; 
+---------------+ 
| Name | 
+---------------+ 
| Monica Sehgal | 
| Hal Simlai | 
| Joseph Irvine | 
+---------------+ 
3 rows in set (0.00 sec) 
注意:这里用到CONCAT()函数,用来把字符串串接起来。另外,我们还用到以前学到的AS给结果列'CONCAT(f_name, " ", l_name)'起了个假名。

  php

安装PHP
yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel -y
yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel
tar -xf php5.6.23.tar.gz -C /usr/local
# mv php5.6 php5 
# cd php5
# ./configure \
--prefix=/usr/local/php5 \
--with-config-file-path=/usr/local/php5/etc \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mhash \
--with-openssl \
--enable-bcmath \
--enable-soap \
--with-libxml-dir \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \

php7
./configure --prefix=/opt/php7 \
--with-config-file-path=/opt/php7/etc \
--with-bz2 \
--with-curl \
--enable-ftp \
--enable-sockets \
--disable-ipv6 \
--with-gd \
--with-jpeg-dir=/opt/php7 \
--with-png-dir=/opt/php7 \
--with-freetype-dir=/opt/php7 \
--enable-gd-native-ttf \
--with-iconv-dir=/opt/php7 \
--enable-mbstring \
--enable-calendar \
--with-gettext \
--with-libxml-dir=/opt/php7 \
--with-zlib \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-mysql=mysqlnd \
--enable-dom \
--enable-xml \
--enable-fpm \
--enable-bcmath \
--with-libdir=lib64
# make
# make install
# ls 
# ls /etc/
# find / -name php.ini
# cp php.ini-development etc/php.ini
# cp etc/php-fpm.conf.default etc/php-fpm.conf

  启动php-fpm
# /usr/local/php5/sbin/php-fpm

添加PHP命令到环境变量;
vi .bash_profile
PATH=$PATH:$HOME/bin
改为:
PATH=$PATH:$HOME/bin:/usr/local/php56/bin
# . .bash_profile
[root@zabbix ~]# . .bash_profile
[root@zabbix ~]# php -v
PHP 5.6.23 (cli) (built: Jun 26 2016 00:24:15) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

 

posted @ 2017-11-19 18:21  01234567  阅读(327)  评论(0)    收藏  举报