一个懒癌患者的自言自语



centos7安装lnmp

1.yum更新

yum update

2.安装nginx

2.1安装nginx最新源

yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"

2.2 安装nginx

yum -y install nginx

2.3 启动nginx

service nginx start

2.4 设置nginx服务器开机自启动

systemctl enable nginx.service

2.5 检查开机启动是否设置成功

systemctl list-dependencies | grep nginx

3.安装mysql

3.1添加源

yum -y localinstall  http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"

3.2 安装

yum -y install mysql-community-server install mysql-community-devel

3.3 启动

service mysqld start

3.4 设置开机启动

systemctl enable mysqld.service

3.5 检查开机启动是否设置成功

systemctl list-dependencies | grep mysqld

3.6 设置mysql密码,mysql5.7以后的争强了安全机制, 所以使用yum安装,启动会系统会自动生成一个随机的密码,需要修改mysql密码

3.6.1 查看MySQL随机密码

grep 'temporary password' /var/log/mysqld.log

3.6.2 使用随机密码登录并修改密码

mysql -u root -p 
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yourpassword'; //mysql文档规定,密码必须包括大小写字母数字加特殊符号>8

4. 安装php

4.1 添加源

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
yum repolist enabled | grep "webtatic*"

4.2 安装

yum -y install php72w php72w-fpm
yum -y install php72w-mbstring php72w-common php72w-gd php72w-mcrypt
yum -y install php72w-mysqlnd php72w-xml php72w-cli php72w-devel
yum -y install php72w-pecl-memcached php72w-pecl-redis php72w-opcache

4.3 启动php-fpm

service php-fpm start

4.4 设置php-fpm开机启动

systemctl enable php-fpm.service

4.5检查开机启动是否设置成功

systemctl list-dependencies | grep php-fpm

5.安装redis

5.1 安装源
sudo yum install epel-release
sudo yum update

5.2 安装redis
sudo yum -y install redis

 

5.3 启动
sudo systemctl start redis

 

About ME

about me

kevin

一个在it道路上蹒跚学步的人

心有多大,舞台就有多大,一直奔跑在自己的路上!

Contact ME