New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24.Mac下给SD卡安装树莓派Raspbian系统 #25

Open
ccforward opened this Issue Sep 11, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@ccforward
Owner

ccforward commented Sep 11, 2015

Mac下给SD卡安装 Raspbian 系统

1、安装

系统下载地址

插入SD卡,使用 df 查看当前已经挂载的卷

$ df
Filesystem    512-blocks      Used Available Capacity  iused   ifree %iused  Mounted on
/dev/disk1     233269248 218788512  13968736    94% 27412562 1746092   94%   /
devfs                374       374         0   100%      648       0  100%   /dev
map -hosts             0         0         0   100%        0       0  100%   /net
map auto_home          0         0         0   100%        0       0  100%   /home
/dev/disk2s1    31100416      4992  31095424     1%        0       0  100%   /Volumes/Pi

因为已经命名了SD卡为 Pi ,所以SD卡的分区对应的设备文件为:/dev/disk2s1

使用diskutil unmount卸载

$ diskutil unmount /dev/disk2s1
Volume Pi on disk2s1 unmounted

diskutil list 确认设备 我买的是16G的卡

$ diskutil list
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *15.9 GB    disk2
   1:                 DOS_FAT_32 Pi                      15.9 GB    disk2s1

使用dd命令将系统镜像写入
PS /dev/disk2s1是分区,/dev/disk2是块设备,/dev/rdisk2是原始字符设备

$ dd bs=4m if=pi.img of=/dev/rdisk2
781+1 records in
781+1 records out
3276800000 bytes transferred in 194.134151 secs (16879050 bytes/sec)

至此,SD卡上已经刷入了 Raspbian 系统

再用diskutil unmountDisk卸载设备

$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful

2、配置

把SD卡插入树莓派,连上网线,因为不知道树莓派的ip,所以在网上随便找了个扫描ip的软件(Free IP Scanner),然后在一台windows电脑上扫描了局域网内的所有ip,其中端口为22的ip就是我们的树莓派了。

然后就是 ssh 登录树莓派 用户名 pi 密码 raspberry

$ ssh pi@192.168.1.170
pi@192.168.1.170's password:
Linux raspberrypi 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Sep 11 11:16:12 2015 from c.local

NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'

说得很明显,执行 sudo raspi-config 如图

选择第一项 Expand Filesystem 扩展 SD 卡上可用的空间,不然以后安装大软件会提示空间不足

执行 df -h

pi@raspberrypi ~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          2.9G  2.4G  335M  88% /
/dev/root       2.9G  2.4G  335M  88% /
devtmpfs        460M     0  460M   0% /dev
tmpfs            93M  224K   93M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           186M     0  186M   0% /run/shm
/dev/mmcblk0p1   56M   19M   37M  34% /boot

先把自带的难用的vim删掉 重新安装

删除 sudo apt-get remove vim-common
安装 sudo apt-get install vim

然后就是 linux 下 vim 的配置,不再多说。

@ccforward ccforward self-assigned this Sep 21, 2015

@gezhaoyou

This comment has been minimized.

Show comment
Hide comment
@gezhaoyou

gezhaoyou May 28, 2016

这个应该写到wiki中,为什么放到issue中了?

gezhaoyou commented May 28, 2016

这个应该写到wiki中,为什么放到issue中了?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment