
1.6 【案例实战】Linux系统环境搭建
为了帮助读者快速掌握和使用Linux系统,本节分别安排了两种基于Linux系统的环境搭建,一种是基于PC+VMware+Ubuntu的环境搭建;另一种是基于开源硬件树莓派移植Linux系统的环境搭建。下面先开始第一种方案的环境搭建。
1.6.1 虚拟机安装Ubuntu操作系统
为了方便读者能够快速搭建一套Linux系统,在这一小节专门设置了虚拟机安装Ubuntu操作系统的详细案例,读者可以通过下面的操作步骤,快速搭建自己的Linux系统环境。
Step 1 解压VMware安装包并以管理员权限运行exe文件,如图1-6所示。

图1-6 虚拟机开始安装的启动页面
Step 2 在打开的安装导航对话框中选择软件的安装位置,然后单击“下一步”按钮,如图1-7所示。
Step 3 在打开的界面中取消勾选相关复选框,单击“下一步”按钮,如图1-8所示。

图1-7 选择安装位置

图1-8 用户体验设置
Step 4 单击“安装”按钮,开始安装,如图1-9所示。
Step 5 安装完成后先单击“许可证”按钮,如图1-10所示。

图1-9 开始安装

图1-10 准备激活
Step 6 激活后即可完成VMware的安装,如图1-11所示。

图1-11 虚拟机安装完成
Step 7 在虚拟机中新建虚拟机,开始Ubuntu操作系统的安装,如图1-12所示。
Step 8 载入提前下载好的Ubuntu操作系统,如图1-13所示。

图1-12 新建虚拟机

图1-13 载入Ubuntu系统
Step 9 接着选择客户机操作系统,如图1-14所示。
Step 10 在打开的界面检查虚拟机的硬件资源配置,单击“完成”按钮,如图1-15所示。

图1-14 选择安装Linux系统

图1-15 检查虚拟机的硬件资源配置
Step 11 运行配置好Ubuntu系统的虚拟机,如图1-16所示。
Step 12 开始安装虚拟机里的Ubuntu系统,如图1-17所示。
Step 13 直接单击“继续”按钮,在打开的界面选择安装位置,然后继续单击“继续”按钮,如图1-18所示。
Step 14 选择键盘布局习惯,如图1-19所示。
Step 15 创建Ubuntu系统登录账号,如图1-20所示。

图1-16 运行配置好的虚拟机

图1-17 安装Ubuntu系统

图1-18 继续安装

图1-19 选择键盘布局

图1-20 创建账号
Step 16 Ubuntu在虚拟机中的安装过程大概需要十几分钟,如图1-21所示。
Step 17 创建Ubuntu系统登录账号,如图1-22示。

图1-21 安装等待

图1-22 登录账号
Step 18 安装完成的Ubuntu桌面系统如图1-23所示。

图1-23 Ubuntu桌面系统
1.6.2 树莓派安装Ubuntu操作系统
树莓派是最受创客爱好者欢迎的微型计算机之一,其外观只有信用卡大小,却具备了通用计算机的所有功能,它起初是专门为教学编程所设计的一款计算机。树莓派结构精简、便携、资源丰富,这也是我们选择它来快速搭建Linux系统的原因。
我们选择的是2014年产的树莓派2B,如图1-24所示。在树莓派上搭建Linux系统环境,是非常快速的,因为这个搭建环境非常简单,适合初学者学习和使用Linux系统,在进行树莓派移植Linux系统之前,需要先准备好镜像文件和相关工具,具体操作如下。

图1-24 树莓派2B
Step 1 首先准备一张16GB的SD卡,卡等级是Class10,使用工具对其格式化,如图1-25所示。

图1-25 格式化SD卡
Step 2 在官方镜像文件下载地址为https://www.raspberrypi.org/downloads/raspberry-pi-os/中下载第一个树莓派镜像文件,如图1-26所示。
Step 3 使用工具将镜像文件烧录到格式化好的SD卡上,如图1-27所示。

图1-26 树莓派官方镜像文件

图1-27 烧录镜像文件
Step 4 使用远程登录客户端工具远程连接树莓派系统,如图1-28所示。
Step 5 接着输入账户和密码,如图1-29所示。

图1-28 远程连接树莓派系统

图1-29 输入账号和密码
Step 6 成功登录到树莓派系统中,Linux系统环境搭建完成,如图1-30所示。

图1-30 系统登录成功
小白成长之路:莓派2B的技术参数
树莓派2B的技术参数具体如下。
1)处理器:900MHz四核ARM Cortex-A7 CPU。
2)内存:1GB内存。
3)外设:100 Base以太网、4个USB端口、40个GPIO引脚、完整的HDMI端口、结合3.5mm音频插孔和复合视频、摄像头接口(CSI)、显示界面(DSI)、Micro SD卡插槽和VideoCore IV 3D图形核心。