lnmp环境搭建

lnmp环境搭建

安装nginx
  1. 添加nginx到yum源

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

  1. 安装nginx

yum -y install nginx

  1. 启动nginx

systemctl start nginx

  1. 开机启动nginx

systemctl enable nginx

安装mysql
  1. 下载yum rpm包

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

  1. 安装rpm包

rpm -ivh mysql57-community-release-el7-11.noarch.rpm

  1. 安装mysql-server

yum -y install mysql-server

  1. 启动mysql

systemctl start mysqld

  1. 开机启动mysql

systemctl enable mysqld

  1. 查询初始密码

cat /var/log/mysqld.log|grep 'A temporary password'

  1. 初始密码登录

mysql -u root -p

8.修改root用户密码

set password for root@localhost = password('123456');

安装php
  1. 添加php到yum源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

  1. 安装php及扩展

yum install php71w php71w-fpm php71w-cli php71w-common php71w-devel php71w-gd php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath

  1. 启动php

systemctl start php-fpm

  1. 开机启动php

systemctl enable php-fpm