如何将Ubuntu安装到USB密钥? (不使用Startup Disk Creator)

如果你急于回复,系统→管理→ 启动磁盘创建器 – 不,这不是我在说什么。

我想尝试Ubuntu 11.04的Unity而不触及我现有的Ubuntu安装。

为此,我需要先安装nVidia驱动程序(叹气)。

为此,我需要进行更改以保持重新启动。

为此, 我需要在USB密钥上安装Ubuntu。

你是怎样做的?


我尝试了什么

  1. 我试图从Testdrive制作一个USB密钥,然后从它启动,然后选择“安装Ubuntu”。 安装程序拒绝安装到安装介质本身。

  2. 我试过,从我安装的Ubuntu副本:

    sudo kvm /dev/sdb --cdrom .cache/testdrive/iso/ubuntu_natty-desktop-i386.iso 

    …但安装程序未正确检测到磁盘。

Ubuntu / Linux解决方案

1.获取最新图像

你应该用testdrive做到这一点 安装testdrive

试驾

注意。 如果您的密钥小于4.4 GB(对于Ubuntu 11.04(Natty Narwhal)),您必须获得备用安装程序。 如果可用磁盘空间少于4.4 GB,则Desktop安装程序拒绝继续。

2.格式化USB磁盘。

如果您已经在磁盘上安装了任何Linux安装程序,或者安装程序由于某种原因不想触摸该磁盘,这一点非常重要。 我之前失败了,因为我没有执行这一步骤,所以请自担风险! 您需要一个至少3 GB的密钥。

您可以从系统管理磁盘工具中执行此操作 。 选择目标USB密钥,卸载所有分区,然后选择格式化驱动器。

磁盘工具

您需要确保在允许格式化磁盘之前选择“不分区”。

格式化驱动器窗口

3.在USB密钥上启动虚拟机

我确定(带file )我的USB密钥在/dev/sdb ,然后运行:

 sudo qemu-system-x86_64 /dev/sdb -cdrom ~/.cache/testdrive/iso/ubuntu_natty-desktop-i386.iso 

…安装Natty Narwhal桌面的i386 ISO – 如果您下载不同的ISO映像,文件名将有所不同。

您选择的虚拟化解决方案的详细信息会有所不同,但您希望将USB密钥的设备文件用作VM的硬盘驱动器。

-boot order=d附加到kvm命令,以使其从映像启动,以防它尝试从“硬盘”启动并因为无法在那里找到操作系统而失败。

4.正常安装。

此时,您正在使用虚拟机,将USB密钥视为唯一连接的硬盘驱动器。 从“QEMU”窗口内部,按照通常的方式安装。

几点说明:

  • 分区。 避免使用自动分区系统,因为它会在USB密钥上创建交换分区。 这是不好的,因为交换变得超级慢(长达数秒的系统冻结)并迅速杀死你的驱动器的生命。 只需为/分配一个分区。 如果您正在使用备用安装程序,请确保设置noatime标志以进一步减少对磁盘的写入量。

  • 更新。 跳过选项以自动下载和安装更新。 在运行安装程序时,无法保证存储库处于一致状态。 就个人而言,我宁愿使用aptitude等工具手动管理升级(默认情况下不再附带Ubuntu)。

  • Alpha质量的软件。 事情有点不稳定 – 毕竟它是alpha质量的软件。 我有dpkg退出错误代码1而无法查看错误 – 但是没有包被破坏。 我尝试在安装后干净地关闭虚拟机,但它挂了。 但是,在重新启动时,系统启动正常。

5.重新启动并启动到您的Ubuntu副本

您可能需要调整BIOS设置才能使其正常工作。


关于Ubuntu在USB上的一个好的(或烦人的,基于你的用例)事情是,下次它将刷新GRUB时,它还将检测并添加硬盘上的内核和操作系统列表。 这可以让你从USB密钥的GRUB直接启动你的硬盘。

使用Virtual Box将Ubuntu安装到可移动USB驱动器

为了将Ubuntu安装到便携式外部USB驱动器(磁盘或磁盘),我们也可以使用Virtual Box从虚拟环境进行安装。 对于USB 2.0支持,需要封闭源但免费的PUEL版本的Virtual Box 。

为安装实时环境创建虚拟机:

我们为Linux / Ubuntu环境创建一个虚拟机(32位或64位,具体取决于安装介质):

在此处输入图像描述

