Join Scott Simpson for an in-depth discussion in this video Foundations: USB installer, part of Linux Tips Weekly.
- [Instructor] If you want to install Linux on a computer directly, what we'd call a native or bare metal installation, you'll need to get the installation disk image onto something that a computer can boot up from. While the disk image that we've downloaded from a distro's website is for an optical disk, like a DVD-ROM, many computers these days don't have an optical disk drive. Instead we can put the contents of the installation disk image onto a USB thumb drive. USB thumb drives are fairly inexpensive. In the case of the Ubuntu 1804 installer, we'd need one that can hold two gigabytes, which is pretty common.
A brand new two gigabyte flash drive can be had for about $7 US, and you may already have one in a drawer somewhere. If your drive is USB 3 and the computer you're using to make the installer has USB 3 you might have time to skim your Twitter feed while the process completes. If it's USB 2 plan to enjoy a cup of coffee or something during the imaging process. And if you're using an older USB 1.1 drive, plan to spend some time watching your favorite TV show while the process completes. In the process of making the flash drive installer, everything on the USB disk will be erased.
So if you have a flash drive you plan to reuse as an installer, make sure you don't have anything important stored on it. In this episode I want to show you how to use the Ubuntu installation ISO to create a USB installer on a Linux machine, on Windows, and on a Mac. The process for each is different but will end up with the same result. If you're using another distro though, the steps for the distro's ISO will be the same. I'm just using Ubuntu here because that's what the series focuses on and because I've already downloaded the image for the architecture of my target machine, which is 64 byte or x86-64.
If you're using a pretty old computer you might need to find a 32 byte installer image which may not be available from newer distros. And if you're using a different architecture you'll need to get an image for that instead. If you're going to be installing Linux on an older computer make sure your flash drive is set up with an MBR or MS-DOS partition table. If you're using a newer system your drive can be GPT. The installer I make here will be using the MBR partition table because it'll boot on older systems as well as many newer ones.
Let's start out making an installer using a Linux machine. I have the ISO file downloaded here in my downloads directory. And I have my flash drive plugged in. To complete this process we'll need to know the device identifier of the flash drive. So to find that out I'll write lsblk to list the block devices on the system. Here I can see my eight gig flash drive is serial disk b, or sdb.
We'll be replacing this partition so you'll want to make sure that it's unmounted. To do that you can write umount /dev/sdb1 in this case. But mine's not mounted. Now in order to write the file to the disk we'll write sudo dd if, for input file, equals the path to the ISO image. And then of for output file equals dev/sdb.
That's serial disk b. And so we can keep an eye on the process, I'll write status=progress. And I'll press enter. Here in my system this will take about five minutes. Depending on the speed of your hardware yours could go faster. And when that's done I have an installer. I can unplug the disk and then I'm ready to use this to install Ubuntu on another machine.
To create an installer from Windows I'll use software called Rufus. I'll scroll down and click to download the latest version. Once that's downloaded I'll find it in my downloads folder and click to open it up. I'll make sure that my flash drive is plugged in and selected, and then I'll click the select button to choose the ISO image that I want to put on this disk. Here's my installer. I'll click it and I'll press open.
I'll leave the rest of these options alone and I'll click start. Rufus needs to get more software. So I'll click yes to let it do that. It's asking what mode I want to use. And I'll choose the recommended mode. And then I'm warned that all the data on this device will be destroyed. I want to continue so I'll press OK. When the process finishes you can close Rufus and eject the installer.
Now we're ready to use that drive to install Linux. Creating a USB installer on a Mac is a two-step process. The first step is to convert the ISO image into a different format. And then we'll use that converted disk image to write onto the USB stick. I'll switch over to my terminal and double check that I have an installer. There it is in my downloads folder. To convert the image I'll write hdiutil convert -format UDRW.
Then I'll give the path to the image. And I'll write -o for output. And I'll set the name to ubuntu1804. The second step is to get that image onto our USB drive. And for that we need to know where the USB drive is. So I'll switch over to disk utility and I'll click on the USB flash drive.
I'll make sure I'm choosing the device, not a partition. Then I'll press info and I'll look for the BSD device node. In my case it's disk one but yours may be different. Then I'll click on any mounted partitions and choose to unmount them. I'll switch back to my terminal and here I'll write sudo dd if, for input file, equals the path to my converted disk image.
In this case, ubuntu1804.dmg. And then of, for output file, equals /dev/rdisk1. Again, yours might be different. Make sure you have the right identifier. You wouldn't want to overwrite the wrong disk. And then I'll write bs=1m. This can help things go faster. After a few minutes the process will complete. You'll know it's done because you'll see an error pop up on the screen that the disk that we inserted wasn't readable by this computer.
That's actually a good sign. That means that the Linux file system is in place. So I'll choose eject and I'll unplug my drive. Now we're ready to use this to install Linux. It's handy to have a USB installer around, so when you're done using it consider throwing it into your computer stuff drawer for later. The installer can act as a live boot environment, which can be useful for troubleshooting a computer if it's primary operating system doesn't boot. And it saves the time of creating an installer again when you need one.
Note: Because this is an ongoing series, viewers will not receive a certificate of completion.