Linux From Scratch Live Cd Tutorial

Posted By admin On 10.04.20
Linux From Scratch Live Cd Tutorial 8,0/10 8748 reviews

Linux, it’s a word that makes many a non-geek’s eyes glaze over almost immediately. However, desktop Linux offerings are now pretty much on par with the big names such as Windows and MacOS.

Thanks to decades of community work and support from organizations like Canonical, you can download something like Ubuntu Linux today and do almost all the things you can with Windows. All without needing a degree in computer science. Modern desktop Linux distros look good, work well and are suitable for average users.

However, they have one huge differencecompared to commercial operating systems – Open Source licensing.

This means we have full access to all theinner workings of Linux. You don’t have to pay to use it and you can customizeit in just about any way you like. That’s great for power users who like totinker with the nut and bolts, but what if you just want to preserve your owntweaked custom Linux installation?

You can actually create a fresh install of Linux, set it up just the way you want it and then turn it into a live, bootable installation. This is super-useful for a few reasons. First of all, it means you won’t have any downtime if you have to reinstall your operating system.

Download the Official LFS LiveCD. That are under development. The scripts will allow you to automate the entire process of building an official cd from scratch. Aug 17, 2018  The provided scripts were created based on the instructions from Linux From Scratch and Beyond Linux From Scratch. If you’ve ever attempted to build you own Linux distribution, you probably know how challenging it can be. AryaLinux has made that process quite a bit less stressful.

All your settings and software will already be waiting right from the start. It also makes it very easy to create custom installations for distribution. Let’s say you have to install Linux on a whole computer lab full of PCs and then install educational packages. Using a custom distribution tool means you only have to do that customization once and then simply install as usual.

The LFS system will be built by using an already installed Linux distribution (such as Debian, Mandriva, Red Hat, or SUSE). This existing Linux system (the host) will be used as a starting point to provide necessary programs, including a compiler, linker, and shell, to build the new system. Learn Linux OS from scratch with this step-by-step online Linux tutorial. Get started with this course today to become a professional Linux System Administrator.

One of the easiest tools out there is calledLinux Live Kit and we’re going to look at exactly how you can change anexisting Linux installation back into a custom distro.

Setting Up The Machine

In order to use the Linux Live Kit, you needan installation of Linux to customize. While you can go ahead and do it withyour main installation, it’s not the most practical approach if you want tocreate customized distributions for something other than your main computer.

So what we’ll be doing is installing UbuntuLinux to a VirtualBox virtual machine. That gives us a clean, controlledinstallation environment. It also means you can make custom Linux distros froma Windows machine if you like. Finally, it’s a good way to test the distroyou’ve just created, to make sure it works properly.

We are going to use the following components:

  • Windows 10
  • VirtualBox
  • Ubuntu 18 LTS

Remember, the process works exactly the sameif you use the Linux Live Kit on a Linux installation that running as normal ona computer, rather than in a virtual machine.

Installing Linux

The first thing to do is install Linux.Obviously if you want to use an existing installation, you can skip this step.

Installing Linux the usual way simply requiresthat you boot from the DVD or USB installation media. Because we’re usingVirtualBox, we just have to create a new virtual machine and then point ittowards the Ubuntu disc image we downloaded. Here are the steps you need tofollow.

Taking Care of Dependencies

Since Linux Live Kit is just a clevercollection of scripts, it needs certain other software packages to be presenton your Linux machine. In many cases they will already be a default part of theversion of Linux you have chosen, but you’ll have to verify this either way.

You need to make sure that aufs is supported by the kernel used by your chosen Linux distribution. You can check which kernel versions supports aufs here. If your chosen kernel does not support aufs, you’ll need to look at an alternative solution to Linux Live Kit.

Now we need to make sure that Squashfs isinstalled on the system. This is the compression technology used by Linux LiveKit. To install it, here’s what to do.

First, open the Terminal. In Ubuntu you can do this by clicking the “Show Application” button at the bottom left of the screen.This will bring up a search bar. Search for “Terminal” and click it when it comes up.

Now, in the terminal, type the following:

sudoapt-get update && sudo apt-get install squashfs-tools

If all goes well the package will beinstalled. If you run into trouble, you’ll have to refer to your version of theOS documentation. Troubleshooting repository and installation issues areoutside our scope for this tutorial.

Trimming the Fat

Since your live distro iw going to have allthe same content as your installed one, you should remove any files you don’tneed from your installation. You don’t have to do this and storage is cheapthese days if you’re using a flash drive. If you don’t know what’s safe to remove,skip this part for now.

Customizing

Now you can go ahead and make the changes youwant for your live distro. Install applications, tweak settings and so on. Onceyou are done with that, we can move on to the Live Kit itself.

Download Linux Live Kit

Now it’s time to download the scripts we need.You can find it on GitHub. Pay special attention to the tips inthe README here. Some of them may be relevant to your needs or situation. Forexample, there are specific instructions if you want to make a bootable liveCD.