由于我们要安装到USB驱动器,因此我们不会通过取消选中以下窗口中的框来为此计算机创建虚拟硬盘(VDI)

在此处输入图像描述

然后我们需要分配系统内存(例如1024 MB),图形内存(例如128MB),并根据我们的主机硬件调整CPU设置。 此外,我们可能希望创建桥接网络,以便能够在安装期间下载文件。

将安装CD安装到虚拟机:

在Virtual Box Manager的Storage菜单中,我们选择安装CD的.iso映像作为CD驱动器安装。 确保将虚拟机的引导顺序设置为从CD引导。

在此处输入图像描述

将USB驱动器安装到安装环境中

在我们启动虚拟机(首先需要设置USB支持 )以启动安装CD后,我们需要通过单击底部面板中的小图标或从设备 – > USB设备菜单中选择来安装USB驱动器虚拟盒管理器。

在此处输入图像描述 这是在我们继续之前需要安装USB驱动器的时候

分区并格式化USB驱动器

在选择了Something之后,图形分区管理器GParted将引导我们完成分区过程:

在此处输入图像描述

我们至少需要一个带挂载点根( / )的分区。 在上面的示例中,创建了一个额外的/home分区。 通过解开格式,我们保留可能已存在的数据。 USB记忆棒或便携式驱动器可能不需要A /swap分区。

  • 此时需要特别注意引导装载程序Grub确实将安装到USB驱动器(/ sda)而不是其他任何地方

选择Install Now,我们开始安装到USB驱动器。 请注意,此安装可能需要比我们习惯的时间长一些。

安装完成后,我们可以使用全新的操作系统卸载我们的驱动器,并从任何其他机器启动以根据我们的需求进行定制。

  • 不要忘记在此计算机的BIOS中启用USB启动

如果您正在讨论实际安装,例如完整的Ubuntu安装,而不仅仅是Live USB类型,那么您可以使用通过USB插入的外部硬盘驱动器并通过以下方法安装。

请注意:以下步骤使用Ubuntu V9.10进行了测试,但尚未使用更高版本进行测试。 使用风险和自行决定。

你需要什么

  1. 一台可以上网的电脑。
  2. 带有Ubuntu的LiveCD或LiveUSB。
  3. 具有USBfunction的外置硬盘。

该怎么办

  1. 打开计算机并卸下硬盘驱动器。
  2. 通过USB电缆插入外部USB硬盘驱动器。
  3. 粘贴在LiveUSB或LiveCD中,然后启动PC。
  4. 打开启动菜单,然后选择从LiveCD / LiveUSB启动。
  5. 在安装过程中,您应该列出外部硬盘驱动器,安装Ubuntu。
  6. 完成安装过程,关闭电脑,然后将其他硬盘驱动器放回计算机。
  7. 重新启动计算机,转到启动菜单并选择外部硬盘驱动器并尝试从中启动。 如果它真的恭喜你,你现在有一个带有完整成熟操作系统的外置硬盘。
  8. 享受运行Ubuntu / Linux的外置硬盘! 如果这有助于你,请告诉我! 如果没有让我知道这一点。 🙂

但是,如果您只是想要一个Live USB,那么您可以使用Universal USB Installer或Ubuntu USB Startup Disk Creator ……

介绍

这个逐步指令的主要部分来自iso测试跟踪器和这个链接,

  • 在Xenial 16.04.1中的Ubuntu Desktop amd64中安装(整个磁盘)

我已经添加了一些安装到外部驱动器所需的额外步骤。


  • 请注意,您将安装一个在当前启动模式下工作的系统,

    • 如果以UEFI模式安装,则已安装的系统将在UEFI模式下运行
    • 如果您在BIOS别名CSM别名传统模式下安装,则已安装的系统将在BIOS模式下运行。
  • 创建一个已安装的系统会更复杂,它既可以在UEFI和BIOS模式下工作,但可以根据以下链接和链接,

    便携式已安装系统,可在UEFI和BIOS模式下启动


  • 如果您打算安装到USB pendrive或存储卡中,请选择快速USB 3 pendrive或高速卡。 看到这个链接和它的链接,

    help.ubuntu.com/community/Installation/FromUSBStick#Notes_about_speed


  • 如果您打算在新的和中年的计算机中使用外部驱动器,我建议您从Ubuntu 64位’amd64’iso文件安装。

  • 如果您打算在旧计算机 (以及更新的计算机)中使用外部驱动器,我建议您使用具有Ubuntu系列风格的32位“i386”iso文件进行安装,其桌面环境比标准Ubuntu更轻,

    • Lubuntu采用超轻LXDE
    • Ubuntu MATE采用中光MATE
    • Xubuntu采用中光XFCE

  • 这些32位系统将与32位和64位计算机一起使用,但仅在BIOS模式下 ,根据[在此答案]中的说明进行安装时。

  • 可以创建一个可用的持久性实时系统

    • 32位和64位计算机
    • 在BIOS模式和UEFI模式下

    如果这是你想要的,以下链接可以帮助你,

    mkusb /永久#Compressed_image_file_with_a_persistent_live_system

