Linux CentOS6安装grub
安装grub的方式一:这个方式是通过在一台新的硬盘上安装grub程序和简版的内核及/bash组成一个系统,来验证grub的安装结果。
1、添加新硬盘
2、为硬盘分区
1个用于/boot 1个用于swap分区 1个用于根文件系统
http://s1.运维网.com/images/20180610/1528615093295622.png
3、格式化文件系统
http://s1.运维网.com/images/20180610/1528615373336883.png
4、挂载/dev/sdb1准备安装grub程序
5、安装grub
grub-install
http://s1.运维网.com/images/20180610/1528615310463293.png
http://s1.运维网.com/images/20180610/1528615667613907.png
6、将内核文件及initramdisk文件放入启动项目录中
http://s1.运维网.com/images/20180610/1528615698851047.png
7、获取或者创建grub配置文件
http://s1.运维网.com/images/20180610/1528616205117319.png
8、在根目录中创建FHS结构的目录
http://s1.运维网.com/images/20180610/1528616455767930.png
9、为新系统增加几个简单的命令
/bin/cat /bin/ls /bin/bash
http://s1.运维网.com/images/20180610/1528617091513786.png
10、通过chroot做测试
看看命令是否可以执行
http://s1.运维网.com/images/20180610/1528617307289444.png
11、将硬盘换入到另一台设备上,测试grub安装结果
http://s1.运维网.com/images/20180610/1528618924534471.png
http://s1.运维网.com/images/20180610/1528618938356061.png
这样第一种方式就是做完了。
安装grub的第二种方式
通过在正常的系统中setup
1、首先损坏现有的grub程序,把MRB前446个字节损坏就好了。
http://s1.运维网.com/images/20180610/1528619623743839.png
2、进入grub命令行
http://s1.运维网.com/images/20180610/1528620348413360.png
3、重启服务器看看是否可以正常启动
安装grub的第三种方案
通过救援模式安装
第一步破坏现有的grub
http://s1.运维网.com/images/20180610/1528620560422196.png
第二步重启系统并挂在系统盘
第三步选择救援模式
http://s1.运维网.com/images/20180610/1528620628309251.png
前几步与安装操作系统差不多
http://s1.运维网.com/images/20180610/1528620657422982.png
http://s1.运维网.com/images/20180610/1528620670796082.png
http://s1.运维网.com/images/20180610/1528620687819923.png
http://s1.运维网.com/images/20180610/1528620811289149.png
大概意思就是将根文件系统挂载到/mnt/sysimage,用于修复现有的grub程序。Continue和read-only都是挂载临时根文件系统,只不过一个是读写 一个是只读
下来就是运行shell程序
http://s1.运维网.com/images/20180610/1528620011521800.png
在shell脚本中安装grub-install命令
安装完之后 exit退出 然后reboot
http://s1.运维网.com/images/20180610/1528620049277816.png
重启启动检查修复结果。
安装grub第四种方式
与第二种差不多,这个方式是在shell环境中执行的。
grub-install
第一步 破坏当前的grub程序
http://s1.运维网.com/images/20180610/1528621470552741.png
第二步修复grub
grub-install
http://s1.运维网.com/images/20180610/1528621531802091.png
第三步检查修复结果
页:
[1]