Linux 安装apache

安装apache过程

配置yum源

一 .挂载光盘

bash 复制代码
mkdir /kk
mount /dev/cdrom /kk

检查挂载点

bash 复制代码
ls /kk

第二步:修改yum的配置文件,指向我们创建的yum源:/test/testyum/

yum的配置文件包括主配置文件和子配置文件

主配置文件 /etc/yum.conf

子配置文件 /etc/yum.repos.d下 配置文件名称无所谓,但是后缀必须是.repo

切换路径

bash 复制代码
cd /etc/yum.repos.d

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

bash 复制代码
mkdir b
mv *.repo b

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

bash 复制代码
vim a.repo

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

四步.检查配置是否成功

bash 复制代码
yum clean all
yum repolist

安装apache

一.安装命令

bash 复制代码
yum install httpd

启动apache

bash 复制代码
systemctl start httpd
systemctl enable httpd

检查apache的状态

第一种

bash 复制代码
systemctl status httpd

第二种

bash 复制代码
ss -tunl |grep 80

第三种

bash 复制代码
ps aux | grep httpd

访问apache

通过ip访问

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

bash 复制代码
 关闭防火墙
[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
相关推荐
Nebula嵌入式5 小时前
【C语言】09-深入解析main函数
linux·c语言·开发语言·嵌入式
AKAMAI5 小时前
你的源服务器可能是你做出的最昂贵决定
运维·人工智能·云计算
Dxy12393102166 小时前
Linux 编译安装 Python 3.12.10(多版本共存,不破坏系统Python)
linux·运维·python
lsh曙光7 小时前
Apache服务
apache
技术深耕者7 小时前
AI Agent从演示到生产:企业进入“自动化层”时代
运维·人工智能·自动化
xz驱动分享7 小时前
Linux DMA 子系统学习笔记
linux·dma·rk3588·嵌入式软件
w67820078 小时前
Prisma不能优雅的支持DTO,试试Vona ORM吧
linux·运维·ubuntu
APItesterCris8 小时前
Open Claw 实战教程:5 分钟搭建京东商品自动化监控与数据分析系统
大数据·运维·数据库·数据仓库·自动化
Darkwanderor9 小时前
Linux系统编程实战项目:模拟实现shell
linux·c++
杨某不才10 小时前
如何能让Linux服务器对shell 终端 + sftp 文件传输长期保活
linux·运维·服务器