解压缩一键安装包
我们把 LNMP 一键安装包保存在 /usr/local/src/ 目录下,第一步仍然是解压缩一键安装包。命令如下:
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# tar -zxvf lnmp1.0-full.tar.gz
执行安装脚本安装 LNMP 一键安装包
既然是脚本安装包,那就不需要我们一个一个手工安装了,只要执行安装脚本 centos.sh 即可自动安装(Debian 中执行脚本为 debian.sh,Ubuntu 中执行脚本为 ubuntu.sh)。命令如下:
[root@localhost src]# cd lnmp1.0-full
[root@localhost lnmp1.0-full]#./centos.sh
==========================================================
LUMP V1.0 for CentOS/RadHat Linux VPS Written by Licess
==========================================================
A tool to auto-compile & install Nginx+MySQL+PHP on Linux
For more information please visit http://www.lnmp.org/
==========================================================
Please input the root password of mysql:
(Default password: root) : 123 #设定MySQL 的密码,这里设为 123
==========================================================
Do you want to install the InnoDB Storage Engine?
(Default no,if you want please input: y , if not please press the enter button):y
#是否需要安装MySQL InnoDB,如果需要安装则输入y
Install PHP 5.3.17,Please input y
Install PHP 5.2.17,Please input n or press Enter
(Please input y or n) :y
#选择安装PHP的版本,输入y安装的是5.3.17
Install MySQL 5.5.27,Please input y
Install MySQL 5.1.60,Please input n or press Enter
(Please input y or n) :y
#选择安装MySQL的版本,输入y安装的是5.5.27
Press any key to start. . .or Press Ctrl+c to cancel #按任意鍵开始安装
具体的安装时间要视 Linux 服务器的性能而定,可能会等待几十分钟。如果大家有兴趣,则可以查看一下 centos.sh 这个安装脚本,看看它是如何实现自动安装的。如果看到以下界面,则证明安装成功。
=========================================================
Manager for LNMP VI.0 , Written by Licess
=========================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to Manage status of lnmp
For more information please visit http://www.lnmp.org
Usage: /root/lnmp {start|stop|reload|restart|kill|status}
=========================================================
Nginx is runing!
php-fpm is runing!
MySQL running (12489) [确定]
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:53575 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 :::57454 :::* LISTEN
tcp 0 0 :::111 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:631 :::* LISTEN
tcp 0 0 ::1:25 :::* LISTEN
LNMP一键安装包安装的软件及具体位置
既然是一键安装,那么默认安装的软件和软件的安装位置都是事先设定好的,在安装过程中不能更改。具体安装了哪些软件及其位置如表 1 所示。也就是说,LNMP 一键安装只安装了基本的 Nginx、MySQL、PHP、phpMyAdmin 和 Zend Optimizer。