如果您急于回复,系统→管理→启动磁盘创建器-不,这不是我在说的。
我想在不触及现有 Ubuntu 安装的情况下尝试 Ubuntu 11.04 的 Unity。
为此,我需要先安装 nVidia 驱动程序(叹气)。
为此,我需要进行更改以保持重启。
为此,我需要在 USB 密钥上真正安装 Ubuntu。
你是怎样做的?
我试过的
我尝试从Testdrive制作一个 USB 密钥,然后从它启动,然后选择“安装 Ubuntu”。安装程序拒绝安装到安装介质本身。
我从我安装的 Ubuntu 副本中尝试过:
sudo kvm /dev/sdb --cdrom .cache/testdrive/iso/ubuntu_natty-desktop-i386.iso
...但安装程序没有正确检测到磁盘。
Ubuntu/Linux 解决方案
1.获取最新图片
您应该使用testdrive 执行此操作。
笔记。如果您的密钥小于 4.4 GB(对于 Ubuntu 11.04 (Natty Narwhal)),您必须获取备用安装程序。如果可用磁盘空间少于 4.4 GB,桌面安装程序将拒绝继续。
2. 格式化U盘。
如果您的磁盘上已经有任何看起来像 Linux 安装的东西,或者安装程序出于某种原因不想接触该磁盘,这很重要。我之前失败了,因为我没有执行这一步,所以跳过你自己的风险!您需要一个至少 3 GB 大小的密钥。
您可以从System → Administration → Disk Utility执行此操作。选择目标 USB 密钥,卸载所有分区,然后选择格式化驱动器。
在格式化磁盘之前,您需要确保选择“不分区”。
3.在U盘上启动虚拟机
我确定(用
file
)我的 USB 密钥在 中/dev/sdb
,然后运行:...安装 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 设置才能使其正常工作。
关于 USB 上的 Ubuntu 的一个很好的(或烦人的,取决于您的用例)的事情是,下次它会刷新 GRUB,它还会检测并添加到 HDD 上的内核和操作系统的列表中。这应该可以让您从 USB 密钥的 GRUB 直接启动到您的 HDD。
使用 Virtual Box 将 Ubuntu 安装到可移动 USB 驱动器
为了将 Ubuntu 安装到便携式外部 USB 驱动器(磁盘或记忆棒),我们还可以使用Virtual Box从虚拟环境进行安装。USB 2.0 支持闭源但需要免费的 PUEL 版本的 Virtual Box。
为安装直播环境创建虚拟机:
我们为 Linux/Ubuntu 环境(32 位或 64 位,取决于安装介质)创建一个虚拟机:
由于我们要安装到 USB 驱动器,因此我们不会通过取消选中以下窗口中的框来为此机器创建虚拟硬盘 (VDI):
然后我们需要分配系统内存(例如 1024 MB)、图形内存(例如 128MB),并根据我们的主机硬件调整 CPU 设置。此外,我们可能希望创建一个桥接网络,以便能够在安装期间下载文件。
将安装光盘挂载到虚拟机:
在 Virtual Box Manager 的Storage菜单中,我们选择安装 CD 的 .iso 映像作为 CD 驱动器挂载。确保虚拟机的引导顺序设置为从 CD 引导。
将U盘挂载到安装环境
启动虚拟机后(需要先设置USB 支持)以启动安装 CD,我们需要通过单击底部面板中的小图标或从设备 -> USB 设备菜单中选择来安装 USB 驱动器虚拟盒管理器。
这是在我们继续之前需要安装 USB 驱动器的时候
对 USB 驱动器进行分区和格式化
在选择了其他东西之后,图形分区管理器 GParted 将引导我们完成分区过程:
我们至少需要一个带有挂载点根 (
/
) 的分区。在上面的示例/home
中,创建了一个附加分区。通过取消勾选格式,我们保留了可能已经存在的数据。USB/swap
记忆棒或便携式驱动器可能不需要分区。通过选择立即安装,我们开始安装到我们的 USB 驱动器。考虑到此安装可能需要比我们习惯的时间更长的时间。
安装完成后,我们可以使用全新的操作系统卸载我们的驱动器并从任何其他机器启动以根据我们的需要对其进行自定义。
在我的网站上查看本指南和视频,了解如何将 Ubuntu 安装到 USB 驱动器。它将帮助您完全按照您的意愿行事,而且非常简单。
如何将 Ubuntu 安装到 USB 驱动器
将 Ubuntu 安装到外部硬盘驱动器或 USB 记忆棒是安装 Ubuntu 的一种非常安全的方法。如果您担心对计算机进行更改,这是适合您的方法。您的计算机将保持不变,并且在没有插入 USB 的情况下,它将正常加载您的操作系统。当您连接并从 USB 驱动器启动时,您可以选择加载 Ubuntu 或您常用的操作系统。
将 Ubuntu 安装到 USB 驱动器需要一台计算机、一个 Ubuntu live CD/USB 和一个 USB 驱动器。8 GB 是功能和可用系统的最小推荐大小(尽管 4 GB 是最小值)。我们建议使用外部硬盘和至少 20 GB。
建议对 USB 驱动器进行分区,但不是必需的,前提是您有 2GB 或更多 RAM。可以使用“磁盘实用程序”从 Ubuntu live CD/DVD 或安装分区菜单进行分区。
我们建议使用 Live CD/DVD 并拔下任何其他 USB 驱动器,因为这样可以让生活更轻松。我们将假设您在本指南中使用未分区的 USB 驱动器和 CD/DVD。
如何将 Ubuntu 安装到 USB 驱动器
插入 Ubuntu Live CD/DVD,打开计算机并使用“BIOS”告诉它从 CD/DVD 启动。加载需要几分钟,您将看到两个选择。“尝试 Ubuntu”或“安装 Ubuntu”,您应该选择“安装 Ubuntu”,然后您将看到许多选项。您需要选择底部选项“其他”。
这将带您进入分区菜单。您的主硬盘驱动器将被列为“Sda”,然后是其上的任何分区,如 Sda1 或 Sda2。下面是您的 USB 驱动器,它将被列为“Sdb”。单击驱动器上唯一的分区“Sdb1”,然后选择“更改”。
您需要选择“将此分区用作 Ext4 文件系统”(某些发行版如 Mint 要求您此时手动选择“格式”)。然后您需要将“挂载点”设置为“/”,即根文件系统,然后单击“确定”。您将返回上一个菜单,并且该分区旁边将有一个勾号。现在单击该分区上方的“Sdb”,将其选为要安装到的设备。
现在下面是安装引导加载程序的选项。更改此选项非常重要。必须将引导加载程序安装到列为“/dev/Sdb”的设备上。如果您不这样做,引导加载程序将安装到您的内部驱动器。您现在已准备好安装到外部设备,只需单击“安装”。
您需要回答一些简单的问题,例如“姓名”和“创建密码”,然后您就可以高枕无忧了。
附加信息
每次要使用 USB 设备时,您都需要告诉 BIOS 从 USB 设备启动。您可以在 BIOS 中轻松地将 USB 设置为您的第一个启动设备,如果未连接该设备,您的正常系统将加载。如果您的 USB 安装需要 3 或 4 分钟才能完全启动,请不要感到惊讶,尤其是在使用便宜的 USB 记忆棒时。如果您选择从 USB 驱动器而不是 CD/DVD 安装,或者您连接了多个硬盘和 USB 驱动器,则需要确保安装到正确的设备,因为它可能不是 sdb。
确保安装到正确设备的最简单方法是使用磁盘实用程序。在连接设备之前打开磁盘实用程序并记下左侧的设备。然后连接您的设备,它应该出现在列表的底部。单击该设备并查看窗口右上角的“设备”。它会说“设备:dev/sdc”之类的内容,因此“sdc”将是您需要安装到的设备。
Step-wise instructions for installed system in a USB drive
Introduction
The main part of this step-wise instruction is borrowed from the iso testing tracker and this link,
and I have added some extra steps necessary for the installation to an external drive.
Please notice that you will install a system, that works in the current boot mode,
It is more complicated to create an installed system, that will work both in UEFI and BIOS mode, but it is possible according to the following link and links from it,
A portable installed system, that boots both in UEFI and BIOS mode
If you intend to install into a USB pendrive or memory card, choose a fast USB 3 pendrive or a high-speed card. See this link and links from it,
help.ubuntu.com/community/Installation/FromUSBStick#Notes_about_speed
If you intend to use the external drive in new and middle-aged computers, I can recommend that you install from an Ubuntu 64-bit 'amd64' iso file.
If you intend to use the external drive in old computers (as well as newer computers), I can recommend that you install from a 32-bit 'i386' iso file with an Ubuntu family flavour with a lighter desktop environment than standard Ubuntu,
These 32-bit systems will work with 32-bit and 64-bit computers but only in BIOS mode, when installed according to the instructions [in this answer].
It is possible to create a persistent live system, that works in
If this is what you want, the following link may help you,
mkusb/persistent#Compressed_image_file_with_a_persistent_live_system
Instructions
When the computer is shut down and disconnected from the power grid, disconnect (and/or unplug) the internal drive(s). In some computers it is possible to disable the internal drive via a menu of the UEFI-BIOS system.
This makes the installer treat the external drive, where you want to install Ubuntu, like it were an internal drive (and the installer cannot tamper with the internal drive).
Plug in the Ubuntu boot/live/installer drive (DVD disk, USB drive, memory card) and boot the computer from it.
Proceed in your native language if you wish.
Boot up the image
The system boots properly and loads the installer displaying the Welcome dialog with language selection and 'Try Ubuntu' and 'Install Ubuntu' buttons
Connect the external drive (HDD, SSD, pendrive, memory card) where you want to install Ubuntu, the target drive. Plug in external power to this drive if possible. It might not be enough with the power from the computer's USB plug.
Click on the Install Ubuntu icon
The 'Preparing to install Ubuntu' screen is displayed
On the screen Preparing to install Ubuntu, note the availability of the following components
Available options should represent the state of your system accurately
Click on the continue button
The 'Installation type' screen is displayed
Select Erase disk and install Ubuntu
Installation screen expands to include encryption and LVM options
Wait a while! Are you sure that this is what you want? Maybe you want to keep something that is on the drive? In that case you should stop the installation and copy the important data to another drive. Maybe you want to select another alternative.
Click on the continue button (if there is only one hard disk in the system, the button should read 'Install now')
Write changes dialogue appears
Click continue
If there is only one hard disk, the installer skips to the "Where are you?' screen. Otherwise, the 'Installation type' screen is displayed
If there is only one hard disk, skip a couple of steps to the 'Where are you?' screen. Otherwise, on the 'Installation type' screen verify that the drive selected on the Select drive list corresponds to the drive on the chart (e.g /dev/sda). If you have removed the internal drive(s), there should be only one drive, that is available as a target, your external drive.
Selected drive is displayed on the chart
Verify that the full drive space is allocated
Full drive space is allocated for installation
Click on the Install Now button
The 'Where are you?' screen is displayed
If your system is connected to the network, note the preselected timezone correspond with your timezone and the city indicated in the text box
The timezone and city displayed match your timezone and the main city from your area
Select your timezone, and click on the continue button
Select your keyboard layout and click on continue
The 'Who are you?' screen appears
Input your initial user details and password.
admin
can not be used - it is a dedicated Linux UserName, username and password are accepted. Login options and home folder encryption choices shown
Continue button becomes available
Press continue
Wait for the installer to finish
An 'Installation Complete' dialog appears
Click the Restart now button
GUI is shut down, a prompt to remove media and press Enter appears
Remove the disc and press enter
The machine is rebooted
Allow the machine to reboot
The system boots properly and loads into Ubuntu showing the username that you selected
Shut down the computer, unplug the external drives and unplug it from the power grid. Re-connect (and/or plug in) the internal drive(s)
If the external drive is an HDD or SSD, it is ready to be used now.
If the external drive is a USB pendrive or memory card, it is a good idea to tweak the system to reduce wear. See the following link,
help.ubuntu.com/community/Installation/UEFI-and-BIOS#Final_system_tweaks
If you want a portable system (that works in most computers), you should think twice about proprietary drivers (typically for graphics and wifi). The classic advice is to avoid installing proprietary drivers, but it means that computers with certain hardware will not work well (or at all).
In Ubuntu 18.04.1 LTS you can install an nvidia proprietary driver, that makes your computer with a powerful nvidia card use the full power of that card. The system will still select an Intel or Radeon driver, when booted in a computer with such graphics. But there will be problems with nvidia chips, that do no work with the installed proprietary driver. See this link,
Install Nvidia drivers Full install USB flash drive
Edit:
If you cannot disconnect/remove an internal drive there are workarounds:
Disable the internal drive in an UEFI/BIOS menu. This works in several but far from all computers.
The flag method
a. Make a note on paper of the flags of the EFI partition in the internal drive
b. Remove the flags from the EFI partition in the internal drive (for example with
gparted
, when booted from a live drive)c. Perform the installation
d. Restore the flags to the EFI partition in the internal drive (with
gparted
booted from a live drive).This flag method is described in detail by @Tim Richardson in this answer to our common question.
如果您谈论的是实际安装,例如完整的 Ubuntu 安装,而不仅仅是 Live USB 类型,那么您可以使用通过 USB 插入的外部硬盘驱动器并通过以下方法安装到该驱动器。
请注意:以下步骤已使用 Ubuntu 9.10 版本进行测试,但尚未使用更高版本进行测试。使用风险自负并自行决定。
你需要什么
该怎么办
但是,如果您只是想要一个 Live USB,那么您可以使用通用 USB 安装程序或 Ubuntu USB 启动磁盘创建器...
老答案,不要再使用了!
我使用以下方法做到了:
插入 live CD 并插入 USB 密钥。
选择安装 Ubuntu。
选择驱动器分区时选择高级。
选择您的 USB 密钥分区作为目标。
注意:为 GRUB 引导加载程序选择 USB 分区。
安装过程结束后,在您的 USB 密钥上启动,而不是在硬盘上启动。
1)通用 USB 安装程序:
Universal USB Installer 是一个 Live Linux USB Creator,它允许您从一系列 Linux 发行版中进行选择以放入您的 USB 闪存驱动器。通用 USB 安装程序易于使用。只需选择 Live Linux 发行版、ISO 文件、您的闪存驱动器,然后单击安装。其他功能包括;持久性(如果可用),以及 fat32 格式化闪存驱动器的能力(推荐)以确保全新安装。完成后,您应该准备好运行安装了您选择的 Linux 版本的可启动 USB 闪存驱动器。
2)UNetbootin:
UNetbootin 允许您为 Ubuntu、Fedora 和其他 Linux 发行版创建可启动的 Live USB 驱动器,而无需刻录 CD。它可以在 Windows、Linux 和 Mac OS X 上运行。您可以让 UNetbootin 下载开箱即用支持的众多发行版之一,或者如果您已经下载了一个或您的首选分布不在列表中。
3) LinuxLive USB 创作者:
LiLi 创建了运行 Linux 的便携式、可启动和虚拟化 U 盘。您是否厌倦了必须重新启动 PC 才能尝试 Linux?不需要莉莉。它具有内置的虚拟化功能,可让您在 Windows 中运行您的 Linux,开箱即用。
上述所有三个程序都允许您将任何 Linux 操作系统安装到闪存驱动器,但持久性功能(允许您永久保存对 LiveOS 安装所做的任何更改,即使在重新启动后也可以使用)仅适用于 Ubuntu 及其许多其他口味。
OP asks for "without touching my existing Ubuntu install." My answer describes how to get this working, with a real install, not a persistent live USB install. Persistent installs are pretty fragile, and updating the kernel is hard. A real install is better.
If you want to boot from your external device, not just install Ubuntu on it, you need to work around an installer bug which rewrites your boot partition on your internal drive and does not install an EFI boot partition on your external device, no matter what you tell the installer. If you don't do this, you will still end up with an install on your target usb stick, but it will only work on this computer, because it won't have its own boot partition. The EFI partition is part of the drive that the BIOS looks for when it is starting. If a drive has no EFI partition, it can't be a boot drive. If a USB stick or external drive does not have an EFI partition, you can still install Ubuntu to it, but it will need a "bootable" drive to actually launch. So if you want a USB stick or external drive that you can take from computer to computer and boot independently, that drive must have its own EFI partition.
Here's what works for me in Ubuntu as recently as 21.10.
Tested on various laptops. I have turned off legacy boot. UEFI is 100% in use (this will be the default setting on anything sold in the last five years).
I turn off secure boot in BIOS.
Installing onto a second drive is a pain because the ubuntu installer uses 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 bootload device to your target USB drive, you are ignored. It's a fairly old bug, but as of 21.10 release, still present.
The bug means you won't get an EFI partition on your USB stick even when you asked for it, so you can't boot from it.
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. It is almost the logical equivalent of physically disconnecting the internal drive, which for sure also works around the installer bug.
The steps I took:
Before you start the install: You'll need a standard ubuntu live USB device, and a target usb stick to install to.
Boot into Ubuntu live USB in the "try first" mode.
Using gparted (you may have to install it first, sometimes Ubuntu doesn't include it on the live disk,): ...
re-partition your target external drive with a GPT partition table. GPT partition tables are needed for a UEFI (modern) bootable drive.
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. Right click on the small partition, and Manage Flags. These changes are actioned immediately (but note, you must actually create the partition first by completing the previous step) Tick to turn on boot, esp and hidden.
Install
You have booted with a live-disk USB image, as per a normal ubuntu install. So you have two USB devices: your target device, and the live-disk USB drive.
Edit the EFI partition flags on your internal drive and untick those same three flags that you set on the target device EFI partition. This will stop the Ubuntu installer for using it as the boot partition.
Here is a short video doing the flag editing in gparted: https://youtu.be/sdgrmylH6pc
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.
Begin an ubuntu install. Proceed until you see the disk setup tab of the installer. You want the fully manual approach of course, "Something else" on the partitioning stage.
You specify the way the boot loader is installed when doing the install. If your target drive is mounted as sdc and the EFI partition you made is therefore sdc1 (the first partition), then you will be installing the boot loader onto device sdc, and the EFI partition will be sdc1.
Scroll to find that partition. It should say "efi" in the Type column. Click "change" to be sure: The installer should say "Use as: EFI System Partition". You won't actually be changing anything. No need to format it.
As you scroll through the partitions, review the Type column. There should be no EFI partition on your internal drive, since you turned off the partition flags on your internal drive EFI partition. Of course, the partition still shows up as a FAT32 partition. That's ok.
You will also see the EFI partition of the live disk you booted from to do the install, that's ok. The installer is smart enough to ignore that.
Choose your desired target partition for / (sdc2, perhaps,... whatever you already made above) and do a normal Ubuntu install.
After Install
Restore flags on your internal EFI partition
After the install, reboot to the new installation on the USB stick. You will need to use your BIOS "select boot device" option because the computer needs to use the boot partition you just made, which it has never seen before. On my Thinkpads, F12 is the shortcut to this part of the BIOS menu.
You should see several choices of boot drive in the boot menu, and one of them is the external drive. Some bios menus show the default label as 'ubuntu' so it's a bit confusing to see it more than once. Sometimes changing the boot device causes the BIOS boot to restart (it does on my Thinkpad), it looks like something bad happened, but it's ok.
Later when you boot without your USB stick, the bios should be smart enough to revert to the last known good EFI device (your internal device), but you may need to reselect an EFI boot choice manually.
Tip: How to re-label the USB boot entry to avoid duplicate 'ubuntu' entries
If you get duplicate EFI boot options labelled ubuntu, you can fix it. Relabelling EFI menu options is very handy, but a bit tricky. Do this once you are booting ok from your new install. This step is optional.
Make sure you boot into the installation on your external drive, then
sudo efibootmgr -v
You are booted from the first row in the list.
Note the name of the file used to boot, and note the number of the partition. my output for the first entry is:
HD(1,GPT,...) .... File(\EFI\ubuntu\shimx64.efi)
and then have a look at this thread: https://www.kubuntuforums.net/showthread.php/68851-Labels-on-UEFI-Boot-Entries-using-efibootmgr-L
I did this to relabel mine 'owcUbuntu':
efibootmgr -c -d /dev/sdb -p 1 -L owcUbuntu -l \\EFI\\ubuntu\\shimx64.efi
knowing that the boot drive in my case is sdb and since I made the EFI partition first, the value of the -p argument is 1. Note: please check what your actual boot disk is :) use gparted or df
USB 3 Recommendation: I have tried this on a range of USB 3 sticks. The best experience by far (very far) has been the Samsung USB 3 "Bar" sticks. They are really fast (for USB 3 sticks) in this use-case (random access, ext4 partitions with journalling) and quite robust.
我能够做到的唯一方法是
不是很优雅,但它有效。
你可以,是的。
此过程假定您是从 live cd 安装的。虽然 live usb 也应该可以正常工作,但 cd 选项理论上是最安全的,因为在分区期间没有机会覆盖 cd。
我建议您首先在 BIOS 中禁用内部 HDD,因为这样可以确保不会意外覆盖内部分区。此外,Ubuntu 设置的分区步骤会容易得多,因为它只会检测 USB 驱动器。换句话说,最好在安装过程中让 USB 驱动器成为机器上唯一的存储设备。
接下来,启动 live cd 并像往常一样启动安装。如果您禁用了所有其他存储设备,请确保选择“使用整个磁盘”,否则您将不得不进行手动分区。在最后一种情况下,在 U 盘上创建一个 ext4 分区(如果没有分区表,则创建一个分区表),如果您打算运行繁重的应用程序,如有必要,创建一个 SWAP 分区。将挂载点设置为 /。不要触摸其他存储设备及其分区!
当安装程序询问引导加载程序位置时,请选择 USB 驱动器的设备名称。这可以是
/dev/sda
,/dev/sdb
, 等等,但不要选择分区(例如/dev/sda1
)。等待安装完成,然后重新启动。确保您的机器从 USB 驱动器启动。这可以通过启动菜单(通常是 esc 或功能键)或从可以更改启动顺序的 bios 中确定。
如果一切顺利,Ubuntu 应该从 USB 驱动器启动。如果出现 GRUB,请选择第一个选项。
最后,从新安装的 Ubuntu 桌面运行以下命令:
这确保 update-grub 不会检测到系统上可能存在的任何其他操作系统,因为它们对于您的 Ubuntu USB 驱动器安装无关紧要。此外,当您从一台陌生的计算机启动 USB 驱动器时,当发生内核/grub 更新时,其内部驱动器上的操作系统将包含在 GRUB 中。这是不希望的。
此外,请确保从 BIOS 重新打开内部存储设备。