我正在尝试安装 Ubuntu Server 18.04,但遇到了一个问题,我需要连接到互联网来下载软件包(例如network manager
),才能设置我的 Wifi
使用这个关联,我正在尝试修改/etc/netplan/50-cloud-init.yaml
ls /sys/class/net
显示我的无线网卡wlo1
我正在发出命令sudo vi /etc/netplan/50-cloud-init.yaml
并编辑文件使其看起来像这样(注意,我必须直观地复制它)
#######
#######
#######
#######
#######
network:
ethernets: {}
wifis:
wlo1:
optional: true
access-points:
"****":
Password: "******"
Dhcp4: true
当我发出命令时sudo netplan apply
出现以下错误
/etc/netplan/50-cloud-init.yaml11:21: Error in network definition: wlo1: No access points defined
optional:true
撇开 Ubuntu Server 应该为这个非常常见的问题提供更干净的解决方案这一事实不谈,这确实是一个问题,因为我必须格外小心,永远不要使用制表符,在冒号后添加一个空格,并且只信任按下 ENTER 时的 vi 缩进
有人能告诉我我做错了什么,我应该怎么做才能解决这个问题,或者至少我应该怎么做才能解决这个问题
答案1
创造/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
...
# To disable cloud-init's network configuration capabilities
#
network: {config: disabled}
編輯您的/etc/netplan/50-cloud-init.yaml
...
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
#
network:
version: 2
renderer: networkd
wifis:
wlo1:
dhcp4: true
access-points:
"****":
password: "******"
sudo netplan --debug generate
sudo netplan apply
reboot