Rasp config

直接$sudo raspi-config进入:

  • Expand Filesystem:将系统扩展到整个SD卡,必须执行,一路敲回车即可
  • Change User Password:修改密码及账号,若要修改,请牢记
  • Boot Options:启动选项,选desktop,下次启动将直接进入桌面系统
  • Wait for Network at Boot:等待网络唤醒,服务器模式
  • Internationalisation Options:地区和语言设置,选择zh_CN UTF-8,即可切换到中文模式
  • Enable Camera:CSI摄像头开启或关闭,选择enable则开启
  • Add to Rastrack:将树莓派加入Rastrack社区
  • Overclock:超频,一般不超频,若要超频请谨慎操作,并做好散热
  • Advanced Options:高级选项,包括Overscan, Hostname, Memory Split(内存分配), SSH
  • About raspi-config:本机相关信息。

Update software resource

如果不熟悉自带的nano编辑器,请安装编辑利器vim, 修改sources, 不然update太慢了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//install vim
$ sudo apt-get install vim -y

$ sudo vim /etc/apt/sources.list

#modify
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi

//update
$ sudo apt-get update

//upgrade
$ sudo apt-get upgrade -y

Configure static IP & WIFI

默认是启用DHCP自动获取IP. 修改network配置

1
$ sudo vim /etc/network/interfaces

如果设置有线网卡ip

1
2
3
4
iface eth0 inet static 
address 192.168.1.2 # 设定的静态IP地址
netmask 255.255.255.0 # 网络掩码
gateway 192.168.1.1 # 网关

如果设置无线网卡

1
2
3
4
5
6
7
8
iface wlan0 inet static 
wpa-ssid Your_Wifi_SSID
wpa-psk Your_Wifi_Password
address 192.168.1.2 # 设定的静态IP地址
netmask 255.255.255.0 # 网络掩码
gateway 192.168.1.1 # 网关
network 192.168.1.1 # 网络地址
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

PS.以上方法很长时间导致我无法ssh树莓派,迫使吃灰中。最近有空闲下来,重新刷了jessie

!!!! /etc/network/interface里面明明写的很清楚:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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 manual

allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

于是 查看dhcpcd文档,man dhcpcd.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
static value
Configures a static value. If you set ip_address then dhcpcd will not attempt to obtain a lease and
just use the value for the address with an infinite lease time.

Here is an example which configures a static address, routes and dns.
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

Here is an example for PPP which gives the destination a default route. It uses the special destination
keyword to insert the destination address into the value.
interface ppp0
static ip_address=
destination routers

所以只需在/etc/dhcpcd.conf下面加上以下设置

PS.目前的策略仍是eth0静态IP, wlan0自动获取IP, wlan1中继

1
2
3
4
5
interface eth0
static ip_address=192.168.11.x/24
static routers=192.168.11.1
static domain_name_servers=114.114.114.114 119.29.29.29
# dns server using telcom dns or dnspod dns

然后配置无线SSID认证:

1
sudo sh -c "wpa_passphrase your_ssid your_password >> /etc/wpa_supplicant/wpa_supplicant.conf"

最后restart network即可。

Remote

因为默认是打开ssh的,所以通过vnc访问rasp需要安装xrdp

1
$ sudo apt-get install xrdp

ohters configuration

设置中文,系统却显示乱码,是因为系统缺少中文字库。

1
$ sudo apt-get install ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy