CentOS 7、 Windows8.1双系统安装注意事项

本文结合自己在安装CentOS7 Win8.1中遇到的问题具体谈谈,也顺便让遇到类似问题的朋友少走弯路,浪费时间!由于安装中遇到的问题因人因环境而异,所以我碰到的问题未必你碰到,你碰到的问题或许在我这里也没有,请勿对号入座,具体问题具体分析。本人刚开始接触Linux,对系统不熟悉。所以貌似简单的问题,但只要我碰到的,都会以后详细说一下,大牛请绕道!微笑

一般步骤见:百度经验:U盘安装win8(win7)+centos7双系统  我也是基本上安装上面所述安装的,我这里只说明碰到的和次教程不不同的地方;

1. CenterOS启动U盘制作好了以后,重启电脑,按F12(不同电脑有差异)进入Bios,选择以USB HDD 启动;


2.光标移动到 ”install centos7“按 enter键直接进入安装过程中,我这里不用编辑((>vmlinux initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet”这句话。把其中的“CentOS\x207\x20x86_64”改为“/dev/sdb4”)) 这样反而出错。

3.在"软件选择"中我选择"开发及生成工作站"、"已选环境的附加选项"全部打钩。(这个因人而异)

4.同样我在装完成CentOS之后,没有win8.1选项,接下来就是给CentOS加Wind8.1启动选项。也是本文的重点!

5、重启电脑,在出现选择菜单时按'C'进入grub终端(Grub终端命令见:http://blog.csdn.net/zzqhost/article/details/5978826) 输入"cat (hd0,"  按Tab键如下:

win8.1的Partition在 "hd0, msdos1" 进入CentOS,打开终端,进行如下操作如:

我的示例:

1
2
3
[johnnyhu@CentOS ~]$ su root
密码 :
[root@CentOS johnnyhu] # gedit /boot/gurb2/grub.cfg

这样就能编辑修改grub.cfg配置文件了,在

1
### BEGIN /etc/grub.d/10_linux ###
下面添加如下一行:
1
2
3
4
menuentry  'Windows8.1 Profession' {
       set root= 'hd0,msdos1'
      chainloader + 1
}

注意这里为 "chainloader  +1"   而非"chainloader  +  1

保存,启动就可以看见有了Windows8.1 Profession的选项了,但默认启动的还是CentOS7,接下来有一个重点就是把默认启动项改为Windows8.1 

6.改变默认启动项:

grub2是通过/etc/grub.d/目录下的文件顺序来决定启动项顺序的:要修改默认启动项,即修改grub2的启动顺序。(另见:一劳永逸修改grub2启动顺序)

操作如下:

1
2
[root@CentOS johnnyhu] # cd /etc/grub.d
[root@CentOS grub.d] # ls -l
得出如下数据:

1
2
3
4
5
6
7
8
-rwxr-xr- x1 root root   8698 7月    1  00: 16 00_header
-rwxr-xr- x1 root root   9517 7月    1  00: 16 10_linux
-rwxr-xr- x1 root root  10275 7月    1  00: 16 20_linux_xen
-rwxr-xr- x1 root root   2559 7月    1  00: 16 20_ppc_terminfo
-rwxr-xr- x1 root root  11110 7月    1  00: 16 30_os-prober
-rwxr-xr- x1 root root    214 7月    1  00: 16 40_custom
-rwxr-xr- x1 root root    216 7月    1  00: 16 41_custom
-rw-r--r--.  1 root root    483 7月    1  00: 16 README

30_os-prober是grub2自动生成的,因为我安装ubuntu linux之前就有vista在电脑上。目录下有各README文件,打开查看里面的内容:
引用:
All executable files in this directory are processed in shell expansion order.
00_*: Reserved for 00_header.
10_*: Native boot entries.
20_*: Third party apps (e.g. memtest86+).

The number namespace in-between is configurable by system installer and/or administrator. For example, you can add an entry to boot another OS as 01_otheros, 11_otheros, etc, depending on the position you want it to occupy in the menu; and then adjust the default setting via /etc/default/grub.

大意是:
该目录下的可以执行文件的顺序是按照shell扩展来排列的(就是按首字符排列的意思,用来配置grub的顺序)。
00_开头的文件是预留给00_header的
10_开头的用于系统本身
20_开头的用于第三方程序

可以新建和改变文件的顺序来配置gurb2的启动顺序。
知道以上这些就好办了。我们只要把30_os-prober的顺序设置到10_linux之前就可以让windows的选项在linux之前。

运行以下命令把30_os-prober复制一份并且重命名为09_os-prober:
代码:

1
[root@CentOS grub.d] #sudo cp 30_os-prober 09_os-prober

然后去掉30_os-prober的可执行权限
代码
1
[root@CentOS grub.d] #sudo chmod 644 30_os-prober
2
[root@CentOS grub.d] # ls -l

得到如下:

1
2
3
4
5
6
7
8
9
-rwxr-xr- x1 root root   8698 7月    1  00: 16 00_header
-rwxr-xr- x1 root root  11110 11月  23  11: 47 09_os-prober
-rwxr-xr- x1 root root   9517 7月    1  00: 16 10_linux
-rwxr-xr- x1 root root  10275 7月    1  00: 16 20_linux_xen
-rwxr-xr- x1 root root   2559 7月    1  00: 16 20_ppc_terminfo
-rw-r--r--.  1 root root  11110 7月    1  00: 16 30_os-prober
-rwxr-xr- x1 root root    214 7月    1  00: 16 40_custom
-rwxr-xr- x1 root root    216 7月    1  00: 16 41_custom
-rw-r--r--.  1 root root    483 7月    1  00: 16 README

然后打开/etc/default/grub把默认启动改成你要的那个.

代码:

1
[root@CentOS grub.d] #sudo gedit  /etc/default/grub

找到GRUB_DEFAULT=,改后面的参数。(注意linux的顺序是从0开始的哦),我设置为第一项vista,于是把默认改成噢 0(GRUB_DEFAULT=0)

最后更新grub

CentOS 7  使用命令 “sudo update-grub” 我这里提示找不到该命令,所以换了一种方式达到该目的,即使用命名:

1
[root@CentOS johnnyhu] #grub2-makeconfig -o /boot/grub2/grub.cfg
更新了之后,我们对grub.cfg做如下处理:

### BEGIN /etc/grub.d/10_linux ###### END /etc/grub.d/10_linux #####  之间的内移至:### BEGIN /etc/grub.d/09_linux ###### END /etc/grub.d/09_linux ###之间的如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
### BEGIN /etc/grub.d/09_linux ###
menuentry  'Windows8.1 Profession' {
      set root= 'hd0,msdos1'
      chainloader + 1
}
menuentry  'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option  'gnulinux-3.10.0-123.el7.x86_64-advanced-0d67b965-06fe-4b60-92c2-f17620a84543' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod xfs
    set root= 'hd0,msdos8'
     if [ x$feature_platform_search_hint = xy ]; then
      search -- no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos8 --hint-efi=hd1,msdos8 --hint-baremetal=ahci1,msdos8 --hint= 'hd0,msdos8'  987cdf3b-8fcd-430d-870e-1f9513e311f0
     else
      search -- no-floppy --fs-uuid --set=root 987cdf3b-8fcd-430d-870e-1f9513e311f0
    fi
    linux16 /vmlinuz- 3. 10. 0- 123.el7.x86_64 root=UUID=0d67b965-06fe-4b60-92c2-f17620a84543 ro vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet LANG=zh_CN.UTF- 8
    initrd16 /initramfs- 3. 10. 0- 123.el7.x86_64.img
}
menuentry  'CentOS Linux, with Linux 0-rescue-89428295185642848bbbefbf0459e21c' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option  'gnulinux-0-rescue-89428295185642848bbbefbf0459e21c-advanced-0d67b965-06fe-4b60-92c2-f17620a84543' {
    load_video
    insmod gzio
    insmod part_msdos
    insmod xfs
    set root= 'hd0,msdos8'
     if [ x$feature_platform_search_hint = xy ]; then
      search -- no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos8 --hint-efi=hd1,msdos8 --hint-baremetal=ahci1,msdos8 --hint= 'hd0,msdos8'  987cdf3b-8fcd-430d-870e-1f9513e311f0
     else
      search -- no-floppy --fs-uuid --set=root 987cdf3b-8fcd-430d-870e-1f9513e311f0
    fi
    linux16 /vmlinuz- 0-rescue-89428295185642848bbbefbf0459e21c root=UUID=0d67b965-06fe-4b60-92c2-f17620a84543 ro vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet
    initrd16 /initramfs- 0-rescue-89428295185642848bbbefbf0459e21c.img
}
if [  "x$default" =  'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' ]; then default= 'Advanced options for CentOS Linux>CentOS Linux, with Linux 3.10.0-123.el7.x86_64'; fi;
### END /etc/grub.d/09_linux ###

### BEGIN /etc/grub.d/10_linux ###
### END /etc/grub.d/10_linux ###   

保存此配置  大功告成!!!


 

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值