• centos7安装lamp


    配置前的准备:

    禁掉selinux,修改/etc/sysconfig/selinux中的SELINUX为SELINUX=disabled


    一. 安装Apache

    [root@localhost ~]# yum -y install httpd
    [root@localhost ~]# systemctl start httpd.service #开启Apache服务
    [root@localhost ~]# systemctl status httpd.service #查看Apache状态 [root@localhost ~]# systemctl enable httpd.service #开机自启动
    Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
    [root@localhost ~]#

    #测试语法

    [root@localhost ~]# apachectl configtest 
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
    Syntax OK

    #放行80端口

    [root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
    success

    #重启防火墙以让更改立刻生效

    
    
    [root@localhost ~]# firewall-cmd --reload
    success
    
    

    #检查配置是否成功

    [root@localhost ~]# firewall-cmd --list-all 
    public (active)
      target: default
      icmp-block-inversion: no
      interfaces: eth0
      sources:
      services: dhcpv6-client ssh
      ports: 80/tcp
      protocols:
      masquerade: no
      forward-ports:
      sourceports:
      icmp-blocks:
      rich rules:
    二、安装MariaDB
    [root@localhost ~]# yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成
    [root@localhost ~]# systemctl start mariadb.service #启动MariaDB
    [root@localhost ~]# systemctl enable mariadb.service ##设置开机自启动
    Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
    
    

    其他操作:

    systemctl stop mariadb.service #停止MariaDB
    
    systemctl restart mariadb.service #重启MariaDB

    备份配置文件:

    [root@localhost ~]# mv /etc/my.cnf{,.bak}
    [root@localhost ~]# cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷贝配置文件

    为root账户设置密码

    [root@localhost ~]# mysql_secure_installation

    #重启MariaDB

    
    
    [root@localhost ~]# systemctl restart mariadb.service
    
    

    三、安装PHP

    [root@localhost ~]# yum install php -y

    安装PHP组件,使PHP支持 MariaDB

    [root@localhost ~]# yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash -y

    #重启MariaDB

    [root@localhost ~]# systemctl restart mariadb.service

     #重启apache

    [root@localhost ~]# systemctl restart httpd.service

    测试

    [root@localhost ~]# cd /var/www/html
    [root@localhost html]# vim index.php
    <?php
    phpinfo();
    ?>

     在客户端浏览器输入服务器IP地址,可以看到如下图所示相关的配置信息!

     
  • 相关阅读:
    算法设计策略
    挖金矿
    寻找假币
    循环赛日程表
    【三分钟视频教程】iOS开发中 Xcode 报 apple-o linker 错误的#解决方案#
    iOS问题#解决方案#之关于“application/x-www-form-urlencoded;charset=utf-8” not supported
    【两分钟教程】如何为博客园添加QQ咨询效果
    【两分钟教程】如何更改Xcode项目名称
    iOS数据库操作之coredata详细操作步骤
    svn使用笔记
  • 原文地址:https://www.cnblogs.com/zhongguiyao/p/7527124.html
Copyright © 2020-2023  润新知