树莓派3 B+ / ubuntu-18.04.2 设置 wifi (少走弯路)

首先按照网上的教程,给microSD卡format, 然后把ubuntu镜像拷上去。
开机,初始化系统
然后连一根网线

然后:

·##################### 、 很简单啊! 捷径方法 ##########################

  1. mkdir 然后 cd 到 ~/Documents/
  2. git clone https://github.com/RPi-Distro/raspi-config.git
  3. cd into raspi-config directory, and do: sudo chmod +x raspi-config 这一步是把 raspi-config 这个文件变成可执行文件。
  4. raspi-config 是一个文件,跑的话要用:sudo ./raspi-config or sudo sh raspi-config
  5. 然后在ui里面选就行了

`##################### 以下是原答案 花了很多精力试错 #########################

For the image with apt installed

Step1:

sudo apt-get install wireless-tools

Step2:

sudo apt-get install wpasupplicant

Step3: add to /etc/network/interfaces:

auto wlan0 
iface wlan0 inet dhcp
wpa-ssid WIRELESSSSID 
wpa-psk WIRELESSPASSWORD

Step4: comment from /etc/network/interfaces the line:

#source /etc/network/interfaces.d/*.cfg

the commented interfaces.d/*.cfg file contains settings for the eth0.

I do not understand why but leaving this line active and adding the wlan0 config would crash the system at boot.

Step5: reboot

For the core image without apt installed:

Step1:

ifconfig wlan0 down
ifconfig wlan0 up

Step2: create wireless config file:

sudo vi /etc/network/interfaces.d/wlan0

Note: I tried without sudo but it would not let me save the changes

Step3: add the following content

auto wlan0 
iface wlan0 inet dhcp
wpa-ssid WIRELESSSSID 
wpa-psk WIRELESSPASSWORD

Step4: reboot

其实都不需要reboot, 只要重启网卡即可:

sudo systemctl restart networking
sudo ifdown wlan0
sudo ifup wlan0
wpa_cli status

参考:
https://askubuntu.com/questio...

你可能感兴趣的:(raspberry-pi,ubuntu18.04)