Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Ubuntu Linux through USB flash drive

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install Ubuntu Linux through USB disk". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to install Ubuntu Linux through USB disk".

1. Preparatory work

Before you begin, you need to make at least the following preparations:

* an Ubuntu live CD or .iso image file

* U disk with a capacity of at least 1G

* Linux operating system running

two。 Set u disk

First, plug in the U disk and check to see if the device is recognized. To find the device, run the following command:

$sudo fdisk-l

In my system, the drive letter of this device is / dev/sdb. This article takes / dev/sdb as an example. Readers should change it according to the actual situation of their own system (possibly sda,sdc...).

After the system discovers the U disk, it will create a partition.

Note: using the wrong drive letter may damage your hard disk partition, so please enter it carefully.

Create Partition

Uninstall the mounted USB disk:

$sudo umount / dev/sdb1

Then use fdisk, a tool for editing partitions:

$sudo fdisk / dev/sdb

After we delete the partition of the U disk, we create two new partitions on it: a fat file system partition with the capacity of 750MB, which is used to hold the files in the live CD image, and the other partition.

Then enter the format "d x", x is the drive letter of the partition, and enter the following in turn:

* n create a new partition

* p set the primary partition

* 1 set as the first primary partition

* accept the default option or enter "1" to start from the first cylinder

* + 750m set the space to 750MB

* a make the partition a bootable active partition

* 1 Select this partition

* t change the partition format

* 6 set to FAT16 partition

The first partition setting is complete, proceed to the second:

* n to create yet again a new partition

* n create a partition again

* p set the primary partition

* 2 set as the second partition

* enter to accept the default selection

* accept the default choice and use up all capacity

* finally, enter w to make the above changes to the USB flash drive

When the partition is complete, format it.

Format Partition

The first partition will be formatted as the FAT16 file system and the USB disk will be set to self-boot.

$sudo mkfs.vfat-F 16-n liveusb / dev/sdb1

The second partition will be formatted as an ext2 file system with a block length (blocksize) of 4096 bytes, and the volume will be casper-rw (otherwise the goal will not be completed successfully! )

$sudo mkfs.ext2-b 4096-L casper-rw / dev/sdb2

Now you need to copy the live CD image to the USB disk.

3. Install Ubuntu from a USB disk

Mount the Ubuntu live CD image

First, you need to mount the image of ubuntu. There are two ways, through the ".iso" file or on a CD.

Mount from CD

Insert a Ubuntu or other distribution CD into your computer and it will be mounted automatically. Otherwise, you can mount it successfully by doing the following.

$sudo mount / media/cdrom

Mount from an .iso image file

You need to create a temporary folder, take / tmp/ubuntu-livecd as an example, and mount it:

$mkdir / tmp/ubuntu-livecd

$sudo mount-o loop / path/to/feisty-desktop-i386.iso / tmp/ubuntu-livecd

The partition where the USB disk is mounted

Insert the u disk again, and the two partitions will be displayed as / media/liveusb and / media/casper-rw. If this does not happen, you need to mount it manually:

$mkdir / tmp/liveusb

$sudo mount / dev/sdb1 / tmp/liveusb

All the required partitions have been mounted and it's time to copy the files.

Copy files to a USB drive

Find the path of the CD image (in the author's case / tmp/ubuntu-livecd, of course, it may be / media/cdrom), and copy it to the first partition of the u disk as the root partition:

This includes the casper,disctree,dists,install,pics,pool,preseed,.disk directories, all the files in the isolinux directory, and md5sum.txt,README.diskdefines,ubuntu.ico,casper/vmlinuz, casper/initrd.gz and install/mt86plus.

$cd / tmp/ubutu-livecd

$sudo cp-rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus / media/liveusb/

There may be symbolic links that cannot be created, and you can ignore the past.

Let's change the name of isolinux.cfg in the first partition of U disk to syslinux.cfg:

$cd / tmp/liveusb

$sudo mv isolinux.cfg syslinux.cfg

Change / tmp/liveusb according to your settings

Edit the syslinux.cfg file as follows:

DEFAULT persistent

GFXBOOT bootlogo

GFXBOOT-BACKGROUND 0xB6875A

APPEND file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash--

LABEL persistent

Menu label ^ Start Ubuntu in persistent mode

Kernel vmlinuz

Append file=preseed/ubuntu.seed boot=casper persistent initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash--

LABEL live

Menu label ^ Start or install Ubuntu

Kernel vmlinuz

Append file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash--

LABEL xforcevesa

Menu label Start Ubuntu in safe ^ graphics mode

Kernel vmlinuz

Append file=preseed/ubuntu.seed boot=casper xforcevesa initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash--

LABEL check

Menu label ^ Check CD for defects

Kernel vmlinuz

Append boot=casper integrity-check initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash--

LABEL memtest

Menu label ^ Memory test

Kernel mt86plus

Append-

LABEL hd

Menu label ^ Boot from first hard disk

Localboot 0x80

Append-

DISPLAY isolinux.txt

TIMEOUT 300

PROMPT 1

F1 f1.txt

F2 f2.txt

F3 f3.txt

F4 f4.txt

F5 f5.txt

F6 f6.txt

F7 f7.txt

F8 f8.txt

F9 f9.txt

F0 f10.txt

Set the USB disk to bootable

To complete this step, you need to install syslinux:

$sudo apt-get install syslinux

Finally, uninstall / dev/sdb1 and make it bootable:

$cd

$sudo umount / tmp/liveusb

$sudo syslinux-f / dev/sdb1

Restart, set the BIOS to be bootable from the USB disk, and you can enjoy the Ubuntu on the USB disk!

4. Troubleshooting

If you cannot boot from the USB drive, it may be because the master boot record (MBR) is corrupted. You can use lilo to fix this problem:

The MBR on $lilo-M / dev/sdb/dev/sdb will be repaired.

Thank you for your reading, the above is the content of "how to install Ubuntu Linux through USB disk". After the study of this article, I believe you have a deeper understanding of how to install Ubuntu Linux through U disk, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report