Linux 安装apache

配置yum源

一 .挂载光盘

mkdir /kk
mount /dev/cdrom /kk

检查挂载点

ls /kk

第二步:修改yum的配置文件,指向我们创建的yum源:/test/testyum/
yum的配置文件包括主配置文件和子配置文件
主配置文件 /etc/yum.conf
子配置文件 /etc/yum.repos.d下 配置文件名称无所谓,但是后缀必须是.repo

切换路径

cd /etc/yum.repos.d

备份之前的文件 在当位置创建目录

mkdir b
mv *.repo b

三.新建一个配置文件,指向我们的yum仓库

vim a.repo

[a]
name=a
enabled=1
gpgcheck=0
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/os/x86_64/

四步.检查配置是否成功

yum clean all
yum repolist

安装apache

一.安装命令

yum install httpd

启动apache

systemctl start httpd
systemctl enable httpd

检查apache的状态

第一种

systemctl status httpd

第二种

ss -tunl |grep 80

第三种

ps aux | grep httpd

访问apache

通过ip访问

如果访问不了可能是火墙和selinux

 关闭防火墙
[root@localhost ~] systemctl disable firewalld
[root@localhost ~] systemctl stop firewalld
 关闭selinux
 查看当前selinux的状态
[root@localhost ~] getenforce
Enforcing
 关闭的命令
[root@localhost ~] setenforce 0
[root@localhost ~] sed -i "s/SELINUX=enforcing/SELINUX=disabled/g"
/etc/selinux/config

相关推荐

  1. Linux 安装apache

    2024-04-02 06:52:03       15 阅读
  2. LiunxApache安装及配置

    2024-04-02 06:52:03       33 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-02 06:52:03       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-02 06:52:03       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-02 06:52:03       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-02 06:52:03       18 阅读

热门阅读

  1. docker搭建Linuxserver/tvheadend

    2024-04-02 06:52:03       14 阅读
  2. vue3从精通到入门8:reactive的使用

    2024-04-02 06:52:03       16 阅读
  3. Day5-

    Day5-

    2024-04-02 06:52:03      11 阅读
  4. cesium键盘控制相机位置和姿态

    2024-04-02 06:52:03       10 阅读
  5. Jenkins插件下载错误时间问题

    2024-04-02 06:52:03       11 阅读
  6. WPF —— TreeView树形控件

    2024-04-02 06:52:03       11 阅读
  7. 【NoSQL数据库】【redis】redis基础知识整理

    2024-04-02 06:52:03       13 阅读
  8. wpf Menu

    2024-04-02 06:52:03       26 阅读