说明

  1. 当计算机关闭并与电网断开连接时 ,请断开(和/或拔下)内部驱动器

    这使安装程序处理您要安装Ubuntu的外部驱动器,就像它是一个内部驱动器(并且安装程序不能篡改内部驱动器)。

  2. 插入Ubuntu启动/实时/安装程序驱动器 (DVD磁盘,USB驱动器,存储卡)并从中启动计算机。

    如果您愿意,请使用您的母语。

  3. 启动图像

    系统正常启动并加载显示欢迎对话框的安装程序,其中包含语言选择和“Try Ubuntu”和“Install Ubuntu”按钮

  4. 连接要安装Ubuntu( 目标驱动器的外部驱动器 (HDD,SSD,pendrive,存储卡)。 如果可能,请将外部电源插入此驱动器。 使用计算机USB插头的电源可能还不够。

  5. 单击Install Ubuntu图标

    将显示“准备安装Ubuntu”屏幕

  6. 在屏幕上准备安装Ubuntu,请注意以下组件的可用性

    可用选项应准确表示系统的状态

    • (如果网络可用)安装Ubuntu时下载更新
    • (如果在“笔记本电脑上”)插入电源
    • 安装第三方软件…选项可用。 如果您希望系统可以在计算机之间移植,请避免使用第三方软件,特别是图形和WiFi的专有驱动程序。
  7. 单击继续按钮

    将显示“安装类型”屏幕

  8. 选择擦除磁盘并安装Ubuntu

    安装屏幕扩展为包括加密和LVM选项

    等一会儿! 你确定这是你想要的吗? 也许你想保留驱动器上的东西? 在这种情况下,您应该停止安装并将重要数据复制到另一个驱动器。 也许你想选择另一种选择。

  9. 单击“继续”按钮(如果系统中只有一个硬盘,则该按钮应显示为“立即安装”)

    出现写更改对话框

  10. 单击继续

    如果只有一个硬盘,安装程序会跳到“你在哪里?” 屏幕。否则,显示“安装类型”屏幕

  11. 如果只有一个硬盘,请跳过几个步骤到“你在哪里?” 屏幕。 否则,在“安装类型”屏幕上,确认在选择驱动器列表中选择的驱动器对应于图表上的驱动器(例如/ dev / sda)。 如果您已卸下内置驱动器,则只有一个驱动器(可用作目标)和外部驱动器。

    选定的驱动器显示在图表上

  12. validation是否已分配完整的驱动器空间

    为安装分配了完整的驱动器空间

  13. 单击“立即安装”按钮

    “你在哪里?” 屏幕显示

  14. 如果您的系统已连接到网络,请注意预选的时区与您的时区和文本框中指示的城市相对应

    显示的时区和城市与您所在地区的时区和主要城市相匹配

  15. 选择您的时区,然后单击继续按钮

    • 出现“键盘布局”屏幕
    • 建议的键盘与键盘对应
  16. 选择键盘布局,然后单击继续

    ‘你是谁?’ 屏幕出现

  17. 输入您的初始用户详细信息和密码。 admin无法使用 – 它是一个专用的Linux用户

    接受姓名,用户名和密码。 显示登录选项和主文件夹加密选项

    继续按钮变为可用

  18. 按继续

    • 将显示“欢迎使用Ubuntu”幻灯片
    • 幻灯片完全以您的语言显示
  19. 等待安装程序完成

    将出现“安装完成”对话框

  20. 单击立即重启按钮

    GUI关闭,出现删除媒体的提示并按Enter键

  21. 取出光盘,然后按enter键

    机器重新启动

  22. 允许机器重新启动

    系统正常启动并加载到Ubuntu中,显示您选择的用户名

  23. 关闭计算机,拔下外部驱动器并从电网中拔下插头。 重新连接(和/或插入)内部驱动器

    • 如果外部驱动器是HDD或SSD,则可以立即使用。

    • 如果外部驱动器是USB挂件或存储卡,最好调整系统以减少磨损 。 请参阅以下链接,

      help.ubuntu.com/community/Installation/UEFI-and-BIOS#Final_system_tweaks

    • 如果你想要一个便携式系统(适用于大多数计算机),你应该三思而后行专用驱动程序(通常用于图形和wifi)。 经典建议是避免安装专有驱动程序,但这意味着具有某些硬件的计算机将无法正常工作(或根本不能)。

      在Ubuntu 18.04.1 LTS中,您可以安装一个nvidia专有驱动程序,使您的计算机使用强大的nvidia卡使用该卡的全部function。 在具有此类图形的计算机中启动时,系统仍将选择Intel或Radeon驱动程序。 但是nvidia芯片会出现问题,这与安装的专有驱动程序无关。 看到这个链接,

      安装Nvidia驱动程序完全安装USB闪存驱动器

我用以下方法做到了:

  • 插入Live CD并插入USB密钥。

  • 选择安装Ubuntu

  • 选择驱动器分区时选择高级

  • 选择USB密钥分区作为目标。

  • 小心:选择GRUB引导加载程序的USB分区。

安装过程结束后,使用USB密钥启动,而不是硬盘驱动器。

1) 通用USB安装程序 :

