centos6.5 yum安装lnmp

https://fedoraproject.org/wiki/EPEL?rd=EPEL/en(linux企业包)

https://blog.csdn.net/For_My_Own_Voice/article/details/81184763

https://www.cnblogs.com/renjidong/p/7047396.html

https://blog.csdn.net/zhaozuosui/article/details/48394409

 https://blog.itnmg.net/2012/09/17/centos-yum-source/

http://bbs.idcspy.com/thread-911537-1-1.html

安装过程中碰到yum 好多软件无法安装的现象,这时候可以安装linux企业包,更新yum源

//安装企业包

yum -y install epel-release

更新yum源头

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

//安装nginx

yum install nginx

##开启

nginx service nginx start

##加入开机启动项

chkconfig mysqld on

 

 

mysql5.6安装

1.新开的云服务器,需要检测系统是否自带安装mysql

# yum list installed | grep mysql

2.如果发现有系统自带mysql,果断这么干

# yum -y remove mysql-libs.x86_64

3.随便在你存放文件的目录下执行,这里解释一下,由于这个mysql的yum源服务器在国外,所以下载速度会比较慢,还好mysql5.6只有79M大,而mysql5.7就有182M了,所以这是我不想安装mysql5.7的原因

# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

4.接着执行这句,解释一下,这个rpm还不是mysql的安装文件,只是两个yum源文件,执行后,在/etc/yum.repos.d/ 这个目录下多出mysql-community-source.repo和mysql-community.repo

# rpm -ivh mysql-community-release-el6-5.noarch.rpm

5.这个时候,可以用yum repolist mysql这个命令查看一下是否已经有mysql可安装文件

#yum repolist all | grep mysql

6.安装mysql 服务器命令(一路yes):

# yum install mysql-community-server

7.安装成功后

# service mysqld start

8.由于mysql刚刚安装完的时候,mysql的root用户的密码默认是空的,所以我们需要及时用mysql的root用户登录(第一次回车键,不用输入密码),并修改密码

# mysql -u root
# use mysql;
# update user set password=PASSWORD("这里输入root用户密码") where User='root';
# flush privileges; 

9.查看mysql是否自启动,并且设置开启自启动命令

 
# chkconfig --list | grep mysqld
# chkconfig mysqld on

10.mysql安全设置(系统会一路问你几个问题,看不懂复制之后翻译,基本上一路yes):

# mysql_secure_installation

安装php(有时候会有php包没有的情况 这时候添加 php 源 上边的地址5里边有)


//安装php7
yum install php70w  php70w-devel php70w-fpm php70w-gd php70w-mysqli php70w-mbstring


安装Nginx和php见前面的blog(nginx支持php)

编辑nginx.conf

vi /usr/local/nginx/conf/nginx.conf
#追加index.php让nginx服务器默认支持index.php为首页

        location / {
            root   html;
            index  index.html index.htm index.php;
try_files $uri $uri/ /index.php?$args; } #然后配置.php请求被传送到后端的php-fpm模块,默认情况下php配置块是被注释的,此时去掉注释并修改为以下内容 #修改fastcgi_param中的/scripts为$document_root

location ~ \.php$ {
# 设置监听端口
fastcgi_pass 127.0.0.1:9000;
# 设置nginx的默认首页文件(上面已经设置过了,可以删除)
fastcgi_index index.php;
# 设置脚本文件请求的路径
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# 引入fastcgi的配置文件
include fastcgi_params;
}

 

配置用户组

#如果php有设置专门的web用户www-data,那么nginx.conf第一行默认是#user nobody; 需要去掉注释改为user www-data;或者user www-data www-data;表示nginx服务器的权限为www-data修改保存并退出,然后重启nginx.

测试index.php

service php-fpm restart
service nginx restart

#编辑index.php
vi /mnt/phpwww/index.php
    <?php
        phpinfo();
    ?>
 
 

 

posted @ 2018-08-31 15:43  西伯利亚狼520  阅读(154)  评论(0)    收藏  举报