-
Identify the Target Disk
Determine the disk where you want to install the OS:lsblk # Example output: /dev/sda # Replace /dev/sdX with your actual target disk
-
Partition the Disk
Create necessary partitions (e.g., root and swap):sudo fdisk /dev/sdX # Inside fdisk: # - 'g' to create a new GPT partition table # - 'n' to add a new partition (e.g., for root) # - 't' to set partition type (e.g., 20 for Linux filesystem) # - Repeat 'n' and 't' for additional partitions (e.g., swap) # - 'w' to write changes and exit
-
Format the Partitions
Format the created partitions:sudo mkfs.ext4 /dev/sdX1 # Format root partition sudo mkswap /dev/sdX2 # Format swap partition
-
Mount the Root Partition
Mount the root partition to/mnt:sudo mount /dev/sdX1 /mnt
-
Extract the Root Filesystem
If you have a SquashFS image:sudo unsquashfs -f -d /mnt /path/to/rootfs.squashfs
If you have a directory:
sudo cp -a /path/to/rootfs/* /mnt/ -
Mount System Directories
Prepare for chroot by mounting necessary filesystems:sudo mount --bind /dev /mnt/dev sudo mount --bind /proc /mnt/proc sudo mount --bind /sys /mnt/sys
-
Chroot into the New System
Enter the new system environment:sudo chroot /mnt
-
Install GRUB Bootloader
Install GRUB to make the system bootable:grub-install /dev/sdX update-grub
-
Configure fstab
Generate and edit/etc/fstabwith correct UUIDs:blkid # Use the output to populate /etc/fstab accordingly -
Exit and Unmount
Exit chroot and unmount filesystems:exit sudo umount /mnt/dev sudo umount /mnt/proc sudo umount /mnt/sys sudo umount /mnt -
Reboot
Restart the system:sudo reboot