linux 安装

在学习linux上旅途中,遇到种种问题,现已解决做下笔记

一  一键安装

[转自]lnmp.org 页面解释的比较详细

 安装LNMP稳定版
wget -c http://soft.vpser.net/lnmp/lnmp1.3-full.tar.gz && tar zxf lnmp1.3-full.tar.gz && cd lnmp1.3-full && ./install.sh lnmp

详细请想看 lnmp.org

 

安装redis等缓存

请看 https://lnmp.org/faq/addons.html

 

二 yum 安装 [学习于 http://blog.chinaunix.net/uid-26744202-id-5746873.html]

http://www.osyunwei.com/archives/2353.html

 

此处安装使用centos6   centos7安装的时候会相应的出现一些错误

1,安装 epel源  EPEL源作为CENTOS官方源的补充,里边都是一些基础包(https://fedoraproject.org/wiki/EPEL 官网)

    rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

2,安装Remi源,Remi源几乎都是最新稳定版,都是Linux骨灰级大牛维护更新 (http://rpms.famillecollet.com/ 官网)

    rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

一,安装php

  yum install php56-php-fpm php56-php-mysql php56-php-redis  php56-php-pear php56-php-devel  php56-php-opcache
  
  chkconfig --level 2345 php56-php-fpm on
 
  service php56-php-fpm restart
 
二,安装mysql
  yum -y install mysql  mysql-server
 
  chkconfig --level 2345 mysqld on
 
    service mysqld start
 
  mysql_secure_installation
 
三,安装redis
  yum install redis
  service redis start
 
四,安装nginx
  yum install nginx
  service nginx start
 
安装之后让nginx进行解析php
 
在//etc/nginx/conf.d下的default.conf中进行配置
  
  
  1. location / {
  2.         root /usr/share/nginx/html;
  3.         index index.php index.html index.htm;
  4.     }

  location ~ \.php$ {
        root /usr/share/nginx/html;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        try_files $uri =403;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include fastcgi_params;
    }

 

这样 nginx就能解析PHP文件了

配置完之后需重启nginx

/usr/sbin/nginx -s reload

  操作 php -v 可能会出现-bash: php: command not found
  意思是命令没有找到 需要将php的安装地址bin放入到PATH中
  安装地址phpinfo会有提示可以借鉴
 
 我的添加的方式  export PATH=$PATH:/opt/remi/php56/root/usr/bin  (一时的,永久可看http://www.cnblogs.com/leibg/p/4479921.html)
 再php -v 
PHP 5.6.30 (cli) (built: Jan 19 2017 07:16:22)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

成功
posted @ 2017-04-12 19:04  ddxg  阅读(260)  评论(0编辑  收藏  举报