vm虚拟机安装centos8-爱代码爱编程
#镜像系统:CentOS-8.5.2111-x86_64-dvd1.iso
#修改网卡配置文件
cat /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens160
DEVICE=ens160
ONBOOT=yes
#挂载镜像
mount /dev/cdrom /media
#添加开机自动挂载镜像
echo '/dev/cdrom /media iso9660 defaults 0 0' >> /etc/fstab
#安装常用工具
yum -y install vim wget net-tools sysstat epel-release lrzsz gcc make
#配置yum源
cat /etc/yum.repo
[CentOS_BaseOS]
name=CentOS_BaseOS
baseurl=file:///media/BaseOS
gpgcheck=0
enabled=1
[CentOS_AppStream]
name=CentOS_AppStream
baseurl=file:///media/AppStream
gpgcheck=0
enabled=1
#添加阿里源
wget -O /etc/yum.repos.d/CentOS-Base-aliyun.repo http://mirrors.aliyun.com/repo/Centos-8.repo
#关闭防火墙和SELinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config