Install Required Packages: Make sure you have the necessary packages installed:
sudo apt update
sudo apt install genisoimage
| #!/bin/bash | |
| # Create a temporary directory | |
| mkdir ~/custom_iso | |
| cd ~/custom_iso | |
| # Copy necessary files | |
| cp /etc/apt/sources.list . | |
| cp /etc/fstab . | |
| # ... copy other configuration files ... | |
| # Create a list of installed packages | |
| dpkg --get-selections > installed-software | |
| # Install necessary packages on the custom_iso | |
| sudo xargs -a installed-software apt-get install --reinstall -y | |
| # Create the ISO | |
| sudo mkisofs -o custom.iso -r -J . |
| #!/bin/bash | |
| # Set the output ISO file name | |
| ISO_FILE="system_image.iso" | |
| # Set the temporary directory | |
| TMP_DIR="/tmp/system_image" | |
| # Create the temporary directory | |
| mkdir -p "$TMP_DIR" | |
| # Create a list of installed packages | |
| dpkg --get-selections > "$TMP_DIR/installed-packages.txt" | |
| # Copy kernel information | |
| uname -a > "$TMP_DIR/kernel_info.txt" | |
| # Copy necessary configuration files (customize as needed) | |
| cp -R /etc "$TMP_DIR/etc" | |
| # Copy home directory (optional, comment if not needed) | |
| cp -R /home "$TMP_DIR/home" | |
| # Create the ISO image | |
| genisoimage -o "$ISO_FILE" -r -J "$TMP_DIR" | |
| # Clean up temporary directory | |
| rm -r "$TMP_DIR" | |
| echo "System image created successfully: $ISO_FILE" |