如何在树莓派 2B 上安装 FreeBSD

在树莓派 2B 上如何安装 FreeBSD 10 或 FreeBSD 11(current)?怎么在 Linux,OS X,FreeBSD 或类 Unix 操作系统上烧录 SD 卡?

在树莓派 2B 上安装 FreeBSD 10 或 FreeBSD 11(current)很容易。使用 FreeBSD 操作系统可以打造一个非常易用的 Unix 服务器。FreeBSD-CURRENT 自2012年十一月以来一直支持树莓派,2015年三月份后也开始支持树莓派2了。在这个快速教程中我将介绍如何在树莓派 2B 上安装 FreeBSD 11 current arm 版。

 

1. 下载 FreeBSD-current 的 arm 镜像

你可以 访问这个页面来下载 树莓派2的镜像。使用 wget 或 curl 命令来下载镜像:

  1. <span class="pln">$ </span><span class="kwd">wget</span><span class="pln"> ftp</span><span class="pun">:</span><span class="com">//ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/11.0/FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20151016-r289420.img.xz</span>

  1. <span class="pln">$ curl </span><span class="pun">-</span><span class="pln">O ftp</span><span class="pun">:</span><span class="com">//ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/11.0/FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20151016-r289420.img.xz</span>

 

2. 解压 FreeBSD-current 镜像

执行以下命令中的任何一个:

  1. <span class="pln">$ unxz </span><span class="typ">FreeBSD</span><span class="pun">-</span><span class="lit">11.0</span><span class="pun">-</span><span class="pln">CURRENT</span><span class="pun">-</span><span class="pln">arm</span><span class="pun">-</span><span class="pln">armv6</span><span class="pun">-</span><span class="pln">RPI2</span><span class="pun">-</span><span class="lit">20151016</span><span class="pun">-</span><span class="pln">r289420</span><span class="pun">.</span><span class="pln">img</span><span class="pun">.</span><span class="pln">xz</span>

  1. <span class="pln">$ xz </span><span class="pun">--</span><span class="pln">decompress </span><span class="typ">FreeBSD</span><span class="pun">-</span><span class="lit">11.0</span><span class="pun">-</span><span class="pln">CURRENT</span><span class="pun">-</span><span class="pln">arm</span><span class="pun">-</span><span class="pln">armv6</span><span class="pun">-</span><span class="pln">RPI2</span><span class="pun">-</span><span class="lit">20151016</span><span class="pun">-</span><span class="pln">r289420</span><span class="pun">.</span><span class="pln">img</span><span class="pun">.</span><span class="pln">xz</span>

 

3. 设置 SD

你可以在 OS X,Linux,FreeBSD,MS-Windows 和类 Unix 系统来烧录 SD 卡。

 

在 Mac OS X 下烧录 FreeBSD-current

使用下面的 dd 命令:

  1. <span class="pln">$ diskutil </span><span class="kwd">list</span>
  2. <span class="pln">$ diskutil unmountDisk </span><span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">diskN</span>
  3. <span class="pln">$ </span><span class="kwd">sudo</span><span class="kwd">dd</span><span class="kwd">if</span><span class="pun">=</span><span class="typ">FreeBSD</span><span class="pun">-</span><span class="lit">11.0</span><span class="pun">-</span><span class="pln">CURRENT</span><span class="pun">-</span><span class="pln">arm</span><span class="pun">-</span><span class="pln">armv6</span><span class="pun">-</span><span class="pln">RPI2</span><span class="pun">-</span><span class="lit">20151016</span><span class="pun">-</span><span class="pln">r289420</span><span class="pun">.</span><span class="pln">img of</span><span class="pun">=</span><span class="str">/dev/</span><span class="pln">disk2 bs</span><span class="pun">=</span><span class="lit">64k</span>

示例输出:

  1. <span class="lit">1024</span><span class="pun">+</span><span class="lit">0</span><span class="pln"> records </span><span class="kwd">in</span>
  2. <span class="lit">1024</span><span class="pun">+</span><span class="lit">0</span><span class="pln"> records out</span>
  3. <span class="lit">1073741824</span><span class="pln"> bytes transferred </span><span class="kwd">in</span><span class="lit">661.669584</span><span class="pln"> secs </span><span class="pun">(</span><span class="lit">1622776</span><span class="pln"> bytes</span><span class="pun">/</span><span class="pln">sec</span><span class="pun">)</span>

 

使用 Linux/FreeBSD 或者类 Unix 系统来烧录 FreeBSD-current

语法是这样:

  1. <span class="pln">$ </span><span class="kwd">dd</span><span class="kwd">if</span><span class="pun">=</span><span class="typ">FreeBSD</span><span class="pun">-</span><span class="lit">11.0</span><span class="pun">-</span><span class="pln">CURRENT</span><span class="pun">-</span><span class="pln">arm</span><span class="pun">-</span><span class="pln">armv6</span><span class="pun">-</span><span class="pln">RPI2</span><span class="pun">-</span><span class="lit">20151016</span><span class="pun">-</span><span class="pln">r289420</span><span class="pun">.</span><span class="pln">img of</span><span class="pun">=</span><span class="str">/dev/</span><span class="pln">sdb bs</span><span class="pun">=</span><span class="lit">1M</span>

确保使用实际的 SD 卡的设备名称来替换 /dev/sdb(LCTT 译注:千万注意不要写错了)。

 

4. 引导 FreeBSD

在树莓派 2B 上插入 SD 卡。你需要连接键盘,鼠标和显示器。我使用的是 USB 转串口线来连接显示器的:

如何在树莓派 2B 上安装 FreeBSD

图01 基于树莓派 USB 的串行连接

在下面的例子中,我使用 screen 命令来连接我的 RPI:

  1. <span class="com">##</span><span class="typ">Linux</span><span class="pun">上</span><span class="com">##</span>
  2. <span class="kwd">screen</span><span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="kwd">tty</span><span class="pun">.</span><span class="pln">USB0 </span><span class="lit">115200</span>
  3. <span class="com">##</span><span class="pln"> OS X </span><span class="pun">上</span><span class="com">##</span>
  4. <span class="kwd">screen</span><span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">cu</span><span class="pun">.</span><span class="pln">usbserial </span><span class="lit">115200</span>
  5. <span class="com">##</span><span class="typ">Windows</span><span class="pun">请使用</span><span class="typ">Putty</span><span class="pun">.</span><span class="pln">exe </span><span class="com">##</span>

FreeBSD RPI 启动输出样例:

如何在树莓派 2B 上安装 FreeBSD

图02: 在树莓派 2上引导 FreeBSD-current

 

5. FreeBSD 在 RPi 2上的用户名和密码

默认的密码是 freebsd/freebsd 和 root/root。

到此为止, FreeBSD-current 已经安装并运行在树莓派 2上。


via: http://www.cyberciti.biz/faq/how-to-install-freebsd-on-raspberry-pi-2-model-b/

作者:Vivek Gite 译者:strugglingyouth 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出

相关推荐