源码安装lnmp

1.nginx http://nginx.org/en/docs/configure.html

2.php http://php.net/manual/en/install.unix.nginx.php

3.cmake http://www.cmake.org/download/

4.mysql

/lnmp/cmake/bin/cmake
-DCMAKE_INSTALL_PREFIX=/lnmp/mysql
-DMYSQL_DATADIR=/lnmp/mysql/data
-DSYSCONFDIR=/lnmp/mysql/etc
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_MEMORY_STORAGE_ENGINE=1
-DWITH_READLINE=1
-DMYSQL_UNIX_ADDR=/lnmp/mysql/mysql.sock
-DMYSQL_TCP_PORT=3306
-DENABLED_LOCAL_INFILE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DEXTRA_CHARSETS=all
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci

make && make install

yum -y install ncurses-devel

新安装的mysql如果需要密码,查看cat /root/.mysql_secret中即为mysql的默认root密码

进入后set password=”123456”;

安装完成后需要添加php扩展,先cd到php安装源文件ext/gd(以安装gd为例)

/php路径/bin/phpize 生成configure文件

./configure –with-php-config=/php路径/bin/php-config

php查看安装的模块php -m

加入环境变量例子(环境变量地址:/etc/profile)

PATH=/lnmp/mysql/bin:$PATH

export PATH

source /etc/profile