`

Hadoop 从零开始(1) ——CentOS 安装配置

 
阅读更多

 

 

 

Hadoop 从零开始(1

——CentOS 安装配置

 

 

<!--[if !supportLists]-->1、     <!--[endif]-->准备安装

1.1-2.2节大多来自鸟哥的Linxu私房菜与Linux公社,在VMware Workstation中安装Linxu虚拟机请直接跳至2.3节,但我还是希望您能接着看下去,细节往往决定之后的很多问题,当然在虚拟机中很多设置我们不会遇到,但这却是我们需要了解的)

 

1.1  系统简介

 

CentOS  什么?

 

 

CentOS 是一个基Red Hat 企业 Linux 供的可自由使用企业Linux  版本版本 CentOS  都会获得七年(通过安全更新方式版本 的 CentOS 两年一次,而每个版本的 CentOS 会定(大概每六个月)更新一次, 以便支持新的硬件这样建立一个安全低维护稳定高预测性高重复性的 Linux 环 境。

CentOSCommunity  Enterprise  Operating  System)是 Linux 发行版之一,它是来Red Hat Enterprise Linux 照开放源代码规定释出的源代码所编译而成。由于出自同样的源 代码,因此有些要求高度稳定性服务器以 CentOS 替代商业版的 Red Hat Enterprise Linux 使用。不同CentOS 不包含闭源代

CentOS 个开源软件贡献者和用户的社区。它对 RHEL 源代码进行重新编译,成为 众多发布新发行版本的社区当中的一个,并且在不断的发展过程中,CentOS 社区不断与其 他的同类社区合并使 CentOS Linux 逐渐成为使用最广泛的 RHEL 兼容版本CentOS Linux 的稳定性不比 RHEL 唯一不的就是技术支持因为它是由社区发布的免费版。 CentOS Linux RHEL 产品有着严格版本应关系如使用 RHEL4 源代码新 编译发布的是 CentOS  Linu4.0RHEL5 对应的是 CentOS Linux  5.0RHEL6 对应的是

CentOS Linux 6由于 RHEL 产品的生命周期较(通常具有 3~5 年的官方因此 Red

Hat 公司在 RHEL 系列产品发布后每隔一段时间都会将累积的更新程序重新打包成为更新 的发行版进行发布,通常称为 RHEL Update

例如,RHEL5 的第 1 新版本叫做 RHEL 5 Update 1,用通常也称为 RHEL 5.1。 对 Red Hat 司发布的每一个 RHEL Update CentOS 社区都会发布对应的更新发行版,例如 根据 RHEL 5 Update 1 更新程序源码包CentOS 会重新编译并打包发布 CentOS Linux 5.1 版。CentOS  Linux 和与对应版本号的 RHEL 行版具有软件包级别的二进制兼容性,即 某个 RPM 件包如果可以安装运行在 RHEL 品中就可以正常地安装运行在对应版本的 CentOS Linux 中。CentOS Linux 同时具有与 RHEL 的兼容性和企业级应用的稳定性, 又允许用户自由使用,因此得到了越来越广泛的应用。

 

CentOS 特点

 

 

   可以把 CentOS 理解为 Red Hat AS 系列!它完全就是对 Red Hat AS 进行改进后发 布的!各种操作、使用和 RED HAT 没有区别!

   CentOS 免费,不存在 RED HAT AS4 需要序列号的问题。

CentOS 独有yum 支持在线升级,可以即时更新系统,不像 RED HAT 那样

需要花钱购买支持服务!

    CentOS 了许多 RED HAT AS BUG

    CentOS 说明:  CentOS3.1   RED HAT AS3 Update1 CentOS3.4  等同于

RED HAT AS3 Update4 CentOS4.0   RED HAT AS4

 

1.2  安装版本

 

本次安装们选择 CetOS6.0 版本下面从几个方面介绍一下这个版本。

 

 

    集成基于内核的虚CentOS 6.0 集成了基于内核的虚拟化KVM 管理程序 完全集成到内核中。这样的功能可以帮助 CentOS  6.0 在主机之间轻松迁移虚 拟机,更加灵活地部署和管理 IT 源,有效为企业节省资源。利用内核的硬件抽 象使应用程序能够独立于底层硬件并且提高  CPU 和内存可扩展性使每个服务 器可容纳更多虚拟机。

   提升系统和资源管理功能。基于标准的  Linux  可管理性规范(SBLIM)使用基于 Web 的企业管理(WBEM)来管理系统。用 Dracut 取代 mkinitrd,最限度地减 少底层硬件改变的影响,更易于维护,并使支持第三方驱动程序更容易。

   加强电源管,按时的内核改进使 CentOS 6.0 可以将没有活动任务的处理器置为 空闲状态,以达到降低 CPU 的温度和更进一步减少能耗。

   在一种叫做控制cgroups框架的帮助下 CentOS 6.0 对硬资源的 细颗粒度控制、分配和管理cgroups 运行在进程组水平上,可被用于为应用理 从 CPU、内存、网络和硬盘 I/O 的资源。

   增强了系统的可靠用性和适用CentOS 6.0 利用新件能力提供热插拔特 性并且可以通过 AER PCIe 设备的增强错误检查CentOS 6.0 包括高数据完 整性特性(DIF/DIX类特性通硬件检查检验来自用的数据自动缺陷 报告工ABRT)的进提供了确定和报告系异常情况,包括内核故障和用 户空间应用崩溃等。

   改进了可伸缩性和内核性能CentOS 6.0 提供适应未来系统的可伸缩性其可伸 缩性能力从对大量 CPU 和内存配置的优化的支持到处理更多数量的系统互联总线

和外设的能力在虚拟化变得同裸机部署一样无处不在之时这些能力适合于裸机 环境和虚拟化环境。

    CentOS  6.0 改进了内核性能,可通过让更高优先级的进程在最低限度的较低优 先级处理扰的条件,更公平在处理器间分配计时间。同CentOS 6.0 将多种多处理器锁同步进行改进以消除不必要的锁定事件用睡眠锁定代替许多 旋转(spin锁定和采用更高效的锁定基元。

    稳定的应用程序开发与生产平台CentOS 6.0 个高性能高度可扩展布式、 基于内存的对象缓存系统大大提高了动态 Web 应用程序速度Web 基础架 构上主要改进了 ApacheSquid Memcached 三个方面的改进Java 性能支持 上CentOS 6.0 OpenJDK 的紧密集成包括在 SystemTap 中支持 Java 从 而可支持更好的 Java 试。同时,CentOS 6.0 在逐步完善 Tomcat 6 持。

 

官方网站与

 

官方主页:  http://www.centos.org/


 

 

官方Wiki  http://wiki.centos.org/

官方中文文档  http://wiki.centos.org/zh/Documentation

安装说明:  http://www.centos.org/docs/

 

 

1.3  硬件信息

 

 

Linux 发行版装程序件识别能力都比较强即使不查询什么硬件信息, 安装统也么大不过常新硬件和笔脑这殊的设 备还是建议在网络上查询一下相关硬件的信息以确保硬件可以被驱动这里列举几种可 能需要考察的硬,对于任何一种发行版都需要注意如下这些问题。

 

 

   主板芯片组支持。这一组比较重要的硬件信息,可能影响到硬盘是否可以使用、 可以启用 UDMA是否可以使用 ACPI APM 电源管理等这里的支持程序总是 和内核版本相关的,考察的时候要注意对应的内核版本。

   网络设备支目前于一般用户主要是以太网卡和无线网卡有些线网卡的 驱动还没有被整合进内核,但确实已经有驱动支持了。

   声卡Linux 对声音芯片的支持在历史上饱受诟病但自从 ALSAAdvanced Linux Sound Architecture诞生这个问题已经得到了很大程序的缓解现在ALSA 2.6 内核一部分不过仍然有一些声卡问题不时地出现特别的目前多 数的用户使用的是主板板载声卡在安装系统之前应该考察一下 Linux 内核对该主 板芯片声效功能的支持。

   显卡。主的显卡目前都可以得到支持,如果需要的话,看一下显卡芯片的厂商、 型号、显存大小基本就可以了,如果希望省事的话,可以考虑选择性能虽然不强, 但开源驱动的稳定性和性能最好的 Intel 整合卡,而追求高性能显卡的用户可以 考虑 NVIDIA 芯片并在日后使用官方的驱动程序来获得好的 3D ATI/ADM 显卡目前的 Linux 驱动不理想的AMD 已经开放了芯片的技术规范未来一 定会得到开源驱动的良好支持。

   其他外设USB  键盘和鼠标一以被少数的硬移动盘 可能不会被支持摄像头这些小硬件大部分都可以被支持了另外就是一些笔记本 电脑,需要考察一下。

 

为了有备无患要考察的信息还是比较多的除了上网查找和询问周围的朋友外使用

Live CD 体验也是一个很不错的办法。

 

1.4  硬盘分区

 

 

在计算机上安装 Linux 系统对硬盘进行分区是一个非常重要的步骤下面介绍几个分 区方案。

 

   1

/boot:用存放与 Linux 系统启动有关的程序,比如启动引导装载程序等,建议大小 为 100MB

/Linux 统的根目录,所有的目录都挂在这个目录下面,建议大小为 5GB


 

 

/home:存普通用户的数据,是普通用户的宿主目录,建议大小为剩下的空间。

swap:实现虚拟内存,建议大小是物理内存的 1~2 倍。

 

   2

/boot:用存放与 Linux 系统有关的程,比如启动引导装载程序等,建议大小 为 100MB

/usr:用来存放 Linux 统中的程序,其关数据较多,建议大于 3GB 以上。

/var:用来Linux 统中经常变化的数据以及日志文件,建议大于 1GB 以上。

/home:存普通用户的数据,是普通用户的宿主目录,建议大小为剩下的空间。

/Linux 统的根目录,所有的目录都挂在这个目录下面,建议大小为 5GB

/tmp将临时盘在独立的分区可避免在文件系统被塞满时影响到系统的稳定性建议 大小为 500MB 以上。

swap:实现虚拟内存,建议大小是物理内存的 1~2 倍。

 

2、光盘安装

 

2.1  安装引导

 

 

首先要设置计算机的 BIOS 启动顺序为光驱启动保存设置后将安装光盘放入光驱重 新启动计算机。

计算机启动以后会出现如下图所示的界面。

 

 

<!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter" /> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0" /> <v:f eqn="sum @0 1 0" /> <v:f eqn="sum 0 0 @1" /> <v:f eqn="prod @2 1 2" /> <v:f eqn="prod @3 21600 pixelWidth" /> <v:f eqn="prod @3 21600 pixelHeight" /> <v:f eqn="sum @0 0 1" /> <v:f eqn="prod @6 1 2" /> <v:f eqn="prod @7 21600 pixelWidth" /> <v:f eqn="sum @8 21600 0" /> <v:f eqn="prod @7 21600 pixelHeight" /> <v:f eqn="sum @10 21600 0" /> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" /> <o:lock v:ext="edit" aspectratio="t" /> </v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style="width:369.75pt; height:277.5pt;mso-position-horizontal-relative:char; mso-position-vertical-relative:line" mce_style="width:369.75pt; height:277.5pt;mso-position-horizontal-relative:char; mso-position-vertical-relative:line"> <v:imagedata src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" mce_src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" o:title="" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

 

 

你可以直接按下<Enter>来进入界面方式或者等待 60

下面是所示引导选项如下:


 

 

    Install or upgrade an existing system安装或升级现有系统

这个选项是默认的。 择此选项,安装到您的计算机使用 CentOS 的图形安装程序的 系统。

   Install system with basic video driver(安装系统,基本的视频驱动程序: 此选项允许您安装 CentOS 的模式即使在图形安装程序无法加载视频卡的正确驱动程

序为您的如果你的屏幕上出现扭曲或一片空白时使用的安装或升级现有系统的选项重新 启动计算机,并尝试此选项。

   Rescue installed system救援安装的系统

选择这个选项来修复您的安装 CentOS 系统,止正常启动你一个问题。虽然 CentOS 是一个非稳定的计平台,它偶然的问仍有可能生,防止动。 救援境包含实 用程序,允许您解决这些问题,品种繁多。

   Boot from local drive本地驱动器启动: 此选项将导从第一安装的磁系统。  你意外地动这个光,使用未立即

动安装程序这是从硬盘启动选项。

 

2.2  检测光盘介质

 

 

如下图所示如果是一张完整的安装盘可以直接单Skip按钮跳过否则单OK按钮检测安装盘的完整性。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" style='width:373.5pt;height:207pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png" mce_src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png" o:title="" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

 

 

备注你确定你所下载的 DVD 或光盘没有问题的话那么这里可以选Skip

不过你也可以按OK来进行 DVD 的分析因为通过 DVD 的分析后后续的安装比 较不会出现奇怪的问题。 不过如你按OK程式会开始分析光盘内的所有文件的 资讯,会花非常多间喔!

 

 

 

 

2.3  安装欢迎界面

 

当检测完电脑硬件信息后,会进入欢迎界面。

当您在VMware中安装虚拟机时,会直接进此界面(当然之前会显示一些硬件配置确定的信息等等),这里专注于Linux本身与Hadoop相关的知识,如果您对VMware与虚拟机不甚了解,请参考以下链接:http://wenku.baidu.com/view/3e4e9c2ded630b1c59eeb5a3.html

2.4  选择安装过程中的语言

 

 

<!--[if gte vml 1]><v:rect id="_x0000_s1067" style="position:absolute;left:0;text-align:left;margin-left:-2.25pt; margin-top:45.45pt;width:438.9pt;height:21.3pt;z-index:251666944" mce_style="position:absolute;left:0;text-align:left;margin-left:-2.25pt; margin-top:45.45pt;width:438.9pt;height:21.3pt;z-index:251666944" filled="f" fillcolor="#cce8cf" strokecolor="black [3200]" strokeweight="2.5pt"> <v:shadow color="#868686" /> </v:rect><![endif]--><!--[if !vml]--><!--[endif]-->单击Next按钮进如下图所的界面,择安装过中使用的言,此Chinese  Simplified中文(简体。有的DVD安装会发现没有中文可选,可先进行英文安装,完成后进入Bash终端输入一下命令重启后以中文汉语登录即可:

LANG=zh_CN.utf-8

 

 

<!--[if gte vml 1]><v:shape id="图片_x0020_4" o:spid="_x0000_i1055" type="#_x0000_t75" style="width:372.75pt;height:279.75pt;visibility:visible; mso-wrap-style:square" mce_style="width:372.75pt;height:279.75pt;visibility:visible; mso-wrap-style:square"> <v:imagedata src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image006.jpg" mce_src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image006.jpg" o:title="" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

2.5  选择键盘布局类型

 

 

选择完安装过程中的语言后下一步按钮进入如下图所示的界面选择键盘类 型一般默认会选择美国英语式(U.S.English,即美式键盘,在此使用默认的选择。

<!--[if gte vml 1]><v:shape id="_x0000_i1027" type="#_x0000_t75" style='width:372.75pt;height:279.75pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image008.jpg" mce_src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image008.jpg" o:title="" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

 

2.6  选择设备

 

 

选择一种储设备进安装存储设备作为安装间的默认择,适合哪些不 知道应该选择哪个存储设备的用户。而指定的存储设备则需要用户将系统安装指定到特 定的存储设备上可以是本地某个设备当然也可以是 SAN(存储局用户一旦选择 了这个选项,可以添加 FCoE/iSCSI/zFCP 磁盘,并且能够过滤掉安装程序应该忽略的设备。 这里选择基本存储设,单击下一步按钮。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1028" type="#_x0000_t75" style='width:378.75pt;height:129pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image010.jpg" mce_src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image010.jpg" o:title="" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

 

备注存储设备用于台式机和笔记本等等;指定储设备于服务器等等。

 

2.7  初始化硬盘

 

 

如果硬盘上没有找到区表安装程序会要求初始化硬盘操作使硬盘上的任何现有 数据无法读取如果您的系统具有全新的硬盘没有操作系统安装或删除硬盘上的所有分区, 则单击  新初始化

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1029" type="#_x0000_t75" style='width:379.5pt;height:283.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

备注安装程序将为您提供一个单独的对话框为每个磁盘它无法读取一个有效的分

区表忽略所有按钮,或重新初始化所有按钮可将应用到所有设备相同的答 案。

 

2.8  设置主机名与网络

 

 

           主机名设置

           这里,主机名,建议设置为可明确知晓机器性质的名称,一般地,我们使用Master指代HadoopNameNode,使用Slaver指代Hadoop的数据节点等等。

设置固 IP

『配置网络线eth0『编辑弹出编辑窗口上选IPv4 设置, 打开方法边上的下拉菜单,选择手动单击  “按钮,依次输入本机 IP子网掩网关DNS 服务器输入 DNS 最后按钮即 可。

 

<!--[if gte vml 1]><v:shape id="_x0000_i1030" type="#_x0000_t75" style='width:251.25pt;height:206.25pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->


 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1031" type="#_x0000_t75" style='width:195.75pt;height:313.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

<!--[if gte vml 1]><v:shape id="_x0000_s1026" type="#_x0000_t75" style="position:absolute;left:0;text-align:left;margin-left:299.8pt; margin-top:-336.4pt;width:196.55pt;height:312.45pt;z-index:-251666944; mso-position-horizontal-relative:page" mce_style="position:absolute;left:0;text-align:left;margin-left:299.8pt; margin-top:-336.4pt;width:196.55pt;height:312.45pt;z-index:-251666944; mso-position-horizontal-relative:page"> <v:imagedata src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image012.png" mce_src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image012.png" o:title="" /> <w:wrap anchorx="page" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->2.9  时区选择

 

 

因为全世界分为 24 个时区,所以,要告知系统时区在哪里。如下图所示,你可以选择

北京,或接用鼠标地图上选。要特别  UTC,它与夏令有关,不需要 选择这个选项,否则会造成时区混乱,导致系统显示的时间与本地时间不同。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1032" type="#_x0000_t75" style='width:382.5pt;height:237.75pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->


 

 

2.10  设置管理员密码

 

 

下面是最重要系统管理员的口令设置如下图所示 Linux 系统管理员的 默认名称为 root请注这个口令重要至少 6 个字符,可以含有特殊符号并要记好。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1033" type="#_x0000_t75" style='width:313.5pt;height:117pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

备注当你设置好进入下一步时由于你的密码可能设置的过于简单此时会弹出一个 对话框,如果你要坚持你设置的密码,可以选择无论何都是

 

2.1磁盘分区配置

 

为方便大家分区硬盘,CentOS 预设了我们分区模式,分别为:

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1034" type="#_x0000_t75" style='width:378.75pt;height:283.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

备注:我实际是直选的是使用所有,当时就是图方便实际工作中却要

按照实际的要求对硬盘进行分区合理利用硬盘而这里选创建自定义按照 1.4

小节给出的服务器分区方案对硬盘重新分区。


 

 

下面是对每个选项的详细介绍:

 

 

    使用所有空Use All Space : 选择此选项,删除您硬盘上的所有分区(这包括如 Windows NTFS VFAT 或其

他操作系统创建的分区

   替换现有的 Linux 系统Replace Existing Linux System: 选择此选项,以消除先前的 Linux 安装创建的分区。  会删除其他分区(如 VFAT

FAT32 ,你可对您的硬盘驱动器。

   缩小现有系Shrink Current System选择此选,调整当的数据和区安装在动释放的间是一个认的红帽

Linux 布局。

   使用剩余空Use Free Space选择此选项以保留您当前的数据和分区并安装在未使用的存储驱动器上的空

Scientific 确保有足够的存储驱动器上的可用空间,然后再选择此选项。

   创建自定义布局Create Custom Layout: 选择此选项,手动存储设备进行分区并创建自定义布局。

下面是创建自定义布的步骤: 第一步创建自定义布局下一步按钮;如下图所示。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1035" type="#_x0000_t75" style='width:378.75pt;height:283.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

第二步/boot

选择要分区的空闲空间创建就会出现如下的画面准分区, 点击生成


 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1036" type="#_x0000_t75" style='width:142.5pt;height:249.75pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

挂载点:选择/boot文件系统类使用默认Ext4  志文件系统大小输入

分配的大小 100,以 MB 为单位;其它大小选项:选择固定大小确定钮。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1037" type="#_x0000_t75" style='width:335.25pt;height:290.25pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

第三步/继续选择空闲空间创建就会出现如下的画面标准分区

生成

挂载点/系统类型使用默Ext4  日志文系统输入分配 的大小 5000,以  MB  单位;大小选项选择大小;点确定


 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1038" type="#_x0000_t75" style='width:339pt;height:294pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

第四步建交换空间

继续选择空闲空间,点创建就会出现如下的画面标准分区点击生成

文件系统类:选择swap:输入分配的大小 1000,以  MB  单位;它大 小选项固定点“”按钮。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1039" type="#_x0000_t75" style='width:331.5pt;height:4in; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->


 

 

备注空间用于实现虚拟内存,建议大小是物理内存的 1~2 倍。

第五步/usr继续选择空闲空间创建就会出现如下的画面标准分区

生成

挂载点/usr文件系统类使用Ext4  志文件系统大小分 配的大小 3000,以  MB 为单位;其它大小选项:选择固定大小确定钮。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1040" type="#_x0000_t75" style='width:331.5pt;height:4in; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

第六步/var继续选择空闲空间创建就会出现如下的画面标准分区

生成

挂载点:选择/var文件系统类型:使用Ext4  日志文件系统大小入 分配的大小 1000,以  M为单位;它大小选项:选择固定大小确定钮。

备注:图第五步基本相同,故略。 第七步/tmp继续选择空闲空间创建就会出现如下的画面标准分区

生成

挂载点:选/tmp文件:使用Ext4  志文件系统大小输入 分配的大小 500,以 MB 为单位;其它大小选项:选择固定大小确定钮。

备注:图第五步基本相同,故略。 第八步/home分区 继续选择空闲空间,点创建就会出现如下的画面标准分区点击

生成

挂载点/home文件系统类使用默Ext4  志文件系统其它大小选 :选择使用全部用空间确定钮。


 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1041" type="#_x0000_t75" style='width:342.75pt;height:296.25pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

至此分区已全部创建完毕如果不满意还可以点重设按钮进行更改如果确

定,就点下一步按钮后,弹出是否格式化以下已存在的硬盘选择格式化

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1042" type="#_x0000_t75" style='width:367.5pt;height:274.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

安装程序提示您确您所选的区选项。将修写入磁盘以允许安装程序 在您的硬盘进行分区,并安装系统更改。


 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1043" type="#_x0000_t75" style='width:372pt;height:279pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

2.12 引导装载程序设置

 

<!--[if gte vml 1]><v:shape id="_x0000_s1027" type="#_x0000_t75" style='position:absolute;left:0; text-align:left;margin-left:111.05pt;margin-top:35.75pt;width:373.2pt; height:279.5pt;z-index:-251665920;mso-position-horizontal-relative:page'> <v:imagedata src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image014.jpg" mce_src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image014.jpg" o:title="" /> <w:wrap anchorx="page" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->如下图所示为 GRUB 引导安装窗口,可采用默认设置接单击下一步按钮。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

备注:设置引导装载序密码的法是,选使用引装载程序,在弹的窗 口中输入密码。我们实际并没设置此项


 

 

2.13 选择安装的软件包

 

 

可选的服务器类型更多而且默认安装是一个非常小的甚至不完整的系统现在 自定义后单击下一步按钮,如下图所示。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1044" type="#_x0000_t75" style='width:367.5pt;height:274.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

可选的类型说明如下:

    Desktop本的桌面系统,包括常用的桌面软件,如文档查看工具。

    Minimal Desktop:基本的桌面系统,包含的软件更少。

    Minimal本的系统,不含有任何可选的软件包。

    Basic Server:安装的基本系统的平台支持,不包含桌面。

    Database Server:基本统平台,加上 MySQL PostgreSQL 数据库,无桌面。

    Web Server:基本系统平台,加上 PHPWeb server,还有 MySQL PostgreSQL

数据库的客户端,无桌面。

   Virtual Host:基本系统加虚拟平台。

   Software Development Workstation包含软件包较多,基本系统,虚拟化平台, 桌面环境,开发工具。

 

 

备注这里安装 Linux 是作为务器使用没有必要安装图形界面故选择的是最 小化安装(Minimal如果想安装图形界面,可以选择桌面安装(Desktop

 

 

因为上一步我们选择的是最小化安Minimal所以在以下软件包设置画面中所有 的软件包默认都是没有被选中的状态。这里我们只选择我们需要的软件包来安装。

 

首先,选基本系」中的「基本


 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1045" type="#_x0000_t75" style='width:372.75pt;height:279pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

然后,选开发的「开发

 

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1046" type="#_x0000_t75" style='width:378.75pt;height:283.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

最后,在「语言支持中选中「中文支持果您有支持其他语言的需要,也可以在

这里一并选择。最后点击下一步,开始安装。


 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1047" type="#_x0000_t75" style='width:378.75pt;height:283.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

2.14 开始安装Linux系统

 

 

<!--[if gte vml 1]><v:shape id="_x0000_s1028" type="#_x0000_t75" style="position:absolute;left:0;text-align:left; margin-left:111.35pt;margin-top:48.65pt;width:372.6pt;height:279pt;z-index:-251664896; mso-position-horizontal-relative:page" mce_style="position:absolute;left:0;text-align:left; margin-left:111.35pt;margin-top:48.65pt;width:372.6pt;height:279pt;z-index:-251664896; mso-position-horizontal-relative:page"> <v:imagedata src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image016.jpg" mce_src="file:///C:\Users\CT\AppData\Local\Temp\msohtmlclip1\01\clip_image016.jpg" o:title="" /> <w:wrap anchorx="page" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->开始安装在安装的画面中会显示还需要多少时间每个软件包的名称以及该件 包的简单说明,如下图所示。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

等到安装完之后一切就都完成了出现最后这个画面时请将光盘拿出来并按


 

 

新引导按钮去启动,如下图所示。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1048" type="#_x0000_t75" style='width:367.5pt;height:274.5pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

3、环境设置

 

 

CentOS 6 刚刚安装好之后,的安全设置以及服务等等可能并不符们的 需求所以在搭建各种系统服务之前我们先将系统环境设置为最为简洁的状态在以后开 通各种服务的时候,在按照服务的需求来进行具体的定制。

 

3.1  建立一般用户

 

 

root 用户控制系统权限(不尽然)如果一般的操作中我们用 root 来进行很 容易不小心对系统造成误删误更改等操作所以我们首先建立一般用户用一般用户来应 付日常的系统操作。

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1049" type="#_x0000_t75" style='width:404.25pt;height:152.25pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->


 

 

在一般用户建立成功以后我们就可以用一般用户来登录系统进行日常的系统管理

一些 root  权限的况,以通方式用户状态

root  用户进行需要  root  权限的操

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1050" type="#_x0000_t75" style='width:415.5pt;height:123.75pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

如以上示范我们可以在一般用户登录的状态下通su -命令来直接登录为  root 用 户。

 

3.2  关闭防火墙及SELinux

 

 

           防火墙问题在Linux下历来是我们所要关注的重点。由于现阶段我们的系统主要用于开发测试等等公用,所以务必将防火墙关闭而保证我们所进行的一系列操作可以很好的进行,相应的我们也暂时不需要SELinux这种强制性的访问控制,它也将严重影响我们对于系统的所谓“越界”操作,这里的设置都是为了之后的Hadoop以及其他服务器的配置可以准确完成。

关闭防火墙

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1051" type="#_x0000_t75" style='width:415.5pt;height:108pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

SELinux

 

<!--[if gte vml 1]><v:group id="_x0000_s1029" style='position:absolute;left:0;text-align:left; margin-left:82.25pt;margin-top:35pt;width:430.85pt;height:20.75pt;z-index:-251663872; mso-position-horizontal-relative:page' coordorigin="1645,700" coordsize="8617,415"> <v:group id="_x0000_s1030" style="position:absolute;left:1661;top:716;width:8585; height:2" mce_style="position:absolute;left:1661;top:716;width:8585; height:2" coordorigin="1661,716" coordsize="8585,2"> <v:shape id="_x0000_s1031" style="position:absolute;left:1661;top:716; width:8585;height:2" mce_style="position:absolute;left:1661;top:716; width:8585;height:2" coordorigin="1661,716" coordsize="8585,0" path="m1661,716r8585,e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1032" style="position:absolute; left:1661;top:1099;width:8585;height:2" mce_style="position:absolute; left:1661;top:1099;width:8585;height:2" coordorigin="1661,1099" coordsize="8585,2"> <v:shape id="_x0000_s1033" style="position:absolute;left:1661;top:1099; width:8585;height:2" mce_style="position:absolute;left:1661;top:1099; width:8585;height:2" coordorigin="1661,1099" coordsize="8585,0" path="m1661,1099r8585,e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1034" style="position:absolute; left:1676;top:731;width:2;height:353" mce_style="position:absolute; left:1676;top:731;width:2;height:353" coordorigin="1676,731" coordsize="2,353"> <v:shape id="_x0000_s1035" style="position:absolute;left:1676;top:731; width:2;height:353" mce_style="position:absolute;left:1676;top:731; width:2;height:353" coordorigin="1676,731" coordsize="0,353" path="m1676,731r,353e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1036" style="position:absolute; left:10231;top:731;width:2;height:353" mce_style="position:absolute; left:10231;top:731;width:2;height:353" coordorigin="10231,731" coordsize="2,353"> <v:shape id="_x0000_s1037" style="position:absolute;left:10231;top:731; width:2;height:353" mce_style="position:absolute;left:10231;top:731; width:2;height:353" coordorigin="10231,731" coordsize="0,353" path="m10231,731r,353e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><w:wrap anchorx="page" /> </v:group><![endif]--><!--[if !vml]--><!--[endif]-->用下面命令执行,并修改内容如下所示:

 

 

                         vim   /etc/sysconfig/selinux

 

 

<!--[if gte vml 1]><v:group id="_x0000_s1038" style='position:absolute;left:0;text-align:left; margin-left:82.25pt;margin-top:2.05pt;width:430.85pt;height:51.9pt;z-index:-251662848; mso-position-horizontal-relative:page' coordorigin="1645,638" coordsize="8617,1038"> <v:group id="_x0000_s1039" style="position:absolute;left:1661;top:654;width:8585; height:2" mce_style="position:absolute;left:1661;top:654;width:8585; height:2" coordorigin="1661,654" coordsize="8585,2"> <v:shape id="_x0000_s1040" style="position:absolute;left:1661;top:654; width:8585;height:2" mce_style="position:absolute;left:1661;top:654; width:8585;height:2" coordorigin="1661,654" coordsize="8585,0" path="m1661,654r8585,e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1041" style="position:absolute; left:1676;top:669;width:2;height:976" mce_style="position:absolute; left:1676;top:669;width:2;height:976" coordorigin="1676,669" coordsize="2,976"> <v:shape id="_x0000_s1042" style="position:absolute;left:1676;top:669; width:2;height:976" mce_style="position:absolute;left:1676;top:669; width:2;height:976" coordorigin="1676,669" coordsize="0,976" path="m1676,669r,975e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1043" style="position:absolute; left:10231;top:669;width:2;height:976" mce_style="position:absolute; left:10231;top:669;width:2;height:976" coordorigin="10231,669" coordsize="2,976"> <v:shape id="_x0000_s1044" style="position:absolute;left:10231;top:669; width:2;height:976" mce_style="position:absolute;left:10231;top:669; width:2;height:976" coordorigin="10231,669" coordsize="0,976" path="m10231,669r,975e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1045" style="position:absolute; left:1661;top:1659;width:8585;height:2" mce_style="position:absolute; left:1661;top:1659;width:8585;height:2" coordorigin="1661,1659" coordsize="8585,2"> <v:shape id="_x0000_s1046" style="position:absolute;left:1661;top:1659; width:8585;height:2" mce_style="position:absolute;left:1661;top:1659; width:8585;height:2" coordorigin="1661,1659" coordsize="8585,0" path="m1661,1659r8585,e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><w:wrap anchorx="page" /> </v:group><![endif]--><!--[if !vml]--><!--[endif]-->                    SELINUX=enforcing

                         ↓

                    SELINUX=disabled


 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1052" type="#_x0000_t75" style='width:415.5pt;height:96.75pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

<!--[if gte vml 1]><v:group id="_x0000_s1047" style="position:absolute; left:0;text-align:left;margin-left:82.25pt;margin-top:31.65pt;width:430.85pt; height:36.3pt;z-index:-251661824;mso-position-horizontal-relative:page" mce_style="position:absolute; left:0;text-align:left;margin-left:82.25pt;margin-top:31.65pt;width:430.85pt; height:36.3pt;z-index:-251661824;mso-position-horizontal-relative:page" coordorigin="1645,633" coordsize="8617,726"> <v:group id="_x0000_s1048" style="position:absolute;left:1661;top:649;width:8585; height:2" mce_style="position:absolute;left:1661;top:649;width:8585; height:2" coordorigin="1661,649" coordsize="8585,2"> <v:shape id="_x0000_s1049" style="position:absolute;left:1661;top:649; width:8585;height:2" mce_style="position:absolute;left:1661;top:649; width:8585;height:2" coordorigin="1661,649" coordsize="8585,0" path="m1661,649r8585,e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1050" style="position:absolute; left:1676;top:664;width:2;height:664" mce_style="position:absolute; left:1676;top:664;width:2;height:664" coordorigin="1676,664" coordsize="2,664"> <v:shape id="_x0000_s1051" style="position:absolute;left:1676;top:664; width:2;height:664" mce_style="position:absolute;left:1676;top:664; width:2;height:664" coordorigin="1676,664" coordsize="0,664" path="m1676,664r,664e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1052" style="position:absolute; left:10231;top:664;width:2;height:664" mce_style="position:absolute; left:10231;top:664;width:2;height:664" coordorigin="10231,664" coordsize="2,664"> <v:shape id="_x0000_s1053" style="position:absolute;left:10231;top:664; width:2;height:664" mce_style="position:absolute;left:10231;top:664; width:2;height:664" coordorigin="10231,664" coordsize="0,664" path="m10231,664r,664e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1054" style="position:absolute; left:1661;top:1343;width:8585;height:2" mce_style="position:absolute; left:1661;top:1343;width:8585;height:2" coordorigin="1661,1343" coordsize="8585,2"> <v:shape id="_x0000_s1055" style="position:absolute;left:1661;top:1343; width:8585;height:2" mce_style="position:absolute;left:1661;top:1343; width:8585;height:2" coordorigin="1661,1343" coordsize="8585,0" path="m1661,1343r8585,e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><w:wrap anchorx="page" /> </v:group><![endif]--><!--[if !vml]--><!--[endif]-->接着再执行如下命令:

 

 

setenforce 0 getenforce

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1053" type="#_x0000_t75" style='width:415.5pt;height:54pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

 

3.3  关闭不需要的服务

 

<!--[if gte vml 1]><v:group id="_x0000_s1056" style='position:absolute;left:0;text-align:left; margin-left:82.25pt;margin-top:35pt;width:430.85pt;height:36.3pt;z-index:-251660800; mso-position-horizontal-relative:page' coordorigin="1645,700" coordsize="8617,726"> <v:group id="_x0000_s1057" style="position:absolute;left:1661;top:716;width:8585; height:2" mce_style="position:absolute;left:1661;top:716;width:8585; height:2" coordorigin="1661,716" coordsize="8585,2"> <v:shape id="_x0000_s1058" style="position:absolute;left:1661;top:716; width:8585;height:2" mce_style="position:absolute;left:1661;top:716; width:8585;height:2" coordorigin="1661,716" coordsize="8585,0" path="m1661,716r8585,e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1059" style="position:absolute; left:1676;top:731;width:2;height:664" mce_style="position:absolute; left:1676;top:731;width:2;height:664" coordorigin="1676,731" coordsize="2,664"> <v:shape id="_x0000_s1060" style="position:absolute;left:1676;top:731; width:2;height:664" mce_style="position:absolute;left:1676;top:731; width:2;height:664" coordorigin="1676,731" coordsize="0,664" path="m1676,731r,664e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1061" style="position:absolute; left:10231;top:731;width:2;height:664" mce_style="position:absolute; left:10231;top:731;width:2;height:664" coordorigin="10231,731" coordsize="2,664"> <v:shape id="_x0000_s1062" style="position:absolute;left:10231;top:731; width:2;height:664" mce_style="position:absolute;left:10231;top:731; width:2;height:664" coordorigin="10231,731" coordsize="0,664" path="m10231,731r,664e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><v:group id="_x0000_s1063" style="position:absolute; left:1661;top:1410;width:8585;height:2" mce_style="position:absolute; left:1661;top:1410;width:8585;height:2" coordorigin="1661,1410" coordsize="8585,2"> <v:shape id="_x0000_s1064" style="position:absolute;left:1661;top:1410; width:8585;height:2" mce_style="position:absolute;left:1661;top:1410; width:8585;height:2" coordorigin="1661,1410" coordsize="8585,0" path="m1661,1410r8585,e" filled="f" strokeweight="1.6pt"> <v:path arrowok="t" /> </v:shape></v:group><w:wrap anchorx="page" /> </v:group><![endif]--><!--[if !vml]--><!--[endif]-->使用下面命令进行关闭不需要的服务:

 

 

                    for SERVICES in abrtd acpid auditd avahi-daemon cpuspeed haldaemon                                            mdmonitor messagebus udev-post; do chkconfig ${SERVICES} off; done

 

 

 

<!--[if gte vml 1]><v:shape id="_x0000_i1054" type="#_x0000_t75" style='width:415.5pt;height:2in; mso-position-horizontal-relative:char;mso-position-vertical-relative:line'> <v:imagedata src="" o:title="" /> </v:shape><![endif]-->

 

备注本文档所有的 截图并不是当时实际安装而是为了编写此文档在虚拟机上安装时截的图所以个别图上的 信息反映的是虚拟机的硬件信息,在实际中则不一样,安装时请注意细微差别

 

特别鸣谢:(本文部分资料来源,排名分先后

鸟哥的Linux私房菜(第三版)基础学习篇

Linux公社

百度百科

维基百科<!--[if gte vml 1]><v:group id="_x0000_s1065" style='position:absolute;left:0;text-align:left; margin-left:88.5pt;margin-top:30.6pt;width:418.3pt;height:.1pt;z-index:-251650560; mso-position-horizontal-relative:page;mso-position-vertical-relative:text' coordorigin="1770,612" coordsize="8366,2"> <v:shape id="_x0000_s1066" style="position:absolute;left:1770;top:612;width:8366; height:2" mce_style="position:absolute;left:1770;top:612;width:8366; height:2" coordorigin="1770,612" coordsize="8366,0" path="m1770,612r8366,e" filled="f" strokeweight=".82pt"> <v:path arrowok="t" /> </v:shape><w:wrap anchorx="page" /> </v:group><![endif]--><!--[if !vml]--><!--[endif]-->

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics