您需要制作双引导目录ISO,以便引导EFI和MBR。标准的Ubuntu 14.04 x64 ISO文件以这种方式工作,但是没有说明可用于为EFI系统制作新的14.04可启动ISO。我能够拼凑出正确的步骤来创建这样的ISO。
这些说明将使您创建可以引导EFI和MBR的自定义Ubuntu 14.04 Server ISO。当EFI在具有空白未初始化磁盘的系统上启动时(例如,在Hyper-V中的新第二代VM上),安装程序将自动开始,然后自动擦除磁盘并安装基本的ubuntu服务器软件包和OpenSSH。这是专为使用LVM和自动分区功能在Ubuntu 14.04中自动配置新系统而设计的。如果在现有Linux系统上使用此ISO,则安装程序在检测到现有磁盘并等待输入时将停止。如果在非EFI系统(例如,Generation 1 Hyper-V VM)上使用此ISO,则它将在图形安装程序启动屏幕上等待,并且需要输入才能继续进行自动安装程序。
结果是仅使用ubuntu-server和openssh-server进行了基本的Ubuntu Server安装。
以下是创建可启动EFI的ISO的步骤:
获取14.04 ISO:
wget http://releases.ubuntu.com/14.04/ubuntu-14.04-server-amd64.iso
挂载它并将其内容提取到新文件夹中:
sudo mkdir -p ~/iso
sudo mount -o loop ubuntu-14.04-server-amd64.iso.iso ~/iso
sudo mkdir ~/ubuntu
sudo cp -rT ~/iso ~/ubuntu
转到要执行工作的目录:
cd ~/ubuntu
将语言设置为英语:
sudo -i
echo en >/home/user/ubuntu/isolinux/lang
exit
创建一个预置文件,该文件将使用LVM使用所有可用空间对磁盘进行自动分区:
sudo nano ~/ubuntu/ks.preseed
用以下内容替换文件内容:
d-i partman-auto/method string lvm
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/init_automatically_partition select Guided - use entire disk and set up LVM
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman-auto-lvm/no_boot boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
创建一个在安装过程中将配置Ubuntu的kickstart文件:(确保您更改了用户名部分,并且应该使用加密的密码)
sudo nano ~/ubuntu/ks.cfg
用以下内容替换文件内容:
lang en_US
langsupport en_US
keyboard us
mouse
timezone America/Los_Angeles
rootpw --disabled
user USERNAME --fullname "USERNAME" --password "PASSWORD"
reboot
text
install
cdrom
auth --useshadow --enablemd5
network --bootproto=dhcp --device=eth0
firewall --disabled
skipx
%packages
@ ubuntu-server
openssh-server
编辑grub配置文件,以便在ISO执行EFI引导时,引导程序使用正确的选项来使用我们的预置文件和配置文件:
sudo nano ~/ubuntu/boot/grub/grub.cfg
用以下内容替换文件内容:
if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
set menu_color_normal=white/light-blue
set menu_color_highlight=light-blue/light-gray
set timeout=10
set default=0
menuentry "Automatically Install Ubuntu Server with Custom Config" {
set gfxpayload=keep
linux /install/vmlinuz file=/cdrom/preseed/ubuntu-server.seed quiet ks=cdrom:/ks.cfg preseed/file=/cdrom/ks.preseed --
initrd /install/initrd.gz
}
menuentry "OEM install (for manufacturers)" {
set gfxpayload=keep
linux /install/vmlinuz file=/cdrom/preseed/ubuntu-server.seed quiet oem-config/enable=true --
initrd /install/initrd.gz
}
menuentry "Multiple server install with MAAS" {
set gfxpayload=keep
linux /install/vmlinuz modules=maas-enlist-udeb vga=788 initrd=/install/initrd.gz quiet --
initrd /install/initrd.gz
}
menuentry "Check disc for defects" {
set gfxpayload=keep
linux /install/vmlinuz MENU=/bin/cdrom-checker-menu quiet --
initrd /install/initrd.gz
}
menuentry "Rescue a broken system" {
set gfxpayload=keep
linux /install/vmlinuz rescue/enable=true --
initrd /install/initrd.gz
}
编辑用于非EFI引导(MBR引导)的isolinux引导菜单,以使用定制配置和定制预置:
sudo nano ~/ubuntu/isolinux/txt.cfg
用以下内容替换文件内容:
default install
label install
menu label ^Install Ubuntu Server with Custom Config
kernel /install/vmlinuz
append file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg preseed/file=/cdrom/ks.preseed --
label cloud
menu label ^Multiple server install with MAAS
kernel /install/vmlinuz
append modules=maas-enlist-udeb vga=788 initrd=/install/initrd.gz quiet --
label check
menu label ^Check disc for defects
kernel /install/vmlinuz
append MENU=/bin/cdrom-checker-menu vga=788 initrd=/install/initrd.gz quiet --
label memtest
menu label Test ^memory
kernel /install/mt86plus
label hd
menu label ^Boot from first hard disk
localboot 0x80
创建ISO:
该命令是http://petersmithphotog.no-ip.biz/wiki/index.php/Unattended_Install中显示的命令的修改版本。这些说明不适用于Ubuntu 14.04,因为它们指向文件efi.img的错误位置。(应该在ISO的./boot/grub/中)
sudo mkisofs -U -A "Custom1404" -V "Custom1404" -volset "Custom1404" -J -joliet-long -r -v -T -o ../Custom1404.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot .
验证ISO具有正确的样式启动目录:
您从Ubuntu下载的原始ISO:
dumpet -i ~/ubuntu-14.04-server-amd64.iso
输出:
Validation Entry:
Header Indicator: 0x01 (Validation Entry)
PlatformId: 0x00 (80x86)
ID: ""
Checksum: 0x55aa
Key bytes: 0x55aa
Boot Catalog Default Entry:
Entry is bootable
Boot Media emulation type: no emulation
Media load segment: 0x0 (0000:7c00)
System type: 0 (0x00)
Load Sectors: 4 (0x0004)
Load LBA: 8446 (0x000020fe)
Section Header Entry:
Header Indicator: 0x91 (Final Section Header Entry)
PlatformId: 0xef (EFI)
Section Entries: 1
ID: ""
Boot Catalog Section Entry:
Entry is bootable
Boot Media emulation type: no emulation
Media load address: 0 (0x0000)
System type: 0 (0x00)
Load Sectors: 4672 (0x1240)
Load LBA: 24754 (0x000060b2)
您创建的新ISO:
dumpet -i ~/Custom1404.iso
输出:
Validation Entry:
Header Indicator: 0x01 (Validation Entry)
PlatformId: 0x00 (80x86)
ID: ""
Checksum: 0x55aa
Key bytes: 0x55aa
Boot Catalog Default Entry:
Entry is bootable
Boot Media emulation type: no emulation
Media load segment: 0x0 (0000:7c00)
System type: 0 (0x00)
Load Sectors: 4 (0x0004)
Load LBA: 3100 (0x00000c1c)
Section Header Entry:
Header Indicator: 0x91 (Final Section Header Entry)
PlatformId: 0xef (EFI)
Section Entries: 1
ID: ""
Boot Catalog Section Entry:
Entry is bootable
Boot Media emulation type: no emulation
Media load address: 0 (0x0000)
System type: 0 (0x00)
Load Sectors: 4672 (0x1240)
Load LBA: 1932 (0x0000078c)
您可以将此输出与使用如何创建完全无人参与的Ubuntu安装中的说明从ISO构建的输出进行比较。:(它们仅创建MBR ISO,而不创建双引导目录ISO)
sudo mkisofs -D -r -V "non-efi-ubuntu" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../non-efi-ubuntu.iso .
获取ISO信息:
dumpet -i ~/non-efi-ubuntu.iso
输出:
Validation Entry:
Header Indicator: 0x01 (Validation Entry)
PlatformId: 0x00 (80x86)
ID: ""
Checksum: 0x55aa
Key bytes: 0x55aa
Boot Catalog Default Entry:
Entry is bootable
Boot Media emulation type: no emulation
Media load segment: 0x0 (0000:7c00)
System type: 0 (0x00)
Load Sectors: 4 (0x0004)
Load LBA: 1925 (0x00000785)