2012年1月6日星期五

Win7 64bit下从硬盘安装Ubuntu 10.10

安装前硬盘情况:
(hd0,1) Win7 boot partition 主分区
(hd0,2) Win7 system partition 主分区
(hd0,4) NTFS partition 逻辑分区
(hd0,5) NTFS partition 逻辑分区
(hd0,6) NTFS partition 逻辑分区
(hd0,7) NTFS partition 主分区
在扩展分区中还有一个24GB的未分区空间,在(hd0,6)之后,(hd0,7)之前。


1. 先给Win7 boot分区分配盘符S,下载GRUB4DOS,将grldr、grldr.mbr提取到S盘根目录下;
注:如果Win7没有隐藏的boot分区,则改为C盘。
GRUB4DOS下载地址:http://nufans.net/grub4dos/tinybit/

2. 打开maverick-desktop-amd64.iso,将casper目录下的vmlinuz和initrd.lz两个文件复制到S盘根目录下;

3. 将maverick-desktop-amd64.iso复制到S盘根目录下;

4. 创建S:\menu.lst文件,内容为(注意大小写):
timeout 6
default 0
title Ubuntu 10.10 64bit LiveCD
rootnoverify (hd0,0)
kernel (hd0,0)/vmlinuz boot=casper iso-scan/filename=/maverick-desktop-amd64.iso ro quiet splash locale=zh_CN.UTF-8
initrd (hd0,0)/initrd.lz

title Back to previous menu
rootnoverify (hd0,0)
chainloader +1

title Reboot the system
reboot

title Halt the system
halt

5. 打开命令行提示符窗口,更改Win7 boot timeout时间:
bcdedit /timeout 10

6. 在S盘根目录下更改boot.ini文件,内容为:
[boot loader]
timeout=6
default=c:\grldr.mbr
[operating systems]
c:\grldr.mbr="GRUB4DOS 0.4.5b"

7. 重启电脑,在出现的Win7启动菜单选择GRUB4DOS 0.4.5b项,然后在接下来出现的grub4dos启动菜单中选择Ubuntu 10.10 64bit LiveCD项,就可以启动Ubuntu 10.10 LiveCD了。

8. 进入到LiveCD模式后,要先卸载isodevice,否则安装程序无法进行分区。在出现Ubuntu 10.10 LiveCD界面时按Ctrl+Alt+F2,运行:
$ sudo umount -l /isodevice
再按Ctrl+Alt+F7进入图形界面,接下来,双击桌面上install Ubuntu 10.10图标启动安装程序。

9. 接下来按提示选语言、键盘、时区等等,需要注意的是分区这一步,选择手动分区,不使用整个硬盘。创建一个100MB的/boot分区;一个4GB的交换分区;一个20GB的ext4分区,挂载点为“/”;。分区可按各自情况决定。


10. 最后点“安装”按钮进行安装,安装完成后,重新启动。进入到新安装的Ubuntu 10.10后,在终端运行:
$ sudo update-grub2
导入windows启动项。然后修改/boot/grub/grub.cfg文件,使之默认从Win7启动。
$ sudo gedit /boot/grub/grub.cfg
内容如下:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
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 recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos10)'
search --no-floppy --fs-uuid --set 48dc0701-ac13-4cd1-ac53-a25695f429b4
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
insmod part_msdos
insmod ext2
set root='(hd0,msdos8)'
search --no-floppy --fs-uuid --set 665a04c4-29a6-411c-b6c2-9292a1b0454b
set locale_dir=($root)/grub/locale
set lang=en
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=6
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/06_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set 4ca6e44ea6e43a5a
chainloader +1
}
### END /etc/grub.d/06_os-prober ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-14-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
load_video
set gfxpayload=keep
insmod part_msdos
insmod ext2
set root='(hd0,msdos8)'
search --no-floppy --fs-uuid --set 665a04c4-29a6-411c-b6c2-9292a1b0454b
linux /vmlinuz-2.6.35-14-generic root=UUID=48dc0701-ac13-4cd1-ac53-a25695f429b4 ro quiet splash
initrd /initrd.img-2.6.35-14-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-14-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
load_video
set gfxpayload=keep
insmod part_msdos
insmod ext2
set root='(hd0,msdos8)'
search --no-floppy --fs-uuid --set 665a04c4-29a6-411c-b6c2-9292a1b0454b
echo 'Loading Linux 2.6.35-14-generic ...'
linux /vmlinuz-2.6.35-14-generic root=UUID=48dc0701-ac13-4cd1-ac53-a25695f429b4 ro single
echo 'Loading initial ramdisk ...'
initrd /initrd.img-2.6.35-14-generic
}
### END /etc/grub.d/10_linux ###

### 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 $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###


11. 禁止系统日期时间设为UTC
修改/etc/default/rcS,禁止UTC:
$ sudo gedit /etc/default/rcS
将UTC=yes改为UTC=no

没有评论:

发表评论