歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 安裝Windows7+Ubuntu13.04+CentOS7三系統

安裝Windows7+Ubuntu13.04+CentOS7三系統

日期:2017/2/28 14:28:08   编辑:Linux教程

(說明一點,在用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 ###

更多Ubuntu相關信息見Ubuntu 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=2

更多CentOS相關信息見CentOS 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=14

Copyright © Linux教程網 All Rights Reserved