登录
首页 >  数据库 >  MySQL

CentOS 6 yum安装 Nginx1.6 + MySQL5.5 + PHP5.6

来源:SegmentFault

时间:2023-01-13 15:06:49 367浏览 收藏

你在学习数据库相关的知识吗?本文《CentOS 6 yum安装 Nginx1.6 + MySQL5.5 + PHP5.6》,主要介绍的内容就涉及到MySQL、Linux、nginx、PHP、centos,如果你想提升自己的开发能力,就不要错过这篇文章,大家要知道编程理论基础和实战操作都是不可或缺的哦!

CentOS 6.8 yum安装 Nginx

  1. 下载nginx yum源

wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
  1. 安装

rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm   //得到yum源文件nginx.repo
  1. 显示结果 yum list | grep nginx

nginx-release-centos.noarch                6-0.el6.ngx                   installed
nginx.x86_64                               1.16.0-1.el6.ngx              nginx  
nginx-debug.x86_64                         1.8.0-1.el6.ngx               nginx  
nginx-debuginfo.x86_64                     1.16.0-1.el6.ngx              nginx  
nginx-module-geoip.x86_64                  1.16.0-1.el6.ngx              nginx  
nginx-module-geoip-debuginfo.x86_64        1.16.0-1.el6.ngx              nginx  
nginx-module-image-filter.x86_64           1.16.0-1.el6.ngx              nginx  
nginx-module-image-filter-debuginfo.x86_64 1.16.0-1.el6.ngx              nginx  
nginx-module-njs.x86_64                    1.16.0.0.3.2-1.el6.ngx        nginx  
nginx-module-njs-debuginfo.x86_64          1.16.0.0.3.2-1.el6.ngx        nginx  
nginx-module-perl.x86_64                   1.16.0-1.el6.ngx              nginx  
nginx-module-perl-debuginfo.x86_64         1.16.0-1.el6.ngx              nginx  
nginx-module-xslt.x86_64                   1.16.0-1.el6.ngx              nginx  
nginx-module-xslt-debuginfo.x86_64         1.16.0-1.el6.ngx              nginx  
nginx-nr-agent.noarch                      2.0.0-12.el6.ngx              nginx  
pcp-pmda-nginx.x86_64                      3.10.9-9.el6                  base 
  1. 安装nginx

yum install nginx.x86_64 
  1. 启动

service nginx start
  1. Nginx 配置 php

server {
    listen       80;
    server_name  localhost;
    root         /www/video;  #放在外面
    index        index.php; 
    charset      utf-8;

    error_log    /root/nginx.error.log error;
    access_log   /root/nginx.access.log  main;

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;      #开启path_info
        fastcgi_param PATH_INFO $fastcgi_path_info;   #开启path_info
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
    include /etc/nginx/maccms.conf;    #开启伪静态
}

CentOS 6.5下yum安装 MySQL5.5

  1. 检查是否安装过

 1. rpm -qa|grep mysql  是否安装过mysql5.1有就卸载.
 2. 卸载命令:rpm -e mysql-libs --nodeps
  1. 添加repo(需要增加两个repo)

//下载
wget http://mirror.steadfast.net/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm

//添加
rpm -Uvh http://mirror.steadfast.net/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-6.rpm
  1. 检查是否增加成功

yum --enablerepo=remi,remi-test list mysql mysql-server
  1. 安装MySQL5.5

yum --enablerepo=remi,remi-test install mysql mysql-server
  1. 启动一下MySQL

/etc/init.d/mysqld start
  1. 开机自启动

chkconfig --levels 345 mysqld on
  1. 启用MySQL安全设置

/usr/bin/mysql_secure_installation
  1. 验证一下MySQL是否安装成功

mysql -uroot -p12345
  1. 配置my.ini

vi /etc/my.cnf

Centos 6.x/7.x yum安装php5.6

  1. 检查当前安装的PHP包

yum list installed | grep php  
  1. 如果有安装的PHP包,先删除他们

yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64  
  1. 配置yum源

//以下是CentOS 6的源。
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-6.rpm

//以下是CentOS 7.0的源。
yum install epel-release
rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  1. 使用yum list命令查看可安装的包(Packege)。

 yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
  1. 安装PHP5.6.x

 yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd php-redis
  1. 安装PHP-fpm

yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm 
  1. 安装GD库

yum --enablerepo=remi-php56 install php-gd

理论要掌握,实操不能落!以上关于《CentOS 6 yum安装 Nginx1.6 + MySQL5.5 + PHP5.6》的详细介绍,大家都掌握了吧!如果想要继续提升自己的能力,那么就来关注golang学习网公众号吧!

声明:本文转载于:SegmentFault 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>
评论列表