1 准备工作
1 SD card Formatter
#官网下,用来格式化SD卡
2 Raspbian Stretch with desktop
#官网下载,直接下载很慢或无法下载的话,那就下载torrent,转换为磁力链接后用迅雷
3 etcher
#官网下
2 开始官网下载系统
到树莓派官网去下载最新版的Raspbian。由于后续工作需要用到图形界面,选
Raspbian Stretch with desktop。树莓派官网推荐用etcher安装,听官方的没错。下载etcher并安装。
2.1 烧写系统镜像到sd卡
由于操作系统安装在SD卡上,SD卡的读写速度直接影响系统运行速度,因此SD卡要选尽量快的。我用的是32G的98MB/S的SD卡。
我下载的镜像文件是 2018-11-13-raspbian-stretch.zip
在电脑上插上SD卡。不用解压,直接用etcher打开下载来的压缩包。
Flash
3 系统的初始化
准备两个文件
一个 ssh 有没有内容都无所谓,没有后缀
一个 wpa_supplicant.conf
3.1 开启ssh连接
首先在tf卡中保存一个ssh的空文件,为了打开ssh功能。
3.2 设置无线网连接
然后设置上网,在tf卡也就是当前的boot盘新建一个wpa_supplicant.conf的文件,写入上网配置命令:
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WIFI名字"
psk="WIFI密码"
key_mgmt=WPA-PSK
priority=1
}
如果用的手机热点,就添加以下两行代码,如果不用去删除掉
key_mgmt=WPA-PSK
priority=1
系统启动后,这两个会被删除。如果你改了Wifi密码,还可以再做一次
不想拔卡再做一次,可以在系统内 cd /boot ,touch 一下
但如果因为SD卡为 ReadOnly 而无法写入这两个文件的话
搜索下载 usbroot
重新插拔SD卡,并打开usbroot,选“用0重置参数”,然后 “开始”
如果提示“无法打开…”,不用管,重新插拔SD卡即可。
4 显示设置
sudo nano /boot/config.txt
在boot目录下,找到 config.txt 文件,里面许多选项被注释掉了,我们需要在选择以下命令,注意修改后面的数字:
#For more options and information see
#http://rpf.io/configtxt
#Some settings may impact device functionality. See link above for details
#uncomment if you get no picture on HDMI for a default “safe” mode
#hdmi_safe=1
#uncomment this if your display has a black border of unused pixels visible
#and your display can output without overscan
disable_overscan=1#可以去掉开机屏幕周围的黑色边框
#uncomment the following to adjust overscan. Use positive numbers if console
#goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
#uncomment to force a console size. By default it will be display’s size minus
#overscan.
#framebuffer_width=1280
#framebuffer_height=720
#uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1#
#uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2#DMT模式
hdmi_mode=58 #分辨率为适应屏幕分辨率的选择
#uncomment to force a HDMI mode rather than DVI. This can make audio work in
#DMT (computer monitor) modes
hdmi_drive=2
#uncomment to increase signal to HDMI, if you have interference, blanking, or
#no display
config_hdmi_boost=4
#uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
#Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
#Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
#Additional overlays and parameters are documented /boot/overlays/README
#Enable audio (loads snd_bcm2835)
dtparam=audio=on
这里一开始选择了hdmi_safe=1,结果相当于windows电脑开启了安全模式,分辨率非常小,所有的改动都无法生效,因此务必将这行注释掉,才可以使其他的显示设置生效。(又是无数次重装系统后认识到的坑。。。) |
---|
5 进入Raspbian系统
5.1 有键、鼠、显示器的操作
树莓派 连接好 HDMI,鼠标,键盘,插上 SD卡
通上电(电脑USB或者充电宝),搞定
5.2 就只有一根电源连着Pi的操作
5.2.1 Putty 连接
登录路由器设置端口,找到树莓派的 ip 地址
putty
输入 树莓派 ip 进入
login as: pi #默认 pi
pi@192.168.x.x password: raspberry #默认 raspberrypi
5.2.2 VNC连接
直接不可连,会 refused by the computer,先用putty,如上5.2.1
sudo raspi-config
第五行 设置 SSH VNC Camera --> enable:
进入 5 Interfacing Options 的 SSH VNC Camera 全部 enable
reboot
RealVNC 官网下载 VNC-Viewer
输入树莓派 ip
name : pi #默认 pi
password: raspberry #默认 raspberrypi
大功告成