📌  相关文章
📜  wpa_supplicant raspberry pi - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:21:15.528000             🧑  作者: Mango

WPA Supplicant for Raspberry Pi

One of the most critical tasks for any Raspberry Pi developer is connecting to Wi-Fi. The WPA Supplicant software manages Wi-Fi connections on Linux-based systems, and the Raspberry Pi is no different. In this tutorial, we will cover how to use WPA Supplicant to configure and connect the Raspberry Pi to a Wi-Fi network.

Pre-requisites

Before we start, make sure that:

  • Your Raspberry Pi is powered on and connected to a monitor
  • You have a keyboard and mouse connected to the Raspberry Pi
  • You have administrative access to the Raspberry Pi
Step 1: Update Package List

First, update the package list of your Raspberry Pi using the following commands:

sudo apt-get update
Step 2: Install WPA Supplicant

Next, install WPA Supplicant using the following command:

sudo apt-get install wpasupplicant
Step 3: Configure WPA Supplicant

WPA Supplicant requires configuration information to connect to a wireless network. The configuration file is located in /etc/wpa_supplicant/wpa_supplicant.conf.

Open the configuration file using your preferred text editor:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following lines to the file to configure the Wi-Fi network:

network={
  ssid="NETWORK_NAME"
  psk="NETWORK_PASSWORD"
}

Replace NETWORK_NAME with the name of the Wi-Fi network and NETWORK_PASSWORD with the password.

Save the changes to the file by pressing CTRL+X followed by Y and then ENTER.

Step 4: Connect to Wi-Fi Network

Restart the networking service on your Raspberry Pi using the following command:

sudo systemctl restart networking

Now, your Raspberry Pi should connect to the Wi-Fi network that you configured in the previous step.

Conclusion

In this tutorial, you learned how to use WPA Supplicant to connect the Raspberry Pi to a Wi-Fi network. For more information about WPA Supplicant and its advanced configuration options, you can visit the official documentation at: https://w1.fi/wpa_supplicant/.