You need to enable JavaScript to run this app.
导航

更新Linux系统配置

最近更新时间2023.07.07 20:05:48

首次发布时间2021.10.29 18:50:38

系统配置需符合平台规范,以保证制作并导入镜像后、基于镜像创建的边缘实例能够正常运行。本文将指导您完成系统配置。

前提条件

已完成Cloud-Init的安装。安装步骤请参见Linux系统中安装Cloud-Init

操作步骤

CentOS系列

执行以下脚本:

说明

  • 以下命令,仅在使用本地导入的镜像创建边缘实例、且边缘实例需使用负载均衡功能时必须执行:
    echo "net.ipv4.conf.all.rp_filter = 0" >> /etc/sysctl.d/99-sysctl.conf
  • 当不存在/etc/sysconfig/network-scripts/ifcfg-eth0文件时,无需执行以下命令:
    sed -i 's/NAME="eth0"/DEVICE="eth0"/g' /etc/sysconfig/network-scripts/ifcfg-eth0
#!/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

Ubuntu系列

执行以下脚本:

#!/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

Debian系列

执行以下脚本:

#!/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

后续操作

完成上述操作后,您可以关机、开始制作镜像。