美文网首页
Centos8 启动httpd服务

Centos8 启动httpd服务

作者: 陈有朴 | 来源:发表于2022-03-04 23:02 被阅读0次

今天想着是要重新配置一下我的Centos8虚拟机,目的是为了以后搭自己的博客有一个站点,同时在自己电脑上使劲造,也不用怕学校服务器出事怪到我头上。

于是就开始了下面这一步:

# 启动httpd服务
systemctl start httpd.service

运行上述命令的时候,会出现如下报错

Failed to start httpd.service: Unit httpd.service not found.

然后,就想着用yum安装httpd,然而。。。

yum install httpd -y
# 报错信息如下:
CentOS Linux 8 - AppStream                                                                                   0.0  B/s |   0  B     01:27    
Errors during downloading metadata for repository 'appstream':
  - Curl error (7): Couldn't connect to server for http://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml [Failed to connect to vault.centos.org port 80: Connection refused]
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

再后续,就在看这个博客了:

centos8重新配置yum源(Errors during downloading metadata for repository ‘AppStream‘)

我也去阿里云社区凑凑热闹,发现Centos 8以后就停止维护了,如下:

image.png

但是现在还是将就着用吧(毕竟维护啥的,我又不是开发人员)

cd /etc/yum.repos.d/
# 查看已存在的repo
ls -l 

# 备份原有repo
mkdir bakup
mv *repo bakup/

# 下载最近repo
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
# 查看下载的repo
ll
# [train@Centos8(4.4) /etc/yum.repos.d]$ ls -lh
# total 8.0K
# drwxr-xr-x. 2 root root 4.0K Mar  4 22:19 bakup
# -rw-r--r--. 1 root root 2.5K Feb 14 21:16 CentOS-Base.repo

# 运行 yum makecache 生成缓存
yum makecache
# CentOS-8.5.2111 - Base - mirrors.aliyun.com                                                                  1.5 MB/s | 4.6 MB     00:03    
# CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                                                 63 kB/s |  10 kB     00:00    
# CentOS-8.5.2111 - AppStream - mirrors.aliyun.com                                                             271 kB/s | 8.4 MB     00:31    
# Last metadata expiration check: 0:00:01 ago on Fri 04 Mar 2022 10:20:24 PM CST.
# Metadata cache created.

现在就可以正常使用yum命令了

sudo yum install httpd
# 启用网站服务
systemctl start httpd.service                
# 设置服务开机启动
systemctl enable httpd.service 

参考资料

[1] https://blog.csdn.net/wt334502157/article/details/123189000
[2] https://developer.aliyun.com/article/823269?spm=a2c6h.14164896.0.0.1e67ebe7vUbSFZ

相关文章

  • Centos8 启动httpd服务

    今天想着是要重新配置一下我的Centos8虚拟机,目的是为了以后搭自己的博客有一个站点,同时在自己电脑上使劲造,也...

  • centos学习记录

    安装httpd服务 执行如下指令,安装并开启httpd服务。 apache服务其他运维命令。 启动apache服务...

  • centos 搭建项目环境

    安装apache yum install httpd 启动服务 apachectl start 停止服务 apac...

  • systemctl命令对照

    使某服务自动启动chkconfig --level 3 httpd on systemctl enable ...

  • Centos7.7 minimal httpd+mariadb

    一、 httpd 环境搭建:(Apache/2.4.6) 1.安装httpd 2.启动服务: 3.常见问题排除: ...

  • centos7.4安装lamp

    安装apache yum install httpd 启动apache服务 systemctl start ht...

  • Apache + MDwiki 简单web服务

    Apache安装配置 1、安装Apache服务 yum install httpd -y 2、启动Apache服务...

  • yum 快速搭建LNMP 环境

    关闭默认的 httpd 服务 安装 Nginx 支持 安装 php 支持 启动 php 服务 nginx 配置

  • Linux常用命令

    Linux常用命令 系统服务管理 systemctl 启动服务:systemctl start httpd.ser...

  • centos7.3配置LAMP BY yum

    实验环境: 1、安装apache 启动apache服务、设置httpd服务开机启动、 数据库安全设置,(数据库ro...

网友评论

      本文标题:Centos8 启动httpd服务

      本文链接:https://www.haomeiwen.com/subject/kphvrrtx.html