I want to install Debian directly onto my USB drive. Is there an easy way to do this directly without having to reboot to run the installer?
Copy a live cd iso using dd.
This doesn’t really install it, though, you can’t update or permanently edit and config, set up users, or anything like that. I would guess OP wants something more like booting the ISO in a VM, allocating a thumb drive to that VM, and then installing a full system to it with a boot loader.
So the lower-ish difficulty answer would be to run the iso installer in a VM with the usb stick forwarded to that VM.
Or you can learn what those fancy installers do: on debian you would use debootstrap
Here seems the whole guide on how to install debian manually with it:
https://gist.github.com/tr3buchet/6407920
Btw, this is also basically how you install Arch. As of until recently there wasn’t any installer and you had to go through each step manually (create partitions and fs, install the base system with <insert distro specific tool>, chroot, update fstab, distro specific finishing touches, voilà)
Depending on what OP actually wants to do it might be simpler to just install Linux normally in a VM. I recommend Hyper-v if you are using Windows Pro and if you are using Windows Home I recommend upgrading to Pro using MAS scripts or using a workaround to install Hyper-V on Home.
You could also use a hypervisor like virtualbox but they are type 2 hypervisors which are usually slower compared to type 1 like Hyper-v or KVM.
I used to have a SanDisk Extreme Portable running Ubuntu. If it was unplugged, my computer would boot Windows and when I plugged in the SSD to USB it would auto boot into Ubuntu. I have no idea how I did it though. It was my first time using Linux and I followed a guide online.
Edit: found the video
I installed from one flash drive with the image (on ventoy) to another flash drive that was plugged in to be the boot drive. On a cheap USB2 drive, it’s unusably slow - so make sure you use the fastest drive you can
+1 for “it’s unusably slow!”
I tried this last year with Linux Mint, and I learned that a normal USB drive just doesn’t have the read/write speed to even e.g. operate Firefox smoothly. There are different ways to address that, none of which really did the trick for me, so the best bet is to just get a drive with the fastest read/write rate possible. I’ve heard that it can run tolerably well on one of those more performant drives, but I didn’t try it myself.
PenDriveLinux or rufus or balena etcher (frequently just referred to as “etcher”) or just dd.