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 run ISO file directly under Ubuntu system

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "how to run the ISO file directly under the Ubuntu system". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Most Linux distributions provide a live environment that can be launched from USB so that users can test the system without having to install it. We can use it to evaluate this distribution or just as an one-time system, and it is easy to copy these files to a U disk, in some cases, we may need to run the same or different ISO images frequently. GRUB 2 can be configured to run a live environment directly from the boot menu without burning the ISO to a hard disk or USB device.

Get and check bootable ISO images

In order to get an ISO image, we should usually visit the website of the desired distribution to download the image file that is compatible with our architecture. If the image can be booted from a USB disk, it should also be bootable from the GRUB menu.

When the image is downloaded, we should check its integrity through the MD5 check. This will output a long sequence of numbers and letters.

Compare this sequence with the MD5 check code provided on the download page, and they should be exactly the same.

Configure GRUB 2

The ISO image file contains the entire system. All we have to do is tell GRUB 2 where to find the kernel and initramdisk or initram file systems (depending on the distribution we use).

In the following example, a Kubuntu 15.04 live environment will be configured to the Grub startup menu item of the Ubuntu 14.04 machine. This should work on most new Ubuntu-based systems. If you are on another system and want to implement something else, you can learn more details from these files, but this will require you to have some experience with GRUB.

The file kubuntu-15.04-desktop-amd64.iso for this example is located on / home/maketecheasier/TempISOs/ in / dev/sda1.

In order for GRUB 2 to find it correctly, we should edit

/ etc/grub.d40-custom

The code is as follows:

Menuentry "Kubuntu 15.04 ISO" {

Set isofile= "/ home/maketecheasier/TempISOs/kubuntu-15.04-desktop-amd64.iso"

Loopback loop (hd0,1) $isofile

Echo "Starting $isofile..."

Linux (loop) / casper/vmlinuz.efi boot=casper iso-scan/filename=$ {isofile} quiet splash

Initrd (loop) / casper/initrd.lz

}

Analyze the above code

First, set a variable name of $menuentry, which is the location of the ISO file. If you want to change the ISO, you should modify the isofile= "/ path/to/file/name-of-iso-file-.iso".

The next line is to specify the loopback device and the correct partition number must be given.

The code is as follows:

Loopback loop (hd0,1) $isofile

Note that hd0,1 is very important here, which means the first hard drive, the first partition (/ dev/sda1).

The naming of GRUB is a little confusing here. For hard drives, it counts from "0", with the first hard disk being # 0, the second being # 1, the third being # 2, and so on. But for partitions, it counts from "1", with the first partition # 1, the second partition # 2, and so on. Maybe there is a good reason, but it is certainly not wise (obviously the user experience is very bad)..

The first hard drive in Linux, the first partition is / dev/sda1, but in GRUB2 it is hd0,1. The second hard drive, the third partition is hd1,3, and so on.

The next important line is:

The code is as follows:

Linux (loop) / casper/vmlinuz.efi boot=casper iso-scan/filename=$ {isofile} quiet splash

This loads the kernel image, and in the new Ubuntu Live CD, the kernel is stored in the / casper directory and named vmlinuz.efi. If you are using another system, you may not have a .efi extension or the kernel is stored somewhere else (you can use the archive manager to open the ISO file and look for confirmation in / casper). The last option, quiet splash, is a regular GRUB option, and it doesn't matter whether you change it or not.

Last

The code is as follows:

Initrd (loop) / casper/initrd.lz

This loads initrd, which is responsible for loading RAMDisk into memory for startup.

Start the live system

After completing all the steps above, you need to update the GRUB2:

The code is as follows:

Sudo update-grub

When the system is rebooted, you should see a new GRUB entry that allows us to start the ISO image we just configured:

Selecting this new entry allows us to start a live environment as if we were from a DVD or USB drive.

"how to run the ISO file directly under the Ubuntu system" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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