1、yum -y update    // 更新系统

  1.1)yum -y install gcc g++ gcc-c++ make kernel-devel kernel-headers

  1.2)vi /etc/selinux/config  #  禁止SELINUX

  1.3)设置SELINUX=disabled

  1.4)重启系统

2、安装mysql

2.1)yum -y install mariadb-client mariadb-server mariadb-devel

2.2)启动:systemctl start mariadb.service

2.3)设置开机自启:systemctl enable mariadb

2.4)设置root密码:

  ① systemctl stop mariadb.service

  ② mysqld_safe --skip-grant-tables

  ③ mysql -u root(另开shell)

  ④ use mysql;

  ⑤ update user set password=password("123456") where user='root';

  ⑥ delete from user where user = '';

  ⑦ flush privileges;

2.5)设置root远程访问:

  ① use mysql;

  ② update user set host='%' where user='root' and host='localhost';

  ③ flush privileges;

  ④ exit;

  ⑤ systemctl restart mariadb.service

  ⑥ firewall-cmd --zone=public --add-port=80/tcp --permanent    #添加80端口

  ⑦ firewall-cmd --zone=public --add-port=3306/tcp --permanent    #添加3306端口

  ⑧ firewall-cmd --reload    #重新启动防火墙

3、安装apache

3.1)yum -y install httpd

3.2)启动:systemctl start httpd.service

3.3)设置开机自启:systemctl enable httpd

3.4)配置虚拟主机:在/etc/httpd/conf.d/目录下建新vhost.conf,新增内容:

    <VirtualHost *:>
      DocumentRoot "/var/www/html/"
      ServerName 192.168.8.100
      ErrorLog "/var/log/httpd/error.log"
      CustomLog "/var/log/httpd/access.log" common
    </VirtualHost>     <VirtualHost *:>
      DocumentRoot "/var/www/html/CodeIgniter-3.1.2/"
      ServerName www.100ci.com
      ErrorLog "/var/log/httpd/100ci-error.log"
      CustomLog "/var/log/httpd/100ci-access.log" common
    </VirtualHost>

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

附一:yum安装nginx

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

  # yum info nginx

  # yum install -y nginx

  # systemctl start nginx

  # systemctl enable nginx

附二:安装 nginx 也相当简单,查看官网说明文档 http://nginx.org/en/linux_packages.html#stable

   1)[root@localhost ~] vi /etc/yum.repos.d/nginx.repo

  2)复制如下内容到刚才新建的文件中

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/  # 因为我的系统是centos7
gpgcheck=
enabled=

  3)yum -y install nginx

  4)yum start nginx

  5)yum enable nginx

附三:ngnix修改配置文件支持php  

server {
listen ;
server_name localhost; #charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
root /var/www/; # 把root从localhost中拿出来,不然$document_root找不到会报404 location / {
index index.php index.html index.htm;
} #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root /var/www/;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

附四:修改/etc/php-fpm.d/www.conf  文件

user = nginx   # 由apache改为nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx # 由apache改为nginx

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

4、安装php7

4.1)请参考 https://webtatic.com/packages/php71/

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

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

4.4) yum -y install php71w php71w-opcache php71w-common php71w-fpm php71w-gd php71w-mbstring php71w-mcrypt php71w-odbc php71w-pecl-redis php71w-pecl-memcached php71w-mysqlnd php71w-devel

4.5)安装完php,重启httpd,systemctl restart httpd

4.6)如果php中有冲突的包,执行yum -y remove 包名

5、安装phpredis、swoole扩展

5.1)yum -y install redis php-redis postgresql-devel openssl-devel

5.2)  pecl install swoole

5.2)重启httpd,systemctl restart httpd

6、部署成功

