个人工具

“硬盘安装LiveCD”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第25行: 第25行:
  
 
echo "Adding $(egrep menu[e]ntry $0 | cut -d'"' -f2)" >&2
 
echo "Adding $(egrep menu[e]ntry $0 | cut -d'"' -f2)" >&2
cat << EOF
+
 
 +
 +
 
 +
cat << EOF
 +
 
 +
之后添加代码:
 +
 
 +
<pre>
 
menuentry "Ubuntu 10.04 Daily Build" {
 
menuentry "Ubuntu 10.04 Daily Build" {
 
       loopback loop (hd0,3)/ansi/software_and_config/ISOs/ubuntu/lucid-desktop-i386.iso
 
       loopback loop (hd0,3)/ansi/software_and_config/ISOs/ubuntu/lucid-desktop-i386.iso
第31行: 第38行:
 
       initrd (loop)/casper/initrd.lz
 
       initrd (loop)/casper/initrd.lz
 
}
 
}
 +
</pre>
 
意味着 sda3 under /ansi/software_and_config/ISOs/ubuntu/. In order to change it for your needs there are 3 elements to change. The loopback line contains your hard disk in grub style (hdx,y  x=0->sda x=1->sdb aso) and the path. The third element to change is in the linux line. Store this file as “50_ubuntu” in “/etc/grub.d“, make it executable with “chmod a+x 50_ubuntu” and activate the changes with “ubdate-grub“. A
 
意味着 sda3 under /ansi/software_and_config/ISOs/ubuntu/. In order to change it for your needs there are 3 elements to change. The loopback line contains your hard disk in grub style (hdx,y  x=0->sda x=1->sdb aso) and the path. The third element to change is in the linux line. Store this file as “50_ubuntu” in “/etc/grub.d“, make it executable with “chmod a+x 50_ubuntu” and activate the changes with “ubdate-grub“. A
  

2011年1月13日 (四) 16:00的版本

DVD 安装 LiveCD 试用 LiveCD 安装 U 盘安装 Wubi 安装 硬盘安装LiveCD

设置iso文件

说明:以下内容均为假设情况,在实际操作中需要灵活掌握 假如我们把iso文件放在挂载磁盘下进行安装 ,挂载磁盘的位置为/media/disk/,其中/media/disk/的分区格式为vfat,也即FAT32 .其中/media/disk/的具体情况视各自具体情况而定.一个重要的前提是必须保证该挂载磁盘被fstab有效挂载 接下来我们要把该iso和其中的.disk和casper下的vmlinuz和initrd.lz释放出来,保存至/media/disk/ 在转移到/media/disk/下前请检查下/media/disk/的剩馀空间,剩馀空间至少要有750M。如果剩馀空间不多可考虑删除多余的文件。 首先将iso文件转移到/media/disk/下,进入存放iso文件的目录下

sudo mv *.iso /media/disk/

然后挂载iso,并拷贝.disk、vmlinuz和initrd.lz 三个文件到 /media/disk/

sudo mkdir /mnt/live ; cd /media/disk ; sudo mount -t iso9660 -o loop,utf8 *.iso /mnt/live/ ; sudo cp -r /mnt/live/.disk  /media/disk/ ; sudo cp /mnt/live/casper/vmlinuz  /media/disk/ ; sudo cp /mnt/live/casper/initrd.lz  /media/disk/

如果什么重要的文件请在系统重启前及时备份。

设置启动项

grub2

/etc/default/grub

GRUB_HIDDEN_TIMEOUT=10 GRUB_HIDDEN_TIMEOUT_QUIET=false

这样有 10 秒计时可以选择了。

切换到 “/etc/grub.d”

grub菜单设置项目。添加 ISO 镜像吧,从50起,已经有40之前的了。名如 50_ubuntu_lucid

echo "Adding $(egrep menu[e]ntry $0 | cut -d'"' -f2)" >&2

cat << EOF

之后添加代码:

menuentry "Ubuntu 10.04 Daily Build" {
       loopback loop (hd0,3)/ansi/software_and_config/ISOs/ubuntu/lucid-desktop-i386.iso
       linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ansi/software_and_config/ISOs/ubuntu/lucid-desktop-i386.iso file=(loop)/preseed/ubuntu.seed quiet splash bootkbd=sg --
       initrd (loop)/casper/initrd.lz
}

意味着 sda3 under /ansi/software_and_config/ISOs/ubuntu/. In order to change it for your needs there are 3 elements to change. The loopback line contains your hard disk in grub style (hdx,y x=0->sda x=1->sdb aso) and the path. The third element to change is in the linux line. Store this file as “50_ubuntu” in “/etc/grub.d“, make it executable with “chmod a+x 50_ubuntu” and activate the changes with “ubdate-grub“. A

如何确定ISO位置

grub和hd0,x是硬盘安装的关键问题,解决了这2个问题,硬盘安装Ubuntu操作系统就成功了一半! 使用fdisk查询本机硬盘分区状态,例如本人的:

sudo fdisk -l

结果如下

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00019d35
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          12       96358+  82  Linux swap / Solaris
/dev/sda2              13         302     2329425   83  Linux
/dev/sda3   *         303         995     5566522+  83  Linux
/dev/sda4             996        9729    70155855    c  W95 FAT32 (LBA)

第一行显示了硬盘大小为80G,后4行说明了硬盘分区状态,带有*的是grub指定的内核位置,那么/dev/sda3在grub中是如何表示的呢? 在grub中表示为(hd0,2) ,也即分区号减一,我们现在把ubuntu的iso以及引导文件放在/dev/sda4的根目录下,/dev/sda4分区格式为fat32,那么,如果想引导grub启动/dev/sda4下的iso文件那么就要将grub引导到/dev/sda4盘下,也即(hd0,3) 对应关系

/dev/sda1                hd0,0       
/dev/sda2                hd0,1
/dev/sda3   *            hd0,2
/dev/sda4                hd0,3

如果我们使用USB来安装ubuntu怎么办呢? 首先挂载usb到系统中使用fdisk查看usb磁盘分区状态,例如:

Disk /dev/sdb: 2118 MB, 2118123520 bytes
127 heads, 32 sectors/track, 1017 cylinders
Units = cylinders of 4064 * 512 = 2080768 bytes
Disk identifier: 0x00000000
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1018     2068448    b  W95 FAT32
Partition 1 has different physical/logical endings:
     phys=(1023, 126, 32) logical=(1017, 119, 32)

然后拷贝ubuntu的iso以及引导文件放在/dev/sdb1的根目录下,在/media下新建usb文件夹然后让系统自动挂载usb ,修改fstab,下面的仅做参考:

sudo nano /etc/fstab

添加:

#/dev/sdb1
/dev/sdb1   /media/usb vfat defaults    0      0

然后修改grub,引导位置即(hd1,0)

安装

重启系统,在启动时选择Ubuntu 9.10 LiveCD启动项进入系统。 需要补充重要的一点:在点击桌面的安装之前,必须先umount isodevice

sudo umount -l /isodevice

具体安装方法和以前版本基本一致。或者参考Ubuntu8.04安装篇一文