通用USB安装程序是一个Live Linux USB Creator,允许您从一系列Linux发行版中进行选择,以便将其放在USB闪存盘上。 Universal USB Installer易于使用。 只需选择Live Linux Distribution,ISO文件,Flash Drive,然后单击Install。 其他function包括; 持久性(如果可用),以及fat32格式化闪存驱动器(推荐)的能力,以确保干净安装。 完成后,您应准备好运行可选的Linux版本的可启动USB闪存驱动器。

2) UNetbootin :

UNetbootin允许您为Ubuntu,Fedora和其他Linux发行版创建可启动的Live USB驱动器,而无需刻录CD。 它可以在Windows,Linux和Mac OS X上运行。您可以让UNetbootin为您下载支持开箱即用的众多发行版之一,或者如果您已经下载了一个或者您自己的Linux文件,则可以提供自己的Linux ISO文件。首选分发不在列表中。

3) LinuxLive USB Creator :

LiLi创建了运行Linux的便携式,可启动和虚拟化的USB记忆棒。 您是否厌倦了重新启动PC以尝试Linux? 没有李丽。 它具有内置的虚拟化function,可让您在Windows中直接运行Linux。

上述所有三个程序都允许您将任何Linux操作系统安装到闪存驱动器,但持久性function(允许您保存对LiveOS安装所做的任何更改,即使在重新启动后也可以永久使用)仅适用于Ubuntu及其他许多其他程序口味。

我能够做到的唯一方法是

  • 刻录CD iso,
  • 断开我的硬盘驱动器(物理移除电缆)和
  • 安装到USB。

不是很优雅,但它的工作原理。

你可以,是的。

此过程假定您从live cd安装。 虽然live usb也可以正常工作,但cd选项在理论上是最安全的,因为在分区期间没有机会覆盖cd。

我建议您首先在BIOS中禁用内置硬盘,因为这样可以确保不会意外覆盖内部分区。 此外,Ubuntu设置的分区步骤将更容易,因为它只会检测USB驱动器。 换句话说,最好在安装过程中使USB驱动器成为机器上唯一的存储设备。

接下来,启动live cd并像往常一样启动安装。 如果禁用所有其他存储设备,请确保选择“使用整个磁盘”,否则必须进行手动分区。 在最后一种情况下,在USB记忆棒上创建一个ext4分区(如果没有分区表,则创建一个分区表),如果打算运行繁重的应用程序,则在必要时创建一个SWAP分区。 将安装点设置为/。 请勿触摸其他存储设备及其分区!

当设置要求引导加载程序位置时,请选择USB驱动器的设备名称。 这可以是/dev/sda/dev/sdb等等,但不要选择分区(例如/dev/sda1 )。

等待安装完成,然后重新启动。 确保您的设备从USB驱动器启动。 这可以通过引导菜单(通常是esc或function键)或bios来确定,其中可以更改引导顺序。

如果一切顺利,Ubuntu应该从USB驱动器启动。 如果显示GRUB,请选择第一个选项。

最后,从刚安装的Ubuntu桌面运行以下命令:

 sudo chmod -x /etc/grub.d/30_os-prober 

