How to install Debian from a flash drive

In this article, you will learn how to create a USB flash drive that contains a fully automated installation of the Debian operating system . This installation uses the Wallix system, in addition to the traditional settings. Downloading Linux from a USB flash drive is the most convenient and efficient way to boot today. This installation media will be based on the Debian installer image.

The method described in this article is easy to repeat. In addition, it allows you to use the Debian operating system on removable media. Installing Debian from a flash drive in this case will be based on standard ISO images.

installing Debian from a flash drive

Creating a bootable flash drive

The first step is to prepare the partitions for the USB flash drive, create the file system, and install grub2. If you do not want to completely clear your flash drive, you can use one of its existing partitions, while Grub2 supports the file system on it (if there is enough space).

You can use fdisk, Cfdisk, or your other favorite partition tool. So, create the main partition, at least 2G in size, and set the boot (for example, enter the command / dev / sdb for the flash drive) # cfisk / dev / sdb).

Create the file system in the first section - # mkfs.ext2 / dev / sdb1

linux from flash drive

Then install grub2 # mkdir / mnt / usb

# mount / dev / sdb1 / mnt / usb

# grub-install --root-directory = / mnt / usb / dev / sdb

Grub2 needs to be written via MBR (Master Boot Record) to the first 512 bytes of the flash drive, as this is necessary to copy the boot.img image. In addition, a directory will be created that contains a set of GRUB modules. Later in this directory, create the grub.cfg file.

Now the installation of Debian from the flash drive via HD-media should be performed. This method will look for the ISO image from the Debian installation media. So enter the command # mkdir / mnt / usb / hdmedia-squeeze

After that, use the following:

# wget http://ftp.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/hd-media/vmlinuz -O / mnt / usb / hdmedia-squeeze / vmlinuz

# wget http://ftp.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/hd-media/initrd.gz -O /mnt/usb/hdmedia-squeeze/initrd.gz

# mkdir / mnt / usb / isos

# cp debian-6.0.3-amd64-CD-1.iso / mnt / usb / isos /

To complete the preparation you must provide a configuration file for GRUB:

debian lxde

#set color_normal = 'green / black'

#set color_highlight = 'light-green / black'

# Determine the required route

# / Specify the root directory of the installation disk (/ dev / sdb1)

set isosdir = '/ iso image "

set hdmediasqueeze = '/ hdmedia-' squeeze '

# Then, when installing Debian from a USB flash drive, the program will automatically find the file with the specified parameters.

# Debian installer copies the file system using an HD image

in / HD media.

Set response options = '/ hd-media / preseed'

# Debian lxde manual input is configured as follows:

menuentry 'Debian 6.0 amd64 manual install' {

linux $ hdmediasqueeze / vmlinuz iso-scan / filename = $ isodir / debian-6.0.3-amd64-CD-1.iso priority = critical

initrd $ hdmediasqueeze / initrd.gz

# Automatic input can be entered like this:

menuentry 'Debian 6.0 amd64 automatic install' {

linux $ hdmediasqueeze / vmlinuz iso-scan / filename = $ isodir / debian-6.0.3-amd64-CD-1.iso preseed / file = $ preseed / standard-squeeze.preseed auto = true priority = critical

initrd $ hdmediasqueeze / initrd.gz

Through manual input, the standard Debian installation from the USB flash drive will be booted, through automatic input with installation responses.

The Iso-scan / filename option tells the system where to find the full Debian installation.

To load the guest OS from a USB flash drive, you need to assemble the real device / dev / sdb into a special VMDK file and install / TMP / usb.vmdk as the first SATA disk in the guest panel configuration # VBoxManage internalcommands createrawvmdk -filename / tmp / usb .vmdk -rawdisk / dev / sdb

Shutdown

If you manage to load the Debian installer with manual input correctly, you should now create the Debconf database . This database is used during the installation of Debian, in particular for installing parts. Using a file with parameters, you load predefined conditions for installing programs.

Create a directory in the root of the USB flash drive and copy the settings file by running the following command: # mkdir / mnt / usb / preseed

Then at the command prompt

# cat << EOF> /mnt/usb/preseed/standard-squeeze.preseed

di debian-installer / locale string en_US

di console-tools / archs select skip-config

di time / zone string US / Eastern

You will not need to connect to the network when the download from the USB flash drive occurs.

The above instruction assumes that the target computer has only one hard drive. In addition, in most cases, the flash drive works automatically. If, however, the hard drive is the first to be detected when starting up, you can manually specify the following command: partman-auto / disk and grub-installer / bootdev or use the early_command option to automatically install the device for use.

How to install Debian OS

Now you can proceed directly to downloading the operating system to the computer. However, if you do not want to create a bootable USB flash drive, you can install Debian by using a boot disk.

First, back up important files on your computer. Installing Debian on your machine will require you to erase the entire hard drive and rewrite it again by erasing all data in the process. Store important information on a removable disk before starting installation.

If you did not create a flash drive, download the Debian installation image from the official website that is suitable for your processor architecture. If you do not know what type of processor is installed on your computer, select an image for 32-bit PCs, as it is compatible with standard 32-bit Intel or AMD.

Burn the installation image to a CD or DVD. After you have downloaded the file (it will have the extension .ISO), write it to disk using specialized software. Today, there are several free applications that can perform this task if your computer has a CD-R or DVD-R drive.

Boot the computer from the disc you just burned. After you install the .ISO file to disk, put the media in the optical drive and restart the computer. The machine will boot from disk and take you directly to the Debian installation wizard.

You can experience Debian Live from disk if you wish. Debian OS includes an option that allows you to start the operating system completely from a CD or DVD, without overwriting the information on your hard drive (this option is called Debian Live). Select this option in the installation wizard if you want to check the shell before a full installation. Please note that performance will be rather poor when this option is executed.

Install Debian as instructed by the installation wizard. When you are ready to start the full download, follow the instructions of the installation wizard and make the operating system settings as you wish. You will be given the opportunity to manage hard disk partitions if you want to run Debian with another operating system, such as Microsoft Windows.

If for some reason you cannot download and install installation images for yourself, you can purchase a boot disk on the site. Installing Debian may take some time, so it’s best to do other things while you wait for the download.

Source: https://habr.com/ru/post/C6465/


All Articles