0x00 前言

半年前一下要配置很多台服务器的环境,为了节约时间与成本特地做了一键脚本安装 LNMP 环境。

脚本内容适用于 Centos 6.X

0x01 解决方法

脚本源代码如下,LNMP_ONE_KEY.sh - Github Gist

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel mysql-community-server
service mysqld start
chkconfig mysqld on
yum -y install php70w php70w-cli php70w-common php70w-gd php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysql php70w-pdo php70w-pecl-imagick php70w-pecl-redis php70w-opcache php70w-fpm
service php-fpm start
chkconfig php-fpm on
yum -y install redis nginx
service redis start
service nginx start
chkconfig redis on
chkconfig nginx on
service iptables stop
setenforce 0
getenforce