Savethe downloaded files to /tmp. In the download you’llfind a folder named “/DOC/. This is filled with additional readme informationto help you in case you hit a snag.

Generating Your Live OS

Now that the script files are where theyshould be, we want to actually run the script. To do this, we’ll have to switchfrom being a regular user to being a Super User. In Ubuntu, open the terminal and type the following:

cd /tmp

This switches you to the TMP folder where weunpacked the Live Kit files.

The last thing we need to do is run the script, so type:

sudo ./build

Linux From Scratch Live Cd Tutorial For Beginners

Now just wait until the script is done!

Running Your Live Distro

So how do you get your live distro? The scriptgenerates two version in the /TMP folder. There’s an ISO image that you canburn to a disc or load up in a virtual machine to test. Most people are howevergoing to care about the bootable USB files. These are also in the /TMP folder.

Copy them to your flash drive, remember tounzip them in the process. Once they are on there, use the Terminal andnavigate to the /boot directory. Then run the “bootinst.sh” script to make thatflash drive bootable.

If all goes well, you’ll now have your ownlive OS!

If you need to create a Linux distribution, then this tutorial will clarify important issues while giving a fast view on the creation processes. This article focuses con Linux From Scratch and Ubuntu Live as ways to customize a Linux distribution. The steps and commands shown are not meant to be functional but to portray the difficulty level of each process. In the future each process will be explained on new updates at LinuxHint.

LFS (Linux From Scratch) is the most popular tool to create customized Linux distributions from source. Creating your own Linux distribution may include some advantages (and disadvantages too). Among advantages you will learn a lot on Linux by creating your own Linux distribution. You will know how Linux modules interact and how to customize the system.

The operating size is also an advantage depending on your hardware resources or the use you want to give the system. On their website LFS developers say the created a web server to work with Apache on 5 mb size. Together with Gentoo Linux, Linux From Scratch is the most flexible way to setup a Linux system. Building it is pretty simple and the process is described step by step, below I will only show the initial steps to portray an idea of the difficulty and a link to the official documentation showing from the building stage.

To get started with Linux From Scratch you need to create first a partition (minimum 3 GB due compilation process), it is also recommendable to create a swap partition or to share your existing one (for instructions on partitioning check Partitioning hard disks under Debian/Ubuntu and resizing partitions).

Once you created the partition create the $LFS variable by running:

You can check it by running:

Then mount the partition:

# mkdir -pv $LFS
# mount -v -t ext3 /dev/<sdX> $LFS

Note: replace <sdX> for your partition.

Then run for the swap partition:

You’ll need to download packages to a specific directory called LFS/sources, to create the directory run:

Make it writable and sticky:

Download and save within the directory all packages from http://www.linuxfromscratch.org/lfs/view/6.6/chapter03/packages.html

and

You can use the wget-list http://www.linuxfromscratch.org/lfs/view/6.6/wget-list

Create the tools directory and symbolic link by running: Para que sirve la sabila.

Run the following commands to create the lfs user giving it rights on the tools and sources directories:

# groupadd lfs
# useradd -s /bin/bash -g lfs -m -k /dev/null lfs
# passwd lfs
# chown -v lfs $LFS/tools
# chown -v lfs $LFS/sources
# su - lfs

Log in as the lfs user and run:

Linux From Scratch Pdf

Then type:

# execenv-iHOME=$HOMETERM=$TERMPS1='u:w$ '/bin/bash

And run:

Create a new .bashrc by running:

And add:

# set +h
# umask 022
# LFS=/mnt/lfs
# LC_ALL=POSIX
# LFS_TGT=$(uname -m)-lfs-linux-gnu
# PATH=/tools/bin:/bin:/usr/bin
# export LFS LC_ALL LFS_TGT PATH
# EOF

Then run:

Then you can save the tools to start building your linux distribution following the steps at http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/introduction.html

After finishing change the tools directory ownership by running:

The official documentation to build your distribution, prepare the kernel and base software can be found here. It is a sequence of steps you need to create a customized distribution. The steps are to prepare Virtual Kernel File Systems, Package Management, Entering the Chroot Environment, Creating Directories, Creating Essential Files and Symlinks, installing additional software listed hereStripping Again and Cleaning Up.

To start customizing the system visit the chapters:

  • Configuring the network Script
    Creating the /etc/fstab File

Finally install GRUB Using GRUB to Set Up the Boot Process and follow the steps before rebooting for first time

Ubuntu Live


Creating a customized Linux based on Ubuntu is pretty easy, it can be done very fast, it is extremely simple when compared with Linux From Scratch but it is not flexible at all, you’ll be able to add software, customize background and some details but basic customizations like the applications menu edition are not supported.

And add:

--arch=amd64
--variant=minbase
bionic
$HOME/live-ubuntu-from-scratch/chroot

