服务器(CentOS 8.0 )部署LAMP环境(一)Apache的安装

服务器操作系统:CentOS 8.0  64位

1、运行命令cat /etc/redhat-release查看系统版本。

  

2、关闭防火墙(在不知道端口的情况下,保证Apache跟外界的通讯)

  运行systemctl status firewalld命令查看当前防火墙的状态。(已关闭,无需多余操作)

    

  若防火墙开启{Active:active(running)},那么需要关闭

  systemctl stop firewalld(暂时关闭,无需指令重启,上次打开lunix,自动开启)

  systemctl disable firewalld(永久关闭)

3、关闭SELinux  

  (1)SELinux的全称是Security-Enhanced Linux,是由美国国家安全局NSA开发的访问控制体制。SELinux可以最大限度地保证Linux系统的安全。  

    SELinux的新特性使得apache的进程没有权限,无法访问。

  (2)运行getenforce命令查看SELinux的当前状态。(已关闭,无需多余操作)

    

    若SELinux开启(Enforcing),那么需要关闭

    setenforce 0(暂时关闭,无需指令重启,上次打开lunix,自动开启)

    永久关闭:vi /etc/selinux/config

              编辑SELinux配置文件

              把光标移动到SELINUX=enforcing这一行

              按i键,将其修改为SELINUX=disabled

              按Esc键,

              然后输入:wq并回车以保存并关闭SELinux配置文件

4、安装apache2.4.38

  (1)sudo yum update更新。(yum -y update  升级所有包同时也升级软件和系统内核 ;yum -y upgrade 只升级所有包,  不升级软件和系统内核

  (2)yum install httpd(安装Apache)

  (3)启动Apache web服务器:systemctl start httpd(确保启用您的httpd服务,以使其在系统启动时启动)

  (4)systemctl enable httpd(开机自启)

  (5)systemctl status httpd(查看服务当前状态)

  (6)httpd -v(查看Apache版本号)

    

 

  (7)输入http://公网IP

  

 

 

 

 

posted @ 2020-04-07 21:10  Roronoa-Zoro  阅读(805)  评论(0编辑  收藏  举报