挂载光驱
mkdir -p /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
vi /etc/fstab
追加以下内容:
/dev/cdrom /mnt/cdrom iso9660 defaults 0 0
手动修改CentOS-Base.repo
备份 yum 源配置文件
mv /etc/yum.repos.d/ /etc/yum.repos.d.bak
重新创建 yum 源配置文件目录
mkdir -p /etc/yum.repos.d
进入yum源配置文件所在位置
cd /etc/yum.repos.d/
编辑 CentOS-Base.repo
vi CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
使本地 yum 源 生效
清空 yum 缓存
yum clean all
缓存本地yum源
yum makecache
查看yum仓库列表
yum repolist
查看本地源的所有软件
yum list
在线安装 httpd
yum -y install httpd net-tools
开启 httpd 服务
systemctl start httpd
关闭 httpd 服务
systemctl stop httpd
重启 httpd 服务
systemctl restart httpd
重载 httpd 服务
systemctl reload httpd
开机自启动 httpd 服务
systemctl enable httpd
开机禁用 httpd 服务
systemctl disable httpd
防火墙开放端口
–zone 作用域
–add-port=80/tcp 添加端口
–permanent 永久生效
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
http://服务器IP地址
cd /var/www/html
vi demo.html
DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>李昊哲小课title>
head>
<body>
<h1>铭记历史,勿忘国耻h1>
body>
html>