Centos7 用yum命令安装LAMP环境(php+Apache+Mysql)以及php扩展的更多相关文章

  1. linux安装lamp环境(linux+apache+mysql+php)

    源码安装 本次使用 Centos7.2 MySQL5.7.22 Apache2.4.37 PHP5.6.38 安装Apache 安装httpd和所需依赖:gcc, apr, apr-util,apr- ...

  2. CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin,mysql8.0.1/mysql5.7.22+centos7,windows mysql安装、配置

    介绍如何在CentOs6.2下面使用YUM配置安装LAMP环境,一些兄弟也很喜欢使用编译的安装方法,个人觉得如果不是对服务器做定制,用yum安装稳定简单,何必去download&make&am ...

  3. CentOS7使用yum命令安装Java1.8

    CentOS7使用yum命令安装Java1.8 首先更新已安装的包:#yum update查看系统当前的java版本:#java -version==================== CentOS ...

  4. CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin详细过程

    介绍如何在CentOs6.2下面使用YUM配置安装LAMP环境,一些兄弟也很喜欢使用编译的安装方法,个人觉得如果不是对服务器做定制,用yum安装稳定简单,何必去download&make&am ...

  5. CentOS7 使用yum命令安装Java SDK(openjdk)

    CentOS 6.X 和 7.X 自带有OpenJDK runtime environment  (openjdk).它是一个在linux上实现开源的java 平台. 安装方式: 1.输入以下命令,以 ...

  6. centos(7) 使用yum进行安装lamp环境

    1.用yum安装Apache,Mysql,PHP. 1.1安装Apache yum install httpd httpd-devel 安装完成后,用service httpd start 1.2 安 ...

  7. Linux CentOS7通过yum命令安装Mono(尝先安装模式)

    前言 经过尝试网上各种安装mono的技术贴,这个安装过程经历了大约2周,尝试了各个版本,几目前博客所描述的所有安装方式.以下内容的安装方式可以为你尝试不同版本的mono.并非正式环境安装标准方式安装. ...

  8. Centos7 通过yum命令安装jdk1.8

    直接安装,不看原因 yum install java-1.8.0-openjdk* -y 1 分割线上下之选一个看即可. —————————————华丽的分割线—————————————— 先查看系统 ...

  9. Centos7使用yum命令安装Mysql5.6.X

    首先:具体的安装步骤在mysql官方文档上都有详细的描述. 文档虽然是英文,不过很容易理解,我就不一一翻译了. 官方文档地址:https://dev.mysql.com/doc/refman/5.6/ ...

随机推荐

  1. windows线程退出的方法

    线程的handle用处: 线程的handle是指向“线程的内核对象”的,而不是指向线程本身.每个内核对象只是内核分配的一个内存块,并且只能由内核访问.该内存块是一种数据结构,它的成员负责维护对象的各种 ...

  2. Struts框架核心工作流程与原理

    1.Struts2架构图  这是Struts2官方站点提供的Struts 2 的整体结构.  执行流程图 2.Struts2部分类介绍  这部分从Struts2参考文档中翻译就可以了. ActionM ...

  3. 自制“低奢内”CSS3登入表单,包含JS验证,请别嫌弃哦。

    要求 必备知识 基本了解CSS语法,初步了解CSS3语法知识.和JS/JQuery基本语法. 开发环境 Adobe Dreamweaver CS6 演示地址 演示地址 预览截图(抬抬你的鼠标就可以看到 ...

  4. 【转载】CentOS中crontab定时计划任务的使用

    转载自:http://blog.csdn.net/testcs_dn/article/details/48780971 概述 利用“任务计划”,可以将任何脚本.程序或文档安排在某个最方便的时间运行.通 ...

  5. xshell 登陆堡垒机实现自动跳转

    1, 正常使用用户密码登录堡垒机并保存登陆配置 2, 配置登陆脚本 添加第一个: expect 为空send :ssh root@ip 添加第二个: expect root@ip's password ...

  6. centos7.0安装docker-18.06.1-ce不能启动问题

    最近用centos7.0 yum安装了一个docker-ce18.06.1  但是发现安装好不能启动,于是上官网看了一下,说是docker-ce18.06.1是从centos7.2开始支持的,但是7. ...

  7. 谈谈Windows Wow64

    欢迎转载,转载请注明出处:http://www.cnblogs.com/lanrenxinxin/p/4977488.html 本文是<深入理解Windows操作系统 (第六版) >关于6 ...

  8. 制作openstack使用的Ubuntu镜像

    一.环境准备 OS:Ubuntu-14.04 制作镜像版本:Ubuntu-14.04.4-server-amd64.iso 查看是否支持虚拟化(有输出代表支持,否则在BIOS页面中设置即可): egr ...

  9. HTTPS知识小结

    HTTPS知识小结 背景1:TCP握手 internet上的两台机器A,B要建立起HTTP连接了,在这之前要先建立TCP连接,情景大概是这样子的: A:你好,我跟你建立一个TCP好吗? B:好啊. A ...

  10. [Angularjs]处理页面闪烁的方法

    摘要 在使用{{}}绑定数据的时候,页面加载会出现满屏尽是{{xxx}}的情况.数据还没响应,但页面已经渲染了.这是因为浏览器和angularjs渲染页面都需要消耗一定的时间,这个间隔可能很小,甚至让 ...