一、安装系统
1.从树莓派官网下载镜像,注意自己应该是什么版本的的,我下的是stretch的
2.格式化闪迪tf卡,用win32diskimager写入镜像
如果是已经写过镜像的卡,先写入bootsector.img,再格式化
下载bootsector.img 链接(http://www.alexpage.de/download/usbit/bootsector.img )
注意,写入镜像之后系统会询问是否格式化,千万不要格式化
二、开机前配置
1.打开ssh:
在boot盘下新建一个ssh的空文件
2.连接无线网:
在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
}
三、开机后配置
插上内存卡和电源开始配置
接通电源之后等待一段时间,到路由器的配置界面查看树莓派的ip或者使用AdvancedIPScaneer搜索树莓派的ip地址
1、ssh登陆
在windows电脑上使用xshell等软件登陆树莓派
或者直接在windows的命令行或者linux命令行下输入
ssh pi@ip地址 -p 22
登陆
树莓派官网的系统默认用户名是pi,默认密码是raspberry
2、修改root密码和pi密码
sudo passwd root
sudo passwd pi
3、修改软件源
因为我下载的系统是stretch版本的,因此以下更改都是针对该版本更换软件源:
注意:一定要用对软件源第一次就是因为没注意用错了导致之后软件一直装不好,推荐使用阿里的
3.1
sudo nano /etc/apt/sources.list.d/raspi.list
备注掉原来的内容,贴入下列其中的
#中科大
deb https://mirrors.ustc.edu.cn/archive.raspberrypi.org/ stretch main ui
#清华
deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
注:nano的话ctrl+x退出,ctrl+o保存
3.2
sudo nano /etc/apt/sources.list
备注掉原来的内容,贴入下列其中的
#中科大
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
#清华
deb https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
#大连东软
deb http://mirrors.neusoft.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
#重庆大学
deb http://mirrors.cqu.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
#浙江大学
deb http://mirrors.zju.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
#阿里云
deb http://mirrors.aliyun.com/raspbian/raspbian/ stretch main contrib non-free rpi
#搜狐
deb http://mirrors.sohu.com/raspbian/raspbian/ stretch main contrib non-free rpi
3.3换源之后更新一下
sudo apt-get update
sudo apt-get upgrade
4、修改配置
sudo raspi-config
进入配置界面
配置界面的操作为上下,enter键选中,tab键跳到选择,空格键为添加*
4.1 配置语言
localisation options --> change locale
用空格键给zh_CN.UTF-8 UTF-8打上*号
tab键跳转到ok,选择zh_CN.UTF-8
4.2 配置时间
localisation options --> change timezone --> Asia --> Shanghai
4.3 挂载磁盘
Advanced Options --> Expand Filesystem ensures that all of the SD card storage is available to the OS
配置完会要求重启,可以重启也可以之后一块重启
5、vnc配置
5.1. 必须先安装tightvncserver!!!
sudo apt-get install tightvncserver
一定要耐心等待下载完成才能下一步操作。不然后面会出现问题
(出现问题Unable to locatepacket则输入sudoapt-get update)
5.2. 再安装xrdp服务。
sudo apt-get install xrdp
5.3. 给树莓派安装服务包
sudo apt-get install vnc4server tightvncserver
5.4 配置
配置xrdp
sudo /etc/init.d/xrdp start #启动xrdp
sudo update-rc.d xrdp defaults #将xrdp服务添加到系统默认启动服务
设置密码
sudo vncpasswd
设置开机自启
sudo nano /etc/init.d/tightvncserver
写入以下内容
#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO
# More details see:
# http://www.penguintutor.com/linux/tightvnc
### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='pi'
### End customization required
eval cd ~$USER
case "$1" in
start)
# 启动命令行。此处自定义分辨率、控制台号码或其它参数。
su $USER -c '/usr/bin/tightvncserver -depth 16 -geometry 800x600 :1'
echo "Starting TightVNC server for $USER "
;;
stop)
# 终止命令行。此处控制台号码与启动一致。
su $USER -c '/usr/bin/tightvncserver -kill :1'
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
给tightvncserver文件添加权限,并更新开机启动列表
sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults
最后重启一下
sudo reboot
6、配置中文输入法
安装中文字体库
sudo apt-get install ttf-wqy-zenhei
安装中文输入法
sudo apt-get install fcitx fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin
重启生效
sudo reboot
7、配置3.5寸屏幕(不必须)
7.1、
将driver文件夹中的“LCD-show.tar.gz”拷贝到TF卡根目录
7.2、
在terminal终端中输入如下指令:
cd /boot
sudo tar zxvf LCD-show.tar.gz
cd LCD-show
sudo ./LCD35-show
8、一些其他软件
sudo apt-get install vim
9、其他设置
第一次使用之后要重新设置wifi
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
配置的格式为
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="wifi1"
psk="password"
key_mgmt=WPA-PSK
priority=1
}
network={
ssid="wifi2"
psk="password"
key_mgmt=WPA-PSK
priority=2
}
参考的博客
https://blog.csdn.net/weixin_39449466/article/details/80686835
https://blog.csdn.net/lvxiong2007/article/details/82928334
https://blog.csdn.net/TIME_LEAF/article/details/80937517
https://blog.csdn.net/Tavox/article/details/70994392
http://shumeipai.nxez.com/2016/03/13/how-to-make-raspberry-pi-display-chinese.html
http://shumeipai.nxez.com/2015/03/11/raspberry-pi-to-install-chinese-input-method-fcitx-and-google-pinyin-ime.html
https://blog.csdn.net/Sheildjiang/article/details/79590950
https://blog.csdn.net/u013218907/article/details/44928393
软件源:https://www.jianshu.com/p/67b9e6ebf8a0