这可确保update-grub不会检测到系统中可能存在的任何其他操作系统,因为它们与您的Ubuntu USB驱动器安装无关。 此外,当您从一台奇怪的计算机启动USB驱动器时,内核驱动器上的操作系统将在发生内核/ grub更新时包含在GRUB中。 这是不需要的。

此外,请确保从BIOS重新打开内部存储设备。

将Ubuntu完全安装到USB闪存驱动器的过程与在硬盘驱动器上安装Ubuntu相同,除了安装GRUB引导加载程序。 除了安装GRUB引导加载程序之外,Ubuntu安装程序中要遵循的所有步骤都是相同的。 在USB闪存驱动器上安装GRUB引导加载程序将替换您不想要的硬盘驱动器上的现有GRUB引导加载程序,除非启动Ubuntu安装程序之前先断开电缆与硬盘驱动器的连接在USB闪存盘上完全安装Ubuntu。 因此,首先断开硬盘驱动器,然后您可以在USB闪存驱动器上安装Ubuntu。

您也可以在USB闪存驱动器上完全安装Ubuntu,而无需先断开内部硬盘驱动器电缆,方法是在Ubuntu安装程序的安装类型屏幕中选择Something else选项。 您只需要创建一个/分区(根分区),没有交换分区,并将grub引导加载程序的安装更改为USB闪存驱动器。 仔细检查您的分区选择,即只更改USB闪存驱动器上将要更改的所有内容,然后单击右下角的“ 立即安装”按钮。

有关在USB闪存驱动器上完整安装Ubuntu的其他信息。

  • 我建议USB闪存盘至少为16GB。
  • USB 3.0闪存驱动器比USB 2.0闪存驱动器快得多。
  • 交换分区将导致对USB闪存驱动器进行必要的读/写操作,这将降低操作系统的速度并缩短USB驱动器的使用寿命。 因此,在Ubuntu安装程序中选择手动分区选项,并仅创建没有交换分区的单个/分区(根分区)。 在单击右下角的“ 立即安装”按钮之前,将grub引导加载程序的安装更改为USB闪存驱动器。
  • 使用USB闪存驱动器的优势在于其便携性,而不在于其性能。 在16GB USB闪存驱动器上完全安装Ubuntu的性能与在虚拟机应用程序(如VirtualBox)中运行Ubuntu所获得的效果完全不同。

mkusb

Tested on Ubuntu 16.10 host, 16.04 USB, Lenovo Thinkpad T430.

Previously mentioned at: https://askubuntu.com/a/848561/52975 but here are more details.

Only available from PPA currently:

 sudo add-apt-repository universe sudo add-apt-repository ppa:mkusb/ppa sudo apt-get update sudo apt-get install mkusb dus 

and I tried the GUI version. More details at: How to make a persistent live Ubuntu USB with more than 4GB

I couldn’t install NVIDIA drivers successfully however, bug report: https://bugs.launchpad.net/mkusb/+bug/1672184

qemu

Tested on Ubuntu 14.04.

Download the Ubuntu ISO .

Find your USB with:

 sudo lsblk sudo fdisk -l 

Say it is /dev/sdX . Most often it will be /dev/sdb : sda is the main hard disk, and sdb the first USB. Now:

 sudo apt-get install qemu # Remove any existing boot sector, that causes installation problems. sudo dd if=/dev/zero of=/dev/sdX count=16 sudo qemu-system-x86_64 -boot d -enable-kvm -hda /dev/sdX -m 512 \ -cdrom ./Downloads/ubuntu-14.04.2-desktop-amd64.iso 

From inside the emulator, do a normal Ubuntu install that erases the old disk.

Installation took a bit longer than on a hard disk, but worked.

I tested with:

  • plug the USB on a computer and boot from it
  • create a file on my home directory
  • 重启

The created file was still there.

Things have changed since 2011, Nvidia drivers are no longer required for Unity and unlimited persistence using casper-rw/home-rw partitions is possible, (but not with recent Ubuntu syslinux type boots, (SDC, Unetbootin, Roofis, Universal, etc)).

Mkusb is an installer that will fill all of the op’s requirements, (if Nvidia drivers were only needed for Unity).

The user is given a choice of setup options and can select the percentage of space used for the persistent partitions, mkusb will then make remaining disk space available to Linux or Windows as storage. https://help.ubuntu.com/community/mkusb .

