Raspberry Pi 3 B+ 开箱基本配置(Windows环境下)

1. 下载系统

这里下载最新的镜像,或者在这里下载历史镜像。
建议下载种子,然后使用迅雷等下载工具下载。
dl01
dl02

2. 写入SD卡

下载 Win32 Disk Imager,直接下载即可,安装。
将SD卡通过读卡器连接到电脑,从下载的文件(.zip)解压出系统(.img),选择后写入,等待5分钟左右。
写入完成后,在boot盘里新建空白文件ssh,不需要后缀,后续SSH连接时使用。
dl03

3. SSH连接

将SD卡插到树莓派上,将树莓派连接到路由器,上电。
登录路由器管理界面,便能看到名为raspberrypi的连接,记下IP地址。
使用Xshell或者Putty等,通过SSH方式登录树莓派,默认帐号pi,密码raspberry
cn01

4. 配置网络

给有线网络配置静态IP地址,可通过路由器静态IP配置,也可通过修改树莓派的网络接口配置文件/etc/network/interfaces。配置完都要重启树莓派。
方法一,用ifconfig查看eth0的MAC地址(ether后就是MAC地址),然后使用路由器静态IP配置。

pi@raspberrypi:~ $ ifconfig -a
eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 12:34:56:78:9a:bc  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

cn02
方法二,修改树莓派配置文件。

pi@raspberrypi:~ $ sudo vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet static
	address 192.168.0.112
	netmask 255.255.255.0
	gateway 192.168.0.1

以下是无线配置,如果打算使用有线就跳过无线配置。
修改网络接口配置文件/etc/network/interfaces

pi@raspberrypi:~ $ sudo vi /etc/network/interfaces

在最后添加:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "[YOUR WIFI SSID]"
wpa-psk  "[YOUR WIFI PASSWORD]"

这是设置动态IP,静态IP参考有线的配置。
例如:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "HaydnLiao"
wpa-psk "12345678"

如果出现Wi-Fi is currently blocked by rfkill,使用rfkill unblock打开无线网络。

pi@raspberrypi:~ $ rfkill list
0: phy0: Wireless LAN
        Soft blocked: yes
        Hard blocked: no
1: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
pi@raspberrypi:~ $ rfkill unblock 0
pi@raspberrypi:~ $ rfkill list
0: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no

5. 网络名称

默认是raspberrypi,单个修不修改都可以,多个需要辨识就修改一下。
要改两个地方,/etc/hostname/etc/hosts
首先,hostname直接在里面替换掉就可以,必须是一个单词,不能包含任何标点符号和特殊字符(包括下划线_)。

pi@raspberrypi:~ $ sudo vi /etc/hostname 

其次,hosts中最后一行,将raspberrypi替换成与前面一致的单词。

pi@raspberrypi:~ $ sudo vi /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       raspberrypi

配置完成后重启树莓派。

6. 图形桌面

使用RDP(Remote Desktop Protocol,远程桌面协议)登录树莓派,需要安装xrdp软件。

pi@raspberrypi:~ $ sudo apt-get install xrdp

xrdp是一个 守护进程,安装完后和树莓派启动时,xrdp服务会自动启动。
在Windows中,按住WIN+R,弹出运行窗口, 输入mstsc,启动远程桌面连接
cn03
cn04
cn05
账户信息和登录树莓派是使用的一样,默认帐号pi,密码raspberry

7. 修改密码

出于安全考虑,通过passwd修改用户piroot密码。

pi@raspberrypi:~ $ sudo passwd pi
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
pi@raspberrypi:~ $ sudo passwd root
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

注意RDP登录的密码也受此影响。

8. 更新系统

update从更新源中重新同步包索引文件,升级前应始终执行,apt-get才知道有哪些新版本软件包可用。

pi@raspberrypi:~ $ sudo apt-get update

upgrade从更新源中安装当前系统上所有已安装软件的最新版本,耗时较长。

pi@raspberrypi:~ $ sudo apt-get upgrade

将软件源更改为国内源(网络稳定):为树莓派更换国内镜像源

sudo vi  /etc/apt/sources.list
# 注释掉原内容
# 添加以下内容
# 注意,如果系统是buster的,要将stretch改为buster。
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

sudo vi /etc/apt/sources.list.d/raspi.list
# 注释掉原内容
# 添加以下内容
# 注意,如果系统是buster的,要将stretch改为buster。
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui

# 最后,更新软件源列表
sudo apt-get update
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值