安装系统
烧录镜像,略
设置静态IP
$ sudo nano /etc/dhcpcd.conf
增加:
interface eth0
static ip_address=192.168.0.33/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
interface wlan0
static ip_address=192.168.0.3/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
增加:
network={
ssid=“BZZWAN”
psk=“bigzhizhixxoo”
key_mgmt=WPA-PSK
}
ubuntu版本的固定IP设置
ubuntu 16.04 之前版本
修改/etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8
使配置生效
sudo /etc/init.d/networking restart
ubuntu 18.04 之后版本
修改/etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
eth0:
dhcp4: no
optional: true
addresses: [192.168.1.120/24]
gateway4: 192.168.1.1
nameservers:
addresses: [114.114.114.114,8.8.8.8]
wifis:
wlan0:
dhcp4: true
optional: true
access-points:
"无线的SSID名":
password:无线密码
检查语法
sudo netplan generate
使配置生效
sudo netplan apply
关于netplan, 请参考这里: https://netplan.io
安装中文支持
安装中文字体
sudo apt-get install ttf-wqy-zenhei
安装拼音输入法
sudo apt-get install scim-pinyin
进入菜单配置
sudo raspi-config
选择change_locale,在Default locale for the system environment:中选择zh_CN.UTF-8
命令行修改别名
$ vi ~/.bashrc
增加:
alias ll=‘ls -l’
修改软件源
- 查找找到最新的软件源镜像:
http://www.raspbian.org/RaspbianMirrors, - 修改/etc/apt/sources.list
$ cd /etc/apt # 备份 $ cp sources.list sources.list_back # 修改 $ sudo nano sources.list
- 更新软件源和软件
# 更新软件源 $ sudo apt-get update # 更新软件 $ sudo apt-get upgrade
内核模块编译环境
$ uname -a
Linux raspberrypi 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux
$ sudo apt-cache search kernel-headers
kernel-package - utility for building Linux kernel related Debian packages
linux-libc-dev - Linux support headers for userspace development
raspberrypi-kernel-headers - Header files for the Raspberry Pi Linux kernel
$ sudo apt-get install raspberrypi-kernel-headers
将在/usr/src目录下生成两个文件夹linux-headers-4.4.21+ 和 linux-headers-4.4.21-v7+
BCM2835 C Library 安装
$ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gz
$ tar xvzf bcm2835-1.52.tar.gz
$ cd bcm2835-1.52
$ ./configure
$ make
$ sudo make check
$ sudo make install
wiringPi安装
git clone源码,进入目录后编译并安装
$ git clone git://git.drogon.net/wiringPi
$ cd wiringPi
$ ./build
读取所有引脚定义
$ gpio readall
WiringPi中的函数类似于Arduino的wiring系统:
https://github.com/WiringProject
重启
$ sudo reboot