If the user does require Nvidia drivers a Full install is required as these drivers load before before persistence during boot

For Ubuntu 12.04 through 16.10 (all currently supported versions and flavors) the documented requirements vary but regardless an 8GB flash media should be sufficient to the task. A 16 GB version doesn’t cost much more and can provide some “running room”. The process itself couldn’t be simpler.

1) Obtain a current ISO in the flavor of your choice

2) Check the hash to insure it’s valid

3) Create a bootable media with the ISO (flash or optical disk)

There are a number of ways of doing this, my preferred method is to either

A) Flash drive method

Use dc3dd to simply duplicate the ISO to a target installer flash drive via the command line with the command sudo dc3dd if=yourisoname.iso of=medianame where yourisoname.iso is the name of the iso you downloaded and checked the hash for previously and medianame is the device name of your flash media. (as in /dev/sdb for example) you can easily determine the device name by checking the output of sudo fdisk -l

要么

B) Optical Disk method

Burn the image to optical disk with your preferred OD image writing software. I’m rather partial to K3b but any optical disk burning software that supports the “Burn image” option should be suitable.

4) Continue to install normally as in:

Boot the installer and select the target flash drive as the target (I use manual partitioning AKA something else so that I can avoid creating a swap partition to reduce writes to the flash media that may cause early demise)

If any part of this process is unclear to you please drop me a comment and I will attempt to clarify. Note that if you are using a flash drive to install from, you’ll need a second flash drive for your target installation.

EDIT: Another option would be to perform a Netboot Installation from the Internet I have not attempted this personally but include it as an option here in an attempt to cover all the options.

If you are careful there isn’t much risk of overwriting the MBR of an existing drive in your system. After booting the live system you can run sudo fdisk -l from the CLI or Disks from the GUI and determine which drive is your valid usb target.

Once installation is complete you should be able to boot from your flash drive on any system with similar architecture simply by selecting your flash drive as the boot device in the BIOS.

It has been described here and in many other places how to install Ubuntu into a USB drive like you install it into an internal drive. It is straight-forward to do it with the standard installer (Ubiquity), if you can disconnect or unplug the internal drive. It works in either UEFI mode or in BIOS mode, the same mode as was booted when installed.

Installed system that boots from UEFI and BIOS mode

But if you want a USB drive with an installed system, that boots in both UEFI and BIOS mode, it is more difficult. I made such systems and prepared compressed image files, that can be installed in linux with mkusb directly, or in Windows in a two step procedure , extraction and cloning (and fixing the GPT). mkusb does it all, including fixing the GPT.

The mkusb Launchpad project is here.

The systems created from these compressed image files are quite portable between computers, not quite as portable as a persistent live system, but more flexible, when you want to update and upgrade the system (kernels, drivers etc).

See the following links and links from them,

help.ubuntu.com/community/Installation/UEFI-and-BIOS

Installed systems with guidus and gparted

You find compressed image files at this link,

phillw.net/isos/linux-tools/uefi-n-bios

Look for the newest files with updated versions of the installed program packages.

If there is a temporary problem to download these compressed image files, you can try the following torrent files,

dd_text_16.04-UEFI-n-BIOS_2017-01-15_intel-4-pendrive-7.8GB.img.xz.torrent

dd_dus-lxde_16.04-UEFI-n-BIOS_2016-12-12_intel-4-pendrive-7.8GB.img.xz.torrent

uploaded at UEFI-and-BIOS/torrent where you also find a short description. [Left]click on the torrent link, get to the attachment page, and there you right-click on the link and select ‘save link as’ to get the torrent file.

 user: guru password: changeme 

dd_text_16.04-UEFI-n-BIOS_2017-01-15:

在此处输入图像描述

dd_dus-lxde_16.04-UEFI-n-BIOS_2016-12-12:

在此处输入图像描述

BIOS METHOD

Following is a step by step how to install 17.10 on a 16GB flash drive with options for separate Home partition and Windows compatible data partition:

  • Create a live USB or DVD using SDC, UNetbootin, mkusb, etc.
  • Turn off and unplug the computer. (See note at bottom)
  • Remove the cover.
  • Unplug the power cable from the hard drive or unplug the hard drive from the laptop.
  • Plug the computer back in.
  • Insert the flash drive.
  • Insert the Live USB or Live DVD.
  • Start the computer, the USB/DVD should boot.
  • Select language.
  • Select install Ubuntu.
  • Select “Download updates while installing” and Select “Install this third-party software”, (optional).
  • Select “Continue”.
  • At “Installation type” select “Something else”. (Full disk encryption is not working with flash drives).
  • Select “Continue”.
  • Confirm target device is correct.
  • Select “New Partition Table”.
  • Click Continue on the drop down.

