AnswerBun.com

Setting WiFi up via the command line Ubuntu server 18.04.4 LTS - Raspberry Pi 4 Wireless connectivity

Raspberry Pi Asked by Gildas.Tambo on January 4, 2022

I have the Raspberry Pi 4 Model B and my choice of RAM was the 4GB. i don’t have internet via the gigabit ethernet at the moment, all i have is my smartphone to share internet via a hotspot (wifi).

i have installed Ubuntu Server 64-bit on the Raspberry 4 following the instructions on the ubuntu official webpage by flashing Ubuntu onto a 128GB samsung microSD card.

The installation went good, but now i want to connect the Raspberry to the internet via the command line to fetch some packages and install the desktop.

How can i setup the wifi via the command line on the Raspberry 4B 4GBRAM?

One Answer

To be able to setup Wifi on Raspberry Pi 4 B+ 4GB on Ubuntu server 18 TLS, you first need to get the name of the Wifi card by showing physical components using the following command:

 $ sudo lshw

in my case it was wlan0

Then navigate to /etc/netplan/ using the cd command the hit Enter

$ cd /etc/netplan/

Use the command ls to list the files and directories under the folder then you now have to edit the .yaml file:

$ sudo nano 50-cloud-init.yaml

Finally, add the following lines to the 50-cloud-init file:

wifis:
        wlan0:
            optional: true
            access-points:
                    "SSID-NAME":
                            password: "WIFI-PASSORD"
            dhcp4: yes

NOTE: Make sure not to use tab for space, use the spacebar to create the blank.

Here is the final file code:

network:
    ethernets:
        eth0:
            dhcp4: true
            optional: true
    version: 2
    wifis:
        wlan0:
                optional: true
                access-points:
                        "SSID-NAME":
                                password: "WIFI-PASSORD"
                dhcp4: yes

Change the SSID-NAME and the WIFI-PASSORD they have to be in quotes. The : after SSID name is required.

Close and save the file using ctrl+x and yes by tipping the letter y

Finally, you need to do some debugs:

$ sudo netplan –debug try 
$ sudo netplan –debug generate 
$ sudo netplan –debug apply 

then reboot the pi

$ sudo reboot

Install Ubuntu desktop with the following command:

$ sudo apt-get install ubuntu-desktop

Answered by Gildas.Tambo on January 4, 2022

Add your own answers!

Related Questions

Virtual ethernet interface on Raspbian buster

1  Asked on January 9, 2021 by ste

   

Unattended upgrade removed core packages

0  Asked on January 5, 2021 by olivier

 

Raspberry Pi + NRF24L01 timeout after a period of time

1  Asked on January 2, 2021 by gordon

     

GPIO pin PULL_DOWN would

1  Asked on December 30, 2020 by cronbachalpha

   

pi’s password is lost in every reboot

1  Asked on December 29, 2020 by totoro

     

Maximum Wi-Fi clients on Pi 3 hotspot

3  Asked on December 28, 2020 by oliverpool

     

How to get more than one uart interface

12  Asked on December 24, 2020 by tauran

 

First time setup – no HDMI output

1  Asked on December 24, 2020 by user2694019

 

Do you have a stable Kodi + TV HAT system?

0  Asked on December 22, 2020 by whynine

   

Hardware PWM for Python 3.5 or higher?

1  Asked on December 14, 2020 by nic

     

Make Raspberrypi boot from USB first

1  Asked on December 13, 2020 by pokerface

       

Unable to boot custom built alpine image

0  Asked on December 12, 2020 by hosh-sadiq

     

Unable to connect raspberry pi Minecraft server

1  Asked on December 11, 2020 by guiseppe

     

“last reboot” command not returning correct date

1  Asked on December 10, 2020 by aiden-wilkins

 

Touchscreen with Qt QML eglfs

1  Asked on December 8, 2020 by velkan

     

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP