安装Windows7+Ubuntu13.04+Centos7三系统




安装Windows7+Ubuntu13.04+Centos7三系统

(说明一点,在用U盘制作centos7的启动盘后,不需要删除包什么的,也不需要拷贝镜像文件什么的,刻录完就是可以直接使用的,我测试了两台台式的和一个笔记本安装都没有问题,不过在安装的时候,要修改下U盘的位置,如下:)

.在用u盘安装过程中,在进入安装界面,按tab键修改或者直接按e键:(直接安装是不能成功的,需要修改)

    vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet 改为:

    vmlinuz initrd=initrd.img inst.stage2=hd:/dev/sdb4 quiet

  其中hd:/dev/sdb4是U盘的位置,可能不一样,我的是这个,在网上浏览的其他的朋友有sda1的,不知道是不是u盘不一样还是怎么不同。



安装第三个系统centos7后遇到了windows7开机时没有引导的问题

解决方法:使用centos系统作为引导系统

方法:我的做法是修改/boot/grub2/grub.cfg这个文件,即向这个文件添加引导windows的脚本

menuentry ‘Windows 7 (loader) (on /dev/sda1)‘ --class windows --class os $menuentry_id_option ‘osprober-chain-xxx‘{
   insmod chain
   insmod part_msdos
   insmod ntfs
   set root=‘hd0,msdos1‘
   chainloader +1
}

或者,添加这个

menuentry ‘win7‘{
   insmod chain
   insmod ntfs
   set root=(hd0,msdos1)
   chainloader +1
}

menuentry ‘win7 search‘{
insmod chain
insmod ntfs
search -f /ntldr --set root
chainloader +1
}

在网上看到另一种方法解决问题,不过,我做了测试,是不能实现的,不过还是写下做个参考吧

#---------------------------------------------------

步骤:

1、切换到root用户

su

2、执行命令

grub2-mkconfig -o  /boot/grub2/grub.cfg

执行详情如下

-------------------------------------------------------------------------------------

[root@localhost jiezh]# grub2-mkconfig -o  /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.4.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.4.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-70ff68ea7ac34677a25f45f3417dd76c
Found initrd image: /boot/initramfs-0-rescue-70ff68ea7ac34677a25f45f3417dd76c.img
Found Windows 7 (loader) on /dev/sdb1
done

-------------------------------------------------------------------------------------

到此修复完成,开机重启就可以看到windows7的引导了(在我的电脑上是不行了)

我在Ubuntu上做#sudo update-grub2

倒是可以实现上述windows7的引导

#---------------------------------------------------


这个文件的完成代码如下:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
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-8091b91e-1049-4c97-8e64-59fa7cda6671‘ {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod xfs
    set root=‘hd0,msdos10‘
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos10 --hint-efi=hd0,msdos10 --hint-baremetal=ahci0,msdos10 --hint=‘hd0,msdos10‘  ab21651b-b9d9-403a-9115-f288ca6b7bd5
    else
      search --no-floppy --fs-uuid --set=root ab21651b-b9d9-403a-9115-f288ca6b7bd5
    fi
    linux16 /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=8091b91e-1049-4c97-8e64-59fa7cda6671 ro rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us rhgb quiet LANG=zh_CN.UTF-8
    initrd16 /initramfs-3.10.0-123.el7.x86_64.img
}


menuentry ‘Windows 7 (loader) (on /dev/sda1)‘ --class windows --class os $menuentry_id_option ‘osprober-chain-xxx‘{
   insmod chain
   insmod part_msdos
   insmod ntfs
   set root=‘hd0,msdos1‘
   chainloader +1
}



menuentry ‘CentOS Linux, with Linux 0-rescue-a9741edb99374138ad3514311cc1ba77‘ --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option ‘gnulinux-0-rescue-a9741edb99374138ad3514311cc1ba77-advanced-8091b91e-1049-4c97-8e64-59fa7cda6671‘ {
    load_video
    insmod gzio
    insmod part_msdos
    insmod xfs
    set root=‘hd0,msdos10‘
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos10 --hint-efi=hd0,msdos10 --hint-baremetal=ahci0,msdos10 --hint=‘hd0,msdos10‘  ab21651b-b9d9-403a-9115-f288ca6b7bd5
    else
      search --no-floppy --fs-uuid --set=root ab21651b-b9d9-403a-9115-f288ca6b7bd5
    fi
    linux16 /vmlinuz-0-rescue-a9741edb99374138ad3514311cc1ba77 root=UUID=8091b91e-1049-4c97-8e64-59fa7cda6671 ro rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us rhgb quiet
    initrd16 /initramfs-0-rescue-a9741edb99374138ad3514311cc1ba77.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/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry ‘Ubuntu 13.04 (13.04) (on /dev/sda9)‘ --class gnu-linux --class gnu --class os $menuentry_id_option ‘osprober-gnulinux-simple-0cbece5c-328e-4f94-aa52-da220cca34a2‘ {
    insmod part_msdos
    insmod ext2
    set root=‘hd0,msdos9‘
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 --hint-efi=hd0,msdos9 --hint-baremetal=ahci0,msdos9 --hint=‘hd0,msdos9‘  0cbece5c-328e-4f94-aa52-da220cca34a2
    else
      search --no-floppy --fs-uuid --set=root 0cbece5c-328e-4f94-aa52-da220cca34a2
    fi
    linux /boot/vmlinuz-3.8.0-19-generic root=UUID=0cbece5c-328e-4f94-aa52-da220cca34a2 ro locale=zh_CN quiet splash $vt_handoff
    initrd /boot/initrd.img-3.8.0-19-generic
}
submenu ‘Advanced options for Ubuntu 13.04 (13.04) (on /dev/sda9)‘ $menuentry_id_option ‘osprober-gnulinux-advanced-0cbece5c-328e-4f94-aa52-da220cca34a2‘ {
    menuentry ‘Ubuntu (on /dev/sda9)‘ --class gnu-linux --class gnu --class os $menuentry_id_option ‘osprober-gnulinux-/boot/vmlinuz-3.8.0-19-generic--0cbece5c-328e-4f94-aa52-da220cca34a2‘ {
        insmod part_msdos
        insmod ext2
        set root=‘hd0,msdos9‘
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 --hint-efi=hd0,msdos9 --hint-baremetal=ahci0,msdos9 --hint=‘hd0,msdos9‘  0cbece5c-328e-4f94-aa52-da220cca34a2
        else
          search --no-floppy --fs-uuid --set=root 0cbece5c-328e-4f94-aa52-da220cca34a2
        fi
        linux /boot/vmlinuz-3.8.0-19-generic root=UUID=0cbece5c-328e-4f94-aa52-da220cca34a2 ro locale=zh_CN quiet splash $vt_handoff
        initrd /boot/initrd.img-3.8.0-19-generic
    }
    menuentry ‘Ubuntu,Linux 3.8.0-19-generic (on /dev/sda9)‘ --class gnu-linux --class gnu --class os $menuentry_id_option ‘osprober-gnulinux-/boot/vmlinuz-3.8.0-19-generic--0cbece5c-328e-4f94-aa52-da220cca34a2‘ {
        insmod part_msdos
        insmod ext2
        set root=‘hd0,msdos9‘
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 --hint-efi=hd0,msdos9 --hint-baremetal=ahci0,msdos9 --hint=‘hd0,msdos9‘  0cbece5c-328e-4f94-aa52-da220cca34a2
        else
          search --no-floppy --fs-uuid --set=root 0cbece5c-328e-4f94-aa52-da220cca34a2
        fi
        linux /boot/vmlinuz-3.8.0-19-generic root=UUID=0cbece5c-328e-4f94-aa52-da220cca34a2 ro locale=zh_CN quiet splash $vt_handoff
        initrd /boot/initrd.img-3.8.0-19-generic
    }
    menuentry ‘Ubuntu,Linux 3.8.0-19-generic (恢复模式) (on /dev/sda9)‘ --class gnu-linux --class gnu --class os $menuentry_id_option ‘osprober-gnulinux-/boot/vmlinuz-3.8.0-19-generic--0cbece5c-328e-4f94-aa52-da220cca34a2‘ {
        insmod part_msdos
        insmod ext2
        set root=‘hd0,msdos9‘
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 --hint-efi=hd0,msdos9 --hint-baremetal=ahci0,msdos9 --hint=‘hd0,msdos9‘  0cbece5c-328e-4f94-aa52-da220cca34a2
        else
          search --no-floppy --fs-uuid --set=root 0cbece5c-328e-4f94-aa52-da220cca34a2
        fi
        linux /boot/vmlinuz-3.8.0-19-generic root=UUID=0cbece5c-328e-4f94-aa52-da220cca34a2 ro recovery nomodeset locale=zh_CN
        initrd /boot/initrd.img-3.8.0-19-generic
    }
}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the ‘exec tail‘ line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

安装Windows7+Ubuntu13.04+Centos7三系统

上一篇:第一章 Windows程序内部运行机制(1)API和SDK


下一篇:第一章 Windows程序内部运行机制(2)窗口和句柄