恭喜,你有一个Raspberry Pi 4!怎么办?首先,如果您想要一个点击式界面而不是仅通过终端窗口与您的 Pi 交互,您需要 在您的 Pi 上安装一个操作系统和一个GUI 。
这些说明适用于不想将键盘和鼠标直接连接到Raspberry Pi的初学者。相反,我们将引导您了解如何将网络上的 PC连接到通过以太网线连接到路由器的Raspberry Pi 。你完全可以做到这一点!
如果您按照这些步骤操作,您最终将得到一个运行Debian端口的(Debian)Raspberry (Raspberry Pi)Pi(Raspberry Pi Desktop),您可以通过远程桌面(Remote Desktop)访问该Raspberry Pi 桌面。这些说明针对Raspberry Pi 4进行了优化,但也适用于其他版本的 Pi。
如何在您的 Raspberry Pi 4上安装操作系统和(Your Raspberry Pi 4)GUI
让我们从烹饪中借用一个概念,叫做就地(mise en place)烹饪。这意味着在你开始之前(before )尽可能地准备好你需要的一切。
您需要的硬件
- 树莓派 4(Raspberry Pi 4)。
- SD卡。该卡应至少为 10 级,并且是您可以拿到的最快的,最好是V90 UHS-II。
- 适用于您计算机的 SD 读卡器。
- (Ethernet)将Raspberry Pi(Raspberry Pi)连接到路由器的以太网线。
- 一种为Raspberry Pi(Raspberry Pi)供电的方法。如果您有可以为 Pi 供电的以太网供电交换机,则可以使用以太网供电 Pi HAT 。(power over ethernet Pi HAT)如果您没有这样的开关,请购买官方的 Raspberry Pi 4 USB-C 电源(official Raspberry Pi 4 USB-C power supply)。
注意:购买仿制电源或使用您身边的电源是失败的秘诀。这是最常见且无法追踪的问题之一——电源不够强大。(如果你走Pi Hat路线,你需要一个可以容纳帽子的箱子。)如果你没有箱子,请确保在处理 Pi 时不要接触任何金属。更好(Better)的是,只是得到一个案例。
(Download)将这两个程序下载到您的 PC
- 下载Raspberry Pi Imager。
- 下载Adafruit-Pi-Finder。
安装和启动 Raspberry Pi Imager(Launch Raspberry Pi Imager)
- 打开Raspberry Pi Imager可执行文件imager_1.5.exe。
- 选择您的操作系统 ( Raspberry Pi OS ) 和 SD 卡的位置。然后选择写入(Write)。
根据SD 读卡器与计算机的连接方式(how your SD card reader is connected to your computer),这可能需要一段时间,因此请耐心等待安装。也许找点别的事做(something else to do)。
创建一个名为 SSH 的文件
- 按Windows Key + E在您的 PC 上启动文件资源管理器。通过选择View并确保选中File name extensions旁边的框,将其设置为显示文件扩展名。
- 右键单击并选择新建(New )>文本文档( Text Document)。
- 将您创建的文件重命名为ssh。从文件名中删除扩展名。
将SD 卡(SD Card)传输到您的Raspberry Pi 4
- 从计算机的读卡器中弹出 SD 卡。
- 将 SD 卡插入 Pi。
- 通过以太网线将 Pi 连接到路由器。(您也可以将其设置为通过WiFi连接,但现在,我们将使用有线连接。)
找到你的 Pi 的IP 地址(IP Address)并安装 xrdp(Install xrdp)
- 将您在步骤 2 中下载的Adafruit-Pi-Finder zip 文件解压缩到您的计算机。这个应用程序将帮助您在网络上找到Raspberry Pi(Raspberry Pi)的 IP 地址。
- 运行Adafruit-Pi-Finder可执行文件pifinder.exe。
- 选择查找我的 Pi(Find My Pi)按钮。结果可能需要一段时间才会出现。当他们这样做时,从 IP 地址字段中复制 IP 地址,并将其保存在安全的地方。稍后我们将使用该 IP 地址从您的 PC 连接到您的 Pi。
- 接下来,选择终端(Terminal)。我们稍后会更改密码,所以现在使用默认用户名pi和默认密码raspberry。
- 将打开一个终端窗口。
- 现在我们将下载xrdp软件并将其安装到Raspberry Pi ,这将允许您从(Raspberry Pi)Windows机器连接到Raspberry Pi的桌面。在终端窗口中,键入以下命令:sudo apt-get install xrdp并按Enter。
- 在告诉您将使用多少额外磁盘空间后,安装程序可能会询问您是否要继续。键入y并按enter。
使用远程桌面(Remote Desktop)连接到 Pi并更改(Change)Pi 的密码(Password)
- (Run Remote Desktop Connection)在您的Windows计算机上(Windows)运行远程桌面连接,然后粘贴或输入您的Raspberry Pi的 IP 地址。
- 选择连接(Connect)。
- 将出现一条警告消息。选择是(Yes)。
- 将启动一个远程桌面窗口。输入您的用户名pi和默认 Pi 密码raspberry。
- 选择确定(OK)。
- 多田!您将看到一条欢迎您使用Raspberry Pi 桌面(Raspberry Pi Desktop)的消息!
- 选择下一步(Next)按钮继续。
- 选择您的国家、语言和时区。
- 单击下一步(Next)。
- 现在是时候更改 Pi 的默认密码了。输入(Type)新密码两次。(不要忘记将它保存在某个地方!使用密码管理器(password manager)!如果您丢失了 Pi 的密码,您将陷入困境。)
- 单击下一步(Next)。
- 设置屏幕(Set Up Screen)。“如果您的屏幕边缘有黑色边框,请勾选下面的框。(Tick)” 按(” Press) 下一步(Next)。
- 选择 WiFi 网络(Select WiFi Network)。如果您打算断开 Pi 的以太网与路由器的连接,则只需完成此步骤。选择下一步(Next )或跳过(Skip)。
- 更新软件。按下一步(Next)。
- 软件更新后,您将看到“系统已更新”消息。按确定(OK)。
- 设置完成!选择重新启动(Restart),使新设置生效。下次您使用远程桌面(Desktop)连接到您的 Pi 时,您会看到一个漂亮的 Pi 桌面。
专业提示:永远不要只拔掉你的 Pi。务必(Always)关闭电源,否则可能会损坏 SD 卡。它会破坏内存,你必须重新开始。拔掉它可能会连续工作一百次,然后在第一百次时,它会破坏你的记忆。保持(Stay)安全!
下一步是什么?
如果您成功执行了上述步骤,您现在拥有一个运行具有图形用户界面的操作系统的Raspberry Pi 4 ,您可以通过(Raspberry Pi 4)远程桌面(Remote Desktop)连接到另一台计算机并与之交互。现在您所要做的就是决定如何使用它(decide how to use it)!
How to Get Started with a Raspberry Pi 4
Congratulations, you have a Raspberry Pi 4! Now what? To get started, you’ll want to install an operating system on your Pi as well as a GUI if you want a point-and-click interface instead of only interacting with your Pi through a terminal window.
These instructions are for beginners who don’t want to connect a keyboard and a mouse directly to the Raspberry Pi. Instead, we’ll walk you through how to connect a PC on your network to a Raspberry Pi connected to your router via an ethernet cord. You can totally do this!
If you follow these steps, you’ll end up with a Raspberry Pi running a port of Debian with the Raspberry Pi Desktop that you can access via Remote Desktop. These instructions are optimized for the Raspberry Pi 4 but should also work with other versions of the Pi.
How to Install an OS and GUI on Your Raspberry Pi 4
Let’s borrow a concept from cooking called mise en place. That means preparing everything you’ll need before you start, to the extent you can.
Hardware You Will Need
- Raspberry Pi 4.
- SD card. The card should be at least a class 10 and the fastest one you can get your hands on, preferably a V90 UHS-II.
- SD card reader for your computer.
- Ethernet cord to connect the Raspberry Pi to your router.
- A way to supply power to your Raspberry Pi. You could use a power over ethernet Pi HAT if you have a power over ethernet switch that can provide power to the Pi. If you don’t have a switch like that, get an official Raspberry Pi 4 USB-C power supply instead.
Note: Buying a knock-off power supply or using one you have lying around is a recipe for failure. It’s one of the most common and impossible-to-track-down problems—a power supply that isn’t beefy enough. (If you go the Pi Hat route, you’ll need a case that accommodates the hat.) If you don’t have a case, make sure that you don’t touch any metal while you’re handling the Pi. Better yet, just get a case.
Download These Two Programs to Your PC
- Download Raspberry Pi Imager.
- Download Adafruit-Pi-Finder.
Install and Launch Raspberry Pi Imager
- Open the Raspberry Pi Imager executable, imager_1.5.exe.
- Choose your operating system (Raspberry Pi OS) and the location of your SD card. Then select Write.
Depending on how your SD card reader is connected to your computer, this could take a while, so be patient while it installs. Maybe find something else to do for a bit.
Create a File Called SSH
- Launch the file explorer on your PC by pressing the Windows Key + E. Set it to show file extensions by selecting View and making sure the box is checked next to File name extensions.
- Right-click and select New > Text Document.
- Rename the file you created to ssh. Delete the extension from the filename.
Transfer the SD Card to Your Raspberry Pi 4
- Eject the SD card from your computer’s card reader.
- Insert the SD card into the Pi.
- Connect the Pi to your router via ethernet cord. (You could also set it up to connect via WiFi, but for now, we’ll use a wired connection.)
Find Your Pi’s IP Address and Install xrdp
- Extract the Adafruit-Pi-Finder zip file that you downloaded in step 2 to your computer. This app will help you find the IP address of the Raspberry Pi on your network.
- Run the Adafruit-Pi-Finder executable, pifinder.exe.
- Select the Find My Pi button. Results may take a while to appear. When they do, copy the IP address from the IP address field, and save it somewhere safe. We’ll use that IP address later to connect to your Pi from your PC.
- Next, select Terminal. We’ll change the password later, so for now use the default username pi and the default password raspberry.
- A terminal window will open.
- Now we’ll download and install xrdp software to the Raspberry Pi which will allow you to connect to your Raspberry Pi’s desktop from a Windows machine. In the terminal window, type the following command: sudo apt-get install xrdp and press Enter.
- The installer will probably ask you if you want to continue after telling you how much additional disk space will be used. Type y and press enter.
Connect to the Pi with Remote Desktop and Change the Pi’s Password
- Run Remote Desktop Connection on your Windows computer and paste or type in the IP address of your Raspberry Pi.
- Select Connect.
- A warning message will appear. Select Yes.
- A remote desktop window will launch. Type your username, pi, and the default Pi password, raspberry.
- Select OK.
- Tada! You will see a message welcoming you to the Raspberry Pi Desktop!
- Select the Next button to proceed.
- Choose your country, language, and timezone.
- Click Next.
- Now it’s time to change the default password for your Pi. Type in your new password twice. (Don’t forget to save it somewhere! Use a password manager! If you lose your Pi’s password, you are in for a world of trouble.)
- Click Next.
- Set Up Screen. “Tick the box below if your screen has a black border at the edges.” Press Next.
- Select WiFi Network. You only have to complete this step if you intend on disconnecting your Pi’s ethernet from the router. Select Next or Skip.
- Update Software. Press Next.
- Once the software is updated, you’ll see a “system is up to date” message. Press OK.
- Setup Complete! Select Restart so the new settings will take effect. The next time you use Remote Desktop to connect to your Pi, you’ll be greeted with a beautiful Pi desktop.
Pro tip: Never just unplug your Pi. Always power it down or you could damage your SD card. It will corrupt the memory, and you’ll have to start over. Unplugging it may work a hundred times in a row, and then on the one hundred and first time, it’ll corrupt your memory. Stay safe!
What’s Next?
If you successfully followed the steps above, you now have a Raspberry Pi 4 running an operating system with a graphical user interface that you can connect to and interact with from another computer via Remote Desktop. Now all you have to do is decide how to use it!