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
相关推荐
Fleshy数模5 分钟前
MySQL 表创建全攻略:Navicat 图形化与 Xshell 命令行双模式实践
linux·mysql
神梦流36 分钟前
GE 引擎的非标准数据流处理:稀疏张量与自定义算子在图优化中的语义保持
linux·运维·服务器
码云数智-大飞39 分钟前
保姆级教程:零基础快速上手 Apache SeaTunnel(原 Waterdrop)
apache
兜兜转转了多少年44 分钟前
从脚本到系统:2026 年 AI 代理驱动的 Shell 自动化
运维·人工智能·自动化
.小墨迹1 小时前
apollo学习之借道超车的速度规划
linux·c++·学习·算法·ubuntu
yuluo_YX1 小时前
Reactive 编程 - Java Reactor
java·python·apache
Lsir10110_2 小时前
【Linux】中断 —— 操作系统的运行基石
linux·运维·嵌入式硬件
Sheffield2 小时前
command和shell模块到底区别在哪?
linux·云计算·ansible
历程里程碑2 小时前
Linux20 : IO
linux·c语言·开发语言·数据结构·c++·算法
郝学胜-神的一滴2 小时前
深入浅出:使用Linux系统函数构建高性能TCP服务器
linux·服务器·开发语言·网络·c++·tcp/ip·程序人生