Prerequisites
yum install -y open-vm-tools wget git
apt-get install -y open-vm-tools
selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
reboot
DNS
cat > /etc/resolv.conf << EOF
nameserver 1.2.4.8
nameserver 210.2.4.8
nameserver 114.114.114.114
nameserver 8.8.8.8 nameserver 8.8.4.4 nameserver 223.5.5.5 nameserver 223.6.6.6 EOF cat /etc/resolv.conf
hosts
wget https://raw.githubusercontent.com/racaljk/hosts/master/hosts -qO /tmp/hosts && sudo sh -c 'cat /tmp/hosts > /etc/hosts'
cat >> /etc/hosts << EOF
172.18.24.201 k8s1
172.18.24.202 k8s2
172.18.24.203 k8s3 172.18.24.204 gfs1 172.18.24.205 gfs2 EOF cat /etc/hosts
China registry mirror
cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
EOF
firewall
systemctl stop firewalld.service
systemctl disable firewalld.service
iptables -P FORWARD ACCEPT
modprobe ip_tables
modprobe iptable_nat
modprobe iptable_filter
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
ntp
yum install ntp -y # 安装ntp服务
systemctl enable ntpd # 开机启动服务
systemctl start ntpd # 启动服务
timedatectl set-timezone Asia/Shanghai # 设置亚洲时区 timedatectl set-ntp yes # 启用NTP同步 systemctl restart ntpd # 重启ntp服务 ntpq -p # 手动同步时间 date # 检查结果
Mirror
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i 's/us.archive.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list
Mirror不是必须项。
所有评论(0)