CentOS7下yum安装LNMP

241673629.webp
提醒:本文章可能不完整。

这个Logo是采用了L[Linux]N[Nginx]M[MySQL]P[PHP]原先中的Logo的字体实现的,虽然非常之丑,但总体上还算是勉强可以接受吧,就先用着好了~
先前使用秋水逸冰的一份良久失修的yum安装Lamp的脚本出了点错误,于是兔子就来手动安装啦~
首先当然是准备本地的环境啦,这里采用的是CentOS7.4,全文已经在此环境上进行测试,虚拟机为KVM虚拟化。
必不可少的步骤还是需要的

yum -y update
yum -y install epel-release
yum -y install wget unzip vim python-pip
yum -y groupinstall "Development Tools"

接下来开始漫长的安装过程,首先安装Nginx

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum -y install nginx
service nginx start
chkconfig nginx on
service nginx restart

然后就应该已经安装好啦,可以通过 nginx -v 命令查看下是否安装完成。
打开对应的IP地址,看到熟悉的 Welcome to nginx!
接下来开始MySQL的安装,这里我们选择比较老的MySQL5.5版本,因为新版本的过于占用内存,而yum安装一般是被用作给小内存机子的选择,而5.2版本又太过于良久失修,因此这里权衡一下。

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm

修改 /etc/yum.repos.d/mysql-community.repo 文件,将MySQL5.6部分的值设为0,同时将5.5部分的值设为1

yum -y install mysql-community-server
service mysqld restart
chkconfig mysqld on
grep 'temporary password' /var/log/mysqld.log

开始安装PHP部分

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install openssl-devel openssl pkgconfig
yum -y install php72w php72-fpm
yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel
yum -y install php72w-opcache php72w-cli php72w-common php72w-dba php72w-devel php72w-embedded php72w-enchant php72w-fpm php72w-gd php72w-imap php72w-interbase php72w-intl php72w-ldap php72w-mbstring php72w-mysqlnd php72w-odbc php72w-pdo php72w-pdo_dblib php72w-pear php72w-pecl-apcu php72w-pecl-imagick php72w-pecl-xdebug php72w-pgsql php72w-phpdbg php72w-process php72w-recode php72w-snmp php72w-soap php72w-tidy php72w-xml php72w-xmlrpc
systemctl start php-fpm.service
chkconfig php-fpm on

参考资料:
https://www.jianshu.com/p/1e51985b46dd
http://blog.p2hp.com/archives/4005
https://www.jianshu.com/p/8d54a401ec06
https://phperzh.com/articles/4364

Last modification:May 24th, 2018 at 08:14 pm

One comment

  1. kot4ri

    等一个更新

Leave a Comment