计算机‎ > ‎软件‎ > ‎Linux‎ > ‎

Ubuntu 安装 Raspbian 到 Raspberry Pi 2

发布者:guo rue,发布时间:2015年4月10日 08:42   [ 更新时间:2015年4月10日 09:01 ]
之前安装 B+ 版本的教程在这里看 
http://wiki.guoruei.org/computer/software/linux/ubuntu-dd-raspbian-to-raspberry-pi-plus
之前安装 B 版本的教程在这里看 
http://wiki.guoruei.org/computer/software/linux/ubuntu-dd-raspbian-to-raspberry-pi

据说旧有系统不支持这个版本的硬件了。那,买来之后,就是下载新系统了。

下载系统
官方默认下载地址
http://www.raspberrypi.org/downloads/

我选了下面这个系统版本
RASPBIAN
Debian Wheezy
Release date:2015-02-16
Default login:pi / raspberry
Kernel version:3.18
Release notes:Link
SHA-1:b71d7b61f44e9bd582df71c9be494c271c97650f

2015-02-16:
  * Newer firmware with various fixes
  * New Sonic Pi release
  * Pi2 compatible RPi.GPIO
  * Updated Wolfram Mathematica
2015-01-31:
  * Support for Pi2
  * Newer firmware
  * New Sonic Pi release
  * Updated Scratch
  * New Wolfram Mathematica release
  * Updated Epiphany
2014-12-24:
  * Fix regression with omission of python-pygame
2014-12-22:
  * New firmware with variosu fixes and improvements
  * New UI configuration for lxde
  * Various package updates
  * python3-pygame preinstalled
  * 'nuscratch', scratch running on the Cog StackVM
  * Misc other changes
2014-09-09:
  * New firmware with various fixes and improvements
  * Minecraft Pi pre-installed
  * Sonic Pi upgraded to 2.0
  * Include Epiphany browser work from Collabora
  * Switch to Java 8 from Java 7
  * Updated Mathematica
  * Misc minor configuration changes
2014-06-20:
  * New firmware with various fixes, and kernel bugfix
2014-06-02:
  * Many, many firmware updates with major USB improvements
  * pyserial installed by default
  * picamera installed by default
2014-01-07:
  * Firmware updated
  * Some space saved on the root filesystem
2013-12-20:
  * Firmware updated, includes V4L2 fixes
  * Update omxplayer
2013-12-18:
  * Firmware updated and now using kernel 3.10. Many, many improvements
  * fbturbo XOrg driver is now included and enabled by default. Thanks to 
    ssvb https://github.com/ssvb/xf86-video-fbturbo
  * Update Scratch image with further bug fixes
  * Include Wolfram Mathematica
  * Update to PyPy 2.2
  * Update omxplayer
  * Include v4l-utils for use with experimental V4L2 Raspberry Pi camera driver
  * Update squeak-vm to fix issues with loading JPEGs
2013-09-25:
  * Update Scratch image for further performance improvements
  * Include Oracle JDK
  * At least a 4GiB SD card is now required (see above)
  * Include PyPy 2.1
  * Include base piface packages
  * Update raspi-config to include bugfix for inheriting language settings 
    from NOOBS
2013-09-10:
  * Updated to current top of tree firmware
  * Update squeak-vm, including fastblit optimised for the Raspbery Pi
  * Include Sonic Pi and a fixed jackd2 package
  * Support boot to Scratch
  * Inherit keyboard and language settings from NOOBS

不得不说,下载速度卡成狗。不过总算下完了。

烧录系统进 SD 卡

解压缩镜像
unzip  2015-02-16-raspbian-wheezy.zip

运行 df -h 命令查看当前哪些设备已经挂载,插入SD卡后,再次运行 df -h ,找出两次运行区别。区别就是多出这两个:
/dev/sdb1
/dev/sdb5
为了防止在写入镜像的时候有其他读取或写入,我们需要卸载设备。两个分区都要卸载
umount /dev/sdb1

使用dd命令写入镜像至SD卡
sudo dd bs=4M if=2015-02-16-raspbian-wheezy.img of=/dev/sdb
打开另一个命令行执行
sudo pkill -USR1 -n -x dd
这样可以查看进度

完成之后,取出 SD 卡,插入树莓派,给树莓派接上网线和 USB电源。
开机
然后,在路由器上查看到 树莓派 被 DHCP服务器 分配到 192.168.1.101 这样的一个 IP地址。
那就先 SSH登录 吧。
ssh -p 22 pi@192.168.1.101
密码raspberry

获取 root 权限
为了方便折腾,建议第一时间启用 ROOT 账号吧,这个也很简单的:

// 设置 root 账号的密码,会让你输入两次新密码
sudo passwd root
// 启用 root 账号登录
sudo passwd --unlock root
执行完之后,用 su 命令就可以用 root 登录啦
su root
密码

扩容 SD 卡
raspi-config
上下键 选择1 Expand filesystem 
左右键 选择 Finish 回车

这样系统将会在重启后完成分区扩容。

启用 USB无线网卡
关机,插入USB无限网卡,开机。测试你周围的无线网络了。输入如下命令
sudo iwlist wlan0 scan
如果搜索到了无线网络,会返回无线网络的MAC地址,SSID等相关信息。 

输入如下命令来编辑你的网络配置文件,输入如下命令
sudo nano /etc/network/interfaces


auto lo
 
iface lo inet loopback
iface eth0 inet dhcp

后面的几行注释掉或者删除掉,输入下面几行
 
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
   wpa-scan-ssid 1
   wpa-ap-scan 1
   wpa-key-mgmt WPA-PSK
   wpa-proto RSN WPA
   wpa-pairwise CCMP TKIP
   wpa-group CCMP TKIP
   wpa-ssid "My Secret SSID"
   wpa-psk "My SSID PSK"
 
iface default inet dhcp

记得 My Secret SSIDMy SSID PSK 换成自己的。保存。退出 nano 吧。

上述定义后使用命令重新启动系统
sudo reboot
成功后,用 ifconfig 命令可以看到 wlan0 设备,且有了IP地址(已连接)。可以通过这个IP地址无线链接这个设备了。

更新系统
执行 命令更新软件列表。
sudo apt-get update
下载安装更新列表的内容
sudo apt-get upgrade

安装文泉驿中文字体
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei

安装ibus五笔及拼音输入法
sudo apt-get install ibus ibus-pinyin ibus-table-wubi