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
相关推荐
winner88811 小时前
Linux 软件安装 “命令密码本”:yum/apt/brew 一网打尽
linux·运维·服务器
九河云2 小时前
软件开发平台 DevCloud
运维·服务器·数据库·科技·华为云
思麟呀3 小时前
Linux的基础IO流
linux·运维·服务器·开发语言·c++
winner88813 小时前
嵌入式Linux驱动开发全流程:工具协作+核心概念拆解(从入门到理解)
linux·运维·驱动开发
GM_8283 小时前
从0开始在Go当中使用Apache Thrift框架(万字讲解+图文教程+详细代码)
rpc·go·apache·thrift
ShiinaKaze3 小时前
fatal error: bits/c++config.h: No such file or directory
linux·gcc·g++
TTBIGDATA4 小时前
【Ambari开启Kerberos】KERBEROS SERVICE CHECK 报错
大数据·运维·hadoop·ambari·cdh·bigtop·ttbigdata
Archy_Wang_14 小时前
脚本自动生成专业Linux巡检报告
linux·运维·服务器
java_logo4 小时前
SGLANG Docker容器化部署指南
linux·运维·docker·容器·eureka·1024程序员节
Qayrup4 小时前
各个系统的 docker安装
运维·docker·容器