One article teaches you to play with Raspberry Pi easily

introduction:

Many novices and even veterans are still using "create a new file, add and change the name to configure ssh and Raspberry Pi networking", I just want to say, this is also possible, but it is not simple and elegant ~~~

Traditional Raspberry Pi ssh configuration:

1. When there is a display

  • Connecting to the Raspberry Pi: Connect the Raspberry Pi to a power source using an HDMI monitor and a USB keyboard, and boot the system.

  • Open Terminal: In the Raspberry Pi desktop environment, click the Raspberry Pi icon in the upper left corner, then select "Accessories", find and click "Terminal" to open a terminal window.

  • Check the SSH service status: Enter the following command in the terminal to check whether the SSH service is enabled:

    sudo service ssh status

    If it shows that the SSH service is enabled, it means that SSH has been configured, and you can skip the next step. If it is displayed that the SSH service is not enabled, continue with the following steps.

  • Enable SSH service: Enter the following command in the terminal to enable SSH service:

    sudo raspi-config

  • Enter the Raspberry Pi configuration interface: In the raspi-config interface, use the arrow keys to select "Interfacing Options" and press Enter.

  • Select SSH: In the Interface Options menu, use the arrow keys to select "SSH" and press Enter.

  • Enable SSH: Select "Enable" and press Enter.

  • Exit raspi-config: select "Finish" and press Enter, then select "Yes" to confirm restart.

  • Wait for reboot: Raspberry Pi will reboot for the SSH configuration to take effect, please wait patiently.

  • Connect to the Raspberry Pi: Open an SSH client (for example, Terminal or PuTTY, etc.) on your computer and use the IP address or hostname of the Raspberry Pi to connect. By default, the username is "pi" and the password is "raspberry".

  • The successful SSH remote access proves that the SSH configuration has been successful.

 2. When there is no display

  1. Prepare the SD card: Prepare the SD card on another computer and burn the desired Raspberry Pi OS image into the SD card, you can use Raspberry Pi Imager to do this.

  2. Enable SSH: In the boot partition of the SD card, create an empty file named "ssh" (lowercase for ssh) (no file extension). This file tells the Raspberry Pi to enable the SSH service on boot.

  3. Configure Wi-Fi (optional): If you want the Raspberry Pi to connect to a Wi-Fi network, you can create a file called "wpa_supplicant.conf" in the boot partition of the SD card and add the following content to the file :

country=YOUR_COUNTRY_CODE

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1

network={

    ssid="YOUR_WIFI_SSID"

    psk="YOUR_WIFI_PASSWORD"

}

Replace "YOUR_COUNTRY_CODE" with your country's two-letter code, "YOUR_WIFI_SSID" with your Wi-Fi network name (SSID), and "YOUR_WIFI_PASSWORD" with your Wi-Fi password.

  1. Safely unmount the SD card: Safely remove the SD card from the computer and insert it into the Raspberry Pi's SD card slot.

  2. Connect the Raspberry Pi: Connect the Raspberry Pi to the router via an Ethernet cable.

  3. Configure the router: Enter the router management interface, find the list of devices connected to the router, and find the IP address of the Raspberry Pi.

  4. Connect to the Raspberry Pi: Open an SSH client (for example, Terminal or PuTTY, etc.), and use the IP address of the Raspberry Pi to connect. By default, the username is "pi" and the password is "raspberry".

But if you know how to use Raspbeery Pi Imager, the officially designated burning tool for Raspberry Pi, then you don’t need any of the above operations! !

 Convenience brought by Raspbeery Pi Imager:

introduce:

Raspberry Pi Imager is an image burning tool officially developed by the Raspberry Pi Foundation, which aims to simplify the installation and configuration process of the Raspberry Pi system. It is a cross-platform application available for Windows, macOS and Linux operating systems.

With Raspbeery Pi Imager, we no longer need to create files as above, check our own ip on the router, find our time zone, etc.~~~~~ (And with this one  , There is no need to use redundant software such as Win32DiskImager and SDFormatter)

 First select the operating system that needs to be burned (online burning requires networking, and it also supports burning local system files without networking):

Support for erasing and burning custom image files on the SD card (you can find it by pulling down):

 And now officially supports 64-bit systems:

 Back to our original topic: SSH configuration and networking

Click the gear on the software home page, as follows:

 Here, you can directly configure the Raspberry Pi directly before burning, such as SSH, WIFI, etc.

Doing this, I feel really "elegant"~~~

Guess you like

Origin blog.csdn.net/weixin_53000184/article/details/131720505