系统配置需符合平台规范,以保证制作并导入镜像后、基于镜像创建的边缘实例能够正常运行。本文将指导您完成系统配置。
已完成Cloud-Init的安装。安装步骤请参见Linux系统中安装Cloud-Init。
执行以下脚本:
说明
#!/bin/bash sed -i "s/^#UseDNS.*$/UseDNS no/" /etc/ssh/sshd_config sed -i 's/NAME="eth0"/DEVICE="eth0"/g' /etc/sysconfig/network-scripts/ifcfg-eth0 release=$(rpm -E %{rhel}) if [ $release -eq 6 ]; then chkconfig iptables off else systemctl disable firewalld fi #update common config echo "net.ipv4.conf.all.rp_filter = 0" >> /etc/sysctl.d/99-sysctl.conf cat /etc/centos-release | grep "release 7" if [ $? -eq 0 ]; then systemctl disable NetworkManager systemctl enable network fi
执行以下脚本:
#!/bin/bash #update network config cat <<EOF > /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* EOF systemctl disable systemd-resolved.service systemctl stop systemd-resolved systemctl mask systemd-networkd.service systemctl mask systemd-networkd-wait-online.service
执行以下脚本:
#!/bin/bash #update network cat <<EOF > /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* EOF
完成上述操作后,您可以关机、开始制作镜像。