Raspberry Pi 4B Newbie: Install official Raspbian Buster system and basic configuration
1. Foreword
For many programmers, Raspberry Pi is not something new. For a newcomer to the AI field like me, the Raspberry Pi has inspired me a lot. I first learned about the Raspberry Pi from a speech robot can have dialogue when I tried to make one myself. I was amazed and wanted to experiment by myself.
As a beginner, I still want to use the latest version of the Raspberry Pi 4B to avoid being left behind as soon as I step in the field. With a Raspberry Pi in hand, the first thing for newbie is to figure out how to use it. This article is going to introduce to newbie how to install the Raspberry Pi system and configure it. There are dozens of systems that can be installed on the Raspberry Pi. I mainly introduce how to install the latest version of the official’s, and perform basic configuration of the system to help newbie unbox.
2. What are the features of Raspberry Pi 4B?
The speed and performance of the new Raspberry Pi 4 is a step up from earlier models. For the first time, we’ve built a complete desktop experience.
Whether you’re editing documents, browsing the web with a bunch of tabs open, juggling spreadsheets or drafting a presentation, you’ll find the experience smooth and very recognizable —
but on a smaller, more energy-efficient and much more cost-effective machine.
Silent, energy-efficient
The fanless, energy-efficient Raspberry Pi runs silently and uses far less power than other computers.
Fast networking
Raspberry Pi 4 comes with Gigabit Ethernet, along with onboard wireless networking and Bluetooth.
USB 3
Your new Raspberry Pi 4 has upgraded USB capacity: along with two USB 2 ports you’ll find two USB 3 ports, which can transfer data up to ten times faster.
Your choice of RAM
Your new Raspberry Pi 4 has upgraded USB capacity: along with two USB 2 ports you’ll find two USB 3 ports, which can transfer data up to ten times faster.
We’re making different variants of the Raspberry Pi 4 available, depending on how much RAM you need — 1GB, 2GB or 4GB.
Item Specification:
Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC 1.5GHz
1GB, 2GB or 4GB LPDDR4-2400 SDRAM (depending on model)
2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE
Gigabit Ethernet
2 USB 3.0 ports; 2 USB 2.0 ports.
Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with previous boards)
2 × micro-HDMI ports (up to 4kp60 supported)
2-lane MIPI DSI display port
2-lane MIPI CSI camera port
4-pole stereo audio and composite video port
H.265 (4kp60 decode), H264 (1080p60 decode, 1080p30 encode)
OpenGL ES 3.0 graphics
Micro-SD card slot for loading operating system and data storage
5V DC via USB-C connector (minimum 3A*)
5V DC via GPIO header (minimum 3A*)
Power over Ethernet (PoE) enabled (requires separate PoE HAT)
Operating temperature: 0 – 50 degrees C ambient
3. Preparation
You need to prepare a Raspberry Pi and power cable, an SD card, an HDMI cable, a USB mouse, a USB keyboard, and a monitor. The process is as follows:
First download the official Raspberry Pi system on the official website, and burn the system to the Micro SD card;
Secondly insert the SD card into the Raspberry Pi, plug in the power cable, the mouse, keyboard, then connect the monitor, start, light up, and then enter the system;
Thirdly perform related configuration through the mouse and keyboard.
The three main processes are introduced in the form of pictures and texts in turn as follows.
4. Burn the Raspbian Buster system to Micro SD card.
First download the official Raspberry Pi system on the official website. There are three versions:
https://www.raspberrypi.org/downloads/raspbian/
The Lite version is a minimal installation without a desktop environment; the Desktop version has a desktop; the Desktop and recommended software version also comes with recommended software, it is relatively large. I chose the most complete version. Click the Download ZIP button to download the compressed package and unzip it to get a system image file with the extension .img.
Prepare a Micro SD card (≥16G, Class 10 and above, such as SanDisk High Speed I use) and a card reader. Format the Micro SD card with SDFormatter first. The interface is simple.
Then use Win32 Disk Imager to write the decompressed Raspbian system image file to the Micro SD card, and the Raspberry Pi system disk will be ready.
With the disk management tool, you can find that it is divided into three areas: boot, system, and free space.
Note: After the system is written, do not format the disk of the remaining space if it prompts up to. Otherwise, the system may fail to start when the Raspberry Pi is turned on. This is because the Raspberry Pi system defaults to using only the SD card space required by the operating system when turned on. This means that even if you have an SD card with large capacity, the operating system will not use that much capacity.
If the system reports the error: end Kernel panic – not syncing:vfs unable to mount root fs on unknown -block(179,2). It may be caused by formatting of the remaining disk in the SD card. Do not select to format, and then insert it into the Raspberry Pi to restart.
All the software needed can be downloaded from my Baidu cloud disk and used directly. link:
https://pan.baidu.com/s/1vbGQ1Php3MAfp1quIMrTNg
Enable SSH and configure wireless connection.
In fact, this step is for the convenience of configuring the Raspberry Pi through remote connection without headless (without I / O devices including display).
Create a new empty file named ssh under the boot partition to enable SSH. On macOS, run touch / Volumes / boot / ssh in terminal.
Create a new wpa_supplicant.conf file under the boot partition and write the relevant wireless configuration. In order not to leak information, the following are just examples. You can configure multiple wireless networks at the same time.
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="wi-fi name here"
psk="wi-fi password here"
key_mgmt=WPA-PSK
}
network={
ssid="another wi-fi name here"
psk="another wi-fi password here"
key_mgmt=WPA-PSK
}
If the wireless network has no password or adopts WEP encryption, key_mgmt should be set to NONE, and the password field should be changed from psk to wep_key0.
5. Start installing Raspberry Pi system
(Here is a GIF for Raspberry Pi 3B, for reference!)
- Insert the SD card withinstalled system into the Raspberry Pi.
- Connect the USB keyboard and mouse to the Raspberry Pi.
- Connect the Raspberry Pi to theTV or monitor with an HDMI cable. If your monitor has a VGA output, you also need an HDMI to VGA cable.
- Connect the Raspberry Pi and the router with a network cable(Optional).
- Connect the power cableand turn on the power.
Start Raspberry Pi
Insert the Micro SD card into the card slot on the back of the Raspberry Pi, power on. When the red power indicator light on the Raspberry Pi motherboard is on, and the green indicator light flashes occasionally, the system has started to boot. If you connect the monitor, you will see the Raspberry Pi logo, and then it will enter the interface of the Raspbian system, and pop up a Welcome to Raspberry Pi window as a setup wizard, as shown in the figure below. Configure the country, language, time zone, and set the login password and WiFi.
If the settings in the previous step are correct, the Raspberry Pi will automatically connect to the Internet. Go to the management page of your router to find the IP assigned to the Raspberry Pi (or using network segment scanning tool), make sure the computer is on the same network segment, and then use SSH tools (PuTTY, XShell, etc.) or SSH command line to the Raspberry Pi . Default user name is pi and the password is raspberry. This is a capture with MBP after login.
6. Basic configuration of Raspberry Pi
a. System configuration
Change the password of the pi and root account.
sudo passwd pi
sudo passwd root
Unlock the root user without having to sudo every time.
sudo passwd --unlock root
b. Change apt software source and system source
Both Raspbian and Ubuntu are based on Debian Linux systems, so the common apt and dpkg things on Ubuntu are the same to Raspbian. Note that the built-in editor is not vim, but a fool-like nano.
Firstly, back up the source files.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
Sudo cp /etc/apt/sources.list.d/
raspi.list /etc/apt/sources.list.d/raspi.list.bak
Secondly, edit the system source file.
sudo nano /etc/apt/sources.list
Thirdly, comment out the original source with # and add the following two lines of Tsinghua’s mirror source.
Note: The Raspberry Pi system we use here is the Raspbian-buster system, so pay attention to the buster when writing the system source link. Many online tutorials are the previous stretch version, which is easy to make mistakes!
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
Fourthly, press Ctrl + O to save, Ctrl + X to exit.
Fifthly, execute the following command sudo apt-get update to complete the source package update index.
sudo apt-get update
Lastly, can choose to update the upgrade package, sudo apt-get upgrade
Then you can use apt-get to install what you want, such as vim. Then you also need to change the system source.
sudo nano /etc/apt/sources.list.d/raspi.list
You can also use the system source of the University of Science and Technology, comment the previous code, and add the following code
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ buster main ui
c. Change pip source
The main programming language on the Raspberry Pi is Python.
Create a new ~ / .pip / pip.conf file and write its address.
[global]
index-url = http://pypi.douban.com/simple/
The Buster system comes with two versions of Python, 2.7.16 and 3.7.3, so it is best to distinguish them when using, for example:
root@raspberrypi:~# python2 -m pip show RPi.GPIO
Name: RPi.GPIO
Version: 0.6.5
Summary: A module to control Raspberry Pi GPIO channels
Home-page: http://sourceforge.net/projects/raspberry-gpio-python/
Author: Ben Croston
Author-email: ben@croston.org
License: MIT
Location: /usr/lib/python2.7/dist-packages
Requires:
Required-by: skywriter, rainbowhat, phatbeat, motephat, envirophat, Cap1xxx, blinkt, automationhat
d. Install Remote Desktop
Generally speaking, managing Raspberry Pi via SSH is enough. If you need to log in to the desktop remotely, you must install VNC Server on the Raspberry Pi and start a VNC stream. You will be asked to set a password during startup, which is limited to 8 digits.
sudo apt-get install tightvncserver
tightvncserver :1
Then download VNC Viewer on the actual machine, enter the IP address of the Raspberry Pi, the code of the VNC stream (that is: 1), and the password just configured, then you can use the remote desktop.
To prevent the Raspberry Pi’s IP address from changing every time, you can change DHCP to a static IP. Edit the /etc/dhcpcd.conf file and add the following configuration. If it is a wired network, change wlan0 to eth0.
interface wlan0
static ip_address=192.168.1.111/24
static routers=192.168.1.1
static domain_name_servers=114.114.114.114
Well, the above is the basic operation and configuration of the Raspberry Pi 4B for newbies. I hope you can get started and free your imagination to use the Raspberry Pi to create