1、修改主机名称
[root@localhost ~]# hostnamectl set-hostname rocky100
[root@localhost ~]# rocky100
2、修改网络
1)修改静态IP
[root@rocky100 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=ens33
#UUID=9782ee03-7a90-45bd-93d0-11c8a65206e2
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.2.100
GATEWAY=192.168.2.2
NETMASK=255.255.255.0
DNS1=192.168.2.2
DNS2=114.114.114.114
2)拔下ens33网卡
[root@rocky100 ~]# ifdown ens33
3)插上ens33网卡
[root@rocky100 ~]# ifup ens33
3、配置映射
[root@rocky100 ~]# vim /etc/hosts
192.168.2.100 rocky100
4、关闭防火墙
1)关闭防火墙
[root@rocky100 ~]# systemctl stop firewalld.service
2)开机禁止启动防火墙
[root@rocky100 ~]# systemctl disable firewalld.service
3)查看防火墙状态
[root@rocky100 ~]# systemctl status firewalld.service
5、配置国内镜像Yum源
1)替换阿里Yum源
[root@rocky100 ~]# sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \
-i.bak \
/etc/yum.repos.d/Rocky-*.repo
2)makecache一下
[root@rocky100 ~]# dnf makecache
6、安装并启动httpd服务
1)Yum安装httpd服务
[root@rocky100 ~]# yum install -y httpd
2)启动httpd服务
[root@rocky100 ~]# systemctl start httpd
3)开机启动httpd服务
[root@rocky100 ~]# systemctl enable httpd
4)查看httpd服务
[root@rocky100 ~]# systemctl status httpd
7、配置本地Yum源
1)虚拟机右键设置
2)挂载DVD光盘镜像
3)创建cdrom目录
[root@rocky100 ~]# mkdir -p /mnt/cdrom
4)挂载光盘
[root@rocky100 ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom/
5)拷贝Yum安装包到httpd目录
[root@rocky100 ~]# cp -r /mnt/cdrom/AppStream /var/www/html/
[root@rocky100 ~]# cp -r /mnt/cdrom/BaseOS /var/www/html/
6)进入Yum目录
[root@rocky100 ~]# cd /etc/yum.repos.d/
7)配置Rocky-AppStream.repo
[root@rocky100 yum.repos.d]# vim Rocky-AppStream.repo
[AppStream]
name=AppStream
baseurl=http://localhost/AppStream
gpgcheck=0
enabled=true
8)配置Rocky-BaseOS.repo
[root@rocky100 yum.repos.d]# vim Rocky-BaseOS.repo
[base]
name=BaseOS
baseurl=file:///var/www/html/BaseOS
gpgcheck=0
enabled=true
9)安装软件进行测试
[root@rocky101 ~]# dnf makecache
[root@rocky101 ~]# dnf install -y vim netools httpd