Raspberry Pi System Getting Started Tutorial (2) - Connect Raspberry Pi, use VNC and SSH to log in

Raspberry Pi System Getting Started Tutorial (2) - Connect Raspberry Pi, use VNC and SSH to log in

The Raspberry Pi is a microcomputer loved by many developers, and it has become the core of many creative projects because of its small size, low cost, and flexibility. But when you get a new Raspberry Pi board, there may not be an immediate display to connect it to. At this point, how can you successfully access and set up your Raspberry Pi without a monitor? This article will introduce three commonly used methods in detail for you.

1. Set WIFI and enable SSH through the boot partition of the SD card

After you have installed the operating system for the Raspberry Pi and written it to the SD card, you can connect to WIFI and enable SSH by following simple steps:

  1. Set up WIFI,
    put the SD card into the computer card reader, and enter bootthe partition. Create a file called here wpa_supplicant.confand fill it with the following (be careful to replace the appropriate country code, WIFI name and password):
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="你的WIFI名称"
    psk="你的WIFI密码"
    key_mgmt=WPA-PSK
}
  1. Enable SSH
    In order to remotely log into the Raspberry Pi, we need to enable the SSH service. Just create an empty file in bootthe partition, named as ssh(no extension). When the Raspberry Pi starts, it will automatically start the SSH service.

After completing the above steps, insert the SD card into the Raspberry Pi and start it.

2. Connect by network cable

  1. Direct connection to computer
    Connect the Raspberry Pi directly to your computer via a network cable. If the computer's operating system supports obtaining an IP automatically (like most modern operating systems), then it will assign the Raspberry Pi a LAN address.

  2. Using a router
    Connect the Raspberry Pi to the router via a network cable. At this point, the router will assign an IP address to it.

Either way, you will need to know the IP address of the Raspberry Pi. You can log into the router's management interface to view connected devices to get their IPs, or use a Advanced IP ScannerLAN address scanning tool like this one to find out.

Connect Raspberry Pi

After knowing the IP of the Raspberry Pi, you can use an SSH client (such as Putty or Terminal) to log in remotely. The default username is piand password is raspberry.

ssh pi@树莓派的IP地址

After that, you are free to configure your Raspberry Pi, install software, or otherwise operate as if you were directly in front of it.

2. Turn on VNC and connect to the remote desktop

After successfully logging into the Raspberry Pi via SSH, we sometimes wish to operate as conveniently as in the desktop environment. At this time, VNC (Virtual Network Computing) will be your good helper. It allows you to remotely access and control the Raspberry Pi's desktop environment.

Start the VNC service

  1. Enter the following command in an SSH session to enter the Raspberry Pi's configuration interface:
sudo raspi-config
  1. In the menu that appears, select Interfacing Options .

  2. Then select VNC , it will ask if you want to enable VNC, select

  3. Exit raspi-config.

Now the VNC service has been started on the Raspberry Pi.

Connect to VNC

To access the Raspberry Pi remotely, you need a VNC client. We recommend RealVNC Viewer, a free tool available for many operating systems.

  1. Download and install VNC Viewer : It can be downloaded from the official website of RealVNC.

  2. Open VNC Viewer and enter your Raspberry Pi's IP address in the address bar.

  3. Enter the default username and password. Generally, the default username is pi, and the password is raspberry.

You should now see the Raspberry Pi's desktop interface as if you were sitting in front of it!

VNC Connection Recommendations

  • For better display effect, make sure the resolution setting of Raspberry Pi is appropriate. raspi-configModifications can be made in Display Options.

  • For security, it is recommended to change the default password and use VNC only in a secure network environment.

Conclusion :
VNC provides another dimension of convenience for Raspberry Pi. No matter where you are, as long as you have an Internet connection, you can easily access and operate your small computer. Through SSH and VNC, we have truly realized the screenless operation of the Raspberry Pi, which provides great convenience for those users who do not have an additional monitor or work in a remote environment.

Guess you like

Origin blog.csdn.net/qq_41866091/article/details/132353248