# 1.网络配置
nmcli connection add con-name net1 type ethernet ifname ens33 autoconnect yes
nmcli connection modify net1 ipv4.addresses '192.168.1.10/24' ipv4.gateway '192.168.1.1' ipv4.dns '192.168.1.1 114.114.114.114' ipv4.method manual
nmcli connection up net1 ifname ens33
# 2.设置计算机名称
hostnamectl set-hostname ad-kube-01
# 3.关闭selinux
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
# 4.关闭swap(可选)
swapoff -a
sed -ri 's/.*swap.*/#&/' /etc/fstab
# 5.关闭防火墙(可选)
systemctl stop firewalld && systemctl disable firewalld
# 6.配置dnf源
dnf -y install wget
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bk
cp /etc/yum.repos.d/CentOS-AppStream.repo /etc/yum.repos.d/CentOS-AppStream.repo.bk
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
sed -ri 's/^mirrorlist/#&/' /etc/yum.repos.d/CentOS-AppStream.repo
sed -i 's/^#baseurl.*/baseurl=https:\/\/mirrors.aliyun.com\/centos\/$releasever\/AppStream\/$basearch\/os\//' /etc/yum.repos.d/CentOS-AppStream.repo
dnf clean all
dnf makecache
# 7.安装常用软件
dnf -y install vim bash-completion
dnf -y install epel-release # epel源(可选)A
# 8.设置时间服务器同步
cp /etc/chrony.conf /etc/chrony.conf.bk
sed -i 's/^pool.*/pool ntp1.aliyun.com iburst/' /etc/chrony.conf
systemctl restart chronyd
chronyc sources -v # 查看同步信息