Set mount points:

# sudo mount --bind /dev $HOME/live-ubuntu-from-scratch/chroot/dev
# sudo mount --bind /run $HOME/live-ubuntu-from-scratch/chroot/run
# sudo chroot $HOME/live-ubuntu-from-scratch/chroot
# mount none -t proc /proc
# mount none -t sysfs /sys
# mount none -t devpts /dev/pts
# export HOME=/root
# export LC_ALL=C
# echo 'ubuntu-fs-live' > /etc/hostname

Then you’ll need to update the repositories and run apt update and the following command:

# apt-get install -y systemd-sysv
# dbus-uuidgen > /etc/machine-id
# ln -fs /etc/machine-id /var/lib/dbus/machine-id
# dpkg-divert --local --rename --add /sbin/initctl
# ln -s /bin/true /sbin/initctl
# apt-get install -y ubuntu-standard casper lupin-casper discover laptop-detect os-prober network-manager resolvconf net-tools wireless-tools wpagui locales linux-generic

When prompting configuration screens like GRUB’s press ENTER to default choices to continue. Then run:

# apt-get install -y ubiquity ubiquity-casper ubiquity-frontend-gtk ubiquity-slideshow-ubuntu ubiquity-ubuntu-artwork

Install any X window manager you want:

# apt-get install -y plymouth-theme-ubuntu-logo ubuntu-gnome-desktop ubuntu-gnome-wallpapers

Add any additional software you want in your distribution and then run:

Select your locales and reconfigure the resolv.conf and network manager:

# dpkg-reconfigure locales
# dpkg-reconfigure resolv.conf
# dpkg-reconfigure network-manager
Learn linux from scratch

Then run:

# truncate -s 0 /etc/machine-id
# rm /sbin/initctl
# apt-get clean
# rm -rf /tmp/* ~/.bash_history

Unmount all filesystems:

# umount /proc
# umount /sys
# umount /dev/pts
# export HISTSIZE=0exit
# sudo umount $HOME/live-ubuntu-from-scratch/chroot/dev
# sudo umount $HOME/live-ubuntu-from-scratch/chroot/run

Create directories and copy the kernel and binaries:

# cd $HOME/live-ubuntu-from-scratch
# mkdir -p image/{casper,isolinux,install}
# sudo cp chroot/boot/vmlinuz-**-**-generic image/casper/vmlinuz
# sudo cp chroot/boot/initrd.img-**-**-generic image/casper/initrd
# sudo cp chroot/boot/memtest86+.bin image/install/memtest86+
# wget --progress=dot https://www.memtest86.com/downloads/memtest86-usb.zip -O image/install/memtest86-usb.zipunzip -p image/install/memtest86-usb.zip memtest86-usb.img > image/install/memtest86rm image/install/memtest86-usb.zip

Setup GRUB

Run all following commands:

# cd $HOME/live-ubuntu-from-scratch
# sudo mksquashfs chroot image/casper/filesystem.squashfs
# printf $(sudo du -sx --block-size=1 chroot cut -f1) > image/casper/filesystem.size
# cd $HOME/live-ubuntu-from-scratch
# cd $HOME/live-ubuntu-from-scratch/image
# grub-mkstandalone --format=x86_64-efi --output=isolinux/bootx64.efi --locales=' --fonts=' 'boot/grub/grub.cfg=isolinux/grub.cfg'
# grub-mkstandalone --format=i386-pc --output=isolinux/core.img --install-modules='linux16 linux normal iso9660 biosdisk memdisk search tar ls' --modules='linux16 linux normal iso9660 biosdisk search' --locales=' --fonts=' 'boot/grub/grub.cfg=isolinux/grub.cfg'
# cat /usr/lib/grub/i386-pc/cdboot.img isolinux/core.img > isolinux/bios.img
# sudo /bin/bash -c '(find . -type f -print0 xargs -0 md5sum grep -v './md5sum.txt' > md5sum.txt)'
# sudo xorriso -as mkisofs -iso-level 3 -full-iso9660-filenames -volid '<YourDistroName>' -eltorito-boot boot/grub/bios.img -no-emul-boot -boot-load-size 4 -boot-info-table --eltorito-catalog boot/grub/boot.cat
--grub2-boot-info --grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img -eltorito-alt-boot -e EFI/efiboot.img -no-emul-boot -append_partition 2 0xef isolinux/efiboot.img -output './<yourdistronam>.iso' -graft-points '.' /boot/grub/bios.img=isolinux/bios.img /EFI/efiboot.img=isolinux/efiboot.img

As you can see the process with Ubuntu Live is a lot faster and easier, but it is not more than an Ubuntu distribution with light customizations in contrast to Linux From Scratch which is fully customizable. I hope you found this tutorial useful, keep following LinuxHint for additional tips and updates on Linux and networking.