(Optional FAT32 data partition for use on Windows machine)

  • Click “Free space” and “+”.
  • Make “Size…” about 2000 MB.
  • Select “Primary”.
  • Location = “Beginning of this space”.
  • “Use as:” = “FAT32 file system”.
  • “Mount point” = “/windows”.
  • Select “OK”

  • Click “free space” and then “+”.

  • Select “Primary”, “Size …” = 4500 to 6000 MB, “Beginning of this space”, Ext4, and Mount point = “/” then OK.

(Optional home partition)

  • Click “free space” and then “+”.
  • Select “Primary”, “New partition size …” = 1000 to 6000 MB, Beginning of this space, Ext2, and Mount point = “/home” then OK.

(Optional swap space, allows hibernation)

  • Click “free space” and then “+”.
  • Select “Primary”, “New partition size …” = remaining space, (1000 to 2000 megabytes, or same size as RAM), Beginning of this space and “Use as” = “swap area” then OK.

(Important)

  • Confirm “Device for boot loader installation” points to the root of the USB drive. Default should be ok if HDD was unplugged.
  • Click “Install Now”.

  • Select your location.

  • Select “Continue”.
  • Select Keyboard layout.
  • Select “Continue”.
  • Insert your name, computer name, username, password and select if you want to log in automatically or require a password.
  • Selecting “Encrypt my home folder” is a good option if you are worried about loosing your USB drive.
  • Select “Continue”.
  • Wait until install is complete.
  • Turn off computer and plug in the HDD.
  • Replace the computer’s cover.

Note: You may omit disabling the hard drive if after partitioning you choose to install grub to the root of the USB drive you are installing Ubuntu to, (ie sdb not sdb1). Be cautious, many people have overwritten the HDD MBR as default location for boot loader is sda, any items in the internal drive’s grub will be added to the USB’s grub. You may do an update-grub later.

BIOS/UEFI Full Install

Mkusb makes a great base for many bootable pendrive projects, from grub2 bootable Puppy Linux to multiboot Persistent systems, multiboot Full systems and mixed/hybred Persistent/Full systems.

I used the following method to make a BIOS/UEFI Full install:

Use mkusb to make a Live system on a USB (2GB or larger).

Use mkusb to make a Persistent system on a USB 16GB or larger, using default settings with ~12GB persistence, (remaining NTFS partition is used as Windows accessible data partition).

Open GParted and delete sdb4, the ISO9660 partition and expand sdb5 into the recovered space.

Remove HDD before proceeding further, (optional but recommended, highly recommended in UEFI mode).

Boot Installer drive, select Try.

Insert Target drive

Start Install Ubuntu…

Select Something else.

Select sdb5, (on the target drive), and click Change.

Select Use as: ext4, Format and Mount point: /.

Don’t touch any other partitions (unless adding a /home partition).

Select sdb5 for boot loader installation.

Complete installation.

Cut grub.cfg from sdb5/boot/grub and paste to sdb3/boot/grub, overwriting the existing grub.cfg file.

Boot the target drive and run sudo update-grub, (optional).

I figure this should work on any computer a mkusb built Persistent drive works on.

Please comment if it does not work for you.

Further discussion on creating drive using this method in UEFI mode starting at: https://ubuntuforums.org/showthread.php?t=2213631&page=17&highlight=usb post 169.

Another way to start Ubuntu installation is to get to Grub console from Grub2 Boot Menu. It will fire up installation from Ubuntu ISO file on your HD.

Lets say you have your Ubuntu.iso on 3rd partition of your hard drive

Type c to get to Grub command promt and type the following:

 loopback loop (hd0,3)/Ubuntu.iso 

press “Enter”

 linux (loop)/casper/vmlinuz.efi iso-scan/filename=/ubuntu.iso file=/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash 

press “Enter”

 initrd (loop)/casper/initrd.lz 

press “Enter”

 boot 

press “Enter”

note (hdx,y) – is the partition where your Ubuntu ISO file is

This will fire up normal Ubuntu installation process just like you see it when installing from Ubuntu CD. From there you can choose your USB Flash Drive to install Ubuntu on it.

First prepartition your External drive.
Make a 500MB fat32 partition that is flagged as ESP (EFI system partition) Make a 4GB swap partition. Use the rest of the disk for your / partition. If you want separate /home and/or other partitions make them also.
gparted is good for this step but any partitioning tool will work.

When you install ubuntu, chose manual partitioning . Make sure the ESP and swap partitins on the internal drive and installer drive are set to “Do not use”.
Assign the partitions on your external drive. Then, Install ubuntu.

Now, external media requires /efi/boot/bootx64.efi in the ESP partition order to boot.
So copy /efi/ubuntu/grubx64.efi to /efi/boot/ and rename to bootx64.efi .
If you are using secure boot, /efi/ubuntu/shimx64.efi will need to be copied and renamed.
Note: you will need to temporarily remove the ESP flag in order to make this change.

you should now have a UEFI bootable external drive

I was able to do this using 2 USB’s: one created as a USB Ubuntu installer the normal way (the installer USB), another to be the OS USB.

I recommend to remove your HDD’s first.

  1. Plug in the installer USB, boot into its live desktop
  2. Run the installer, installing to the os USB

Worked a treat!

Now I’ve got an OS USB I can boot from anything! yay.

Here’s what works for me in Ubuntu 18.04, on a new laptop. It’s a Thinkpad T480, dual boot Win 10 & Ubuntu 18.04. I have turned off legacy boot. UEFI is 100% in use.

Installing onto a second drive is a pain because the ubuntu installer clobbers the first EFI partition it sees, which is the one on the internal hard drive, regardless of any attempt you make to specify an alternative location for the EFI partition. So when you try to set the boot partition on the USB drive, you are ignored. It’s a fairly old bug. https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1396379

Summary: To workaround it, disable the internal EFI partition by using gparted to edit its flags immediately before beginning your install. Then the installer won’t find it, and the bug is not tripped. Later, re-enable the flags. This is a trivial step.

The steps I took:

Boot into Ubuntu live USB in the “try first” mode.

Using gparted (you have to install it first): …

  • re-partition your target external drive with a GPT partition table.
  • Make a 500MB partition type FAT32. You may as well also set up the desired partition(s) for your Ubuntu install. You may find it handy to label the desired / partition because when you install you will have three drives: your internal drive, the live image installer drive, and your target drive.

  • After applying those updates, change the flags on the small 500MB partition you just created Tick to turn on boot, esp and hidden.

Before you start the install:

Edit the EFI partition flags on your internal drive. Untick those same three flags. Now, when you install, the installer will see only one EFI partition, on your target device. This is the novel step which I haven’t seen documented elsewhere.

Install: you want the fully manual approach of course, “Something else” on the partitioning stage. If your target drive is mounted as sda then you will be installing the boot loader onto sda1 Now, you will see an EFI partition on drive sda. Edit it and make sure it is type EFI. There should be no other EFI partition, since you turned off the partition flags on your internal drive EFI partition.

Mount your desired target partition for / and do a normal install.

After the install, don’t reboot, but use gparted to reset the flags on your internal drive’s EFI partition.

Now, reboot. Choose your bios boot menu. You should see two Ubuntu choices in the boot menu. I don’t know how to rename one of them, but anyway, mission accomplished.

First of all, make sure that you boot your Installation Media in BIOS (Legacy) Mode, not in UEFI mode.

The problem you have is probably that you installed Ubuntu on your USB flash drive, but GRUB (the bootloader) was installed on the hard drive.

To fix that and install GRUB on your USB drive, you need to select the correct device when installing Ubuntu. When you get to the partitioning screen, you should have a drop-down list in the bottom (I can make some screenshots later if you need). There you can select, what device GRUB should be installed on. Make sure though that you select an entry without a number after /dev/sdx (x can be any letter). Assuming you installed Ubuntu on the /dev/sdc1 partition (you need to check yourself what the correct partition is), you should select the entry starting with /dev/sdc (Without any number behind it) in the drop-down menu. After that, continue with the Installation as usual.

I’ll later add some information on how to revert the Hard Drive to it’s old Bootloader.

EDIT: This seems to be a good start on how to restore your old bootloader (I’d recommend only the first two answers though) Uninstall Grub and use Windows bootloader

I followed the Ubuntu guide on their site.

Cononical recommend this program and I have uses it for every install of Linux to date and the program also writes Grub2 to the installation so all you need to do is select ‘boot from USB’ in your BIOS and go from there.

Here’s the download link too: