|
|
***Installing the required tools***
|
|
|
<br>sudo aptitude install squashfs-tools genisoimage
|
|
|
|
|
|
***Preparing the temporary file system***
|
|
|
|
|
|
Linuxmint-17-cinnamon-64bit-v2.iso is used as the base iso image throughout the process. Change the name according to the downloaded image.
|
|
|
|
|
|
* mkdir ~/mylivecd <br>
|
|
|
* cp /path_to_the_downloaded_iso_directory/linuxmint-17-cinnamon-64bit-v2.iso ~/mylivecd <br>
|
|
|
* cd ~/mylivecd <br>
|
|
|
* mkdir mnt <br>
|
|
|
* sudo mount -o loop linuxmint-17-cinnamon-64bit-v2.iso mnt <br>
|
|
|
* mkdir extracted <br>
|
|
|
* sudo rsync --exclude=/casper/filesystem.squashfs -a mnt/ extracted <br>
|
|
|
* sudo unsquashfs mnt/casper/filesystem.squashfs <br>
|
|
|
* sudo mv squashfs-root edit
|
|
|
|
|
|
1. ***Prepare Network connections in the temporary file system***
|
|
|
|
|
|
* sudo cp /etc/resolv.conf edit/etc/ <br>
|
|
|
* sudo cp /etc/hosts edit/etc/
|
|
|
|
|
|
***Prepare a chroot environment***
|
|
|
* xhost + //it will enable you to run GUI applications like synaptic but this will disable the x server access control, so use it at your own risk.
|
|
|
* sudo mount --bind /dev/ edit/dev
|
|
|
* sudo chroot edit
|
|
|
* mount -t proc none /proc
|
|
|
* mount -t sysfs none /sys
|
|
|
* mount -t devpts none /dev/pts
|
|
|
* export HOME=/root
|
|
|
* export LC_ALL=C
|
|
|
|
|
|
Now this terminal is in your new system. Don't close this in any circumstances. We will call this the chroot terminal and let's open another terminal and run
|
|
|
|
|
|
* cd ~/mylivecd
|
|
|
* su
|
|
|
|
|
|
and call this the host terminal. We will use this terminal when needed. You can differentiate between these two by comparing the command history. (This is very important, don't mix up these two terminals in anyway.)
|
|
|
|
|
|
Run codes in chroot terminal if nothing is specified about which terminal to use.
|
|
|
|
|
|
2. ***Preparing customization***
|
|
|
|
|
|
* <mark>dbus-uuidgen > /var/lib/dbus/machine-id</mark>
|
|
|
* dpkg-divert --local --rename --add /sbin/initctl
|
|
|
* ln -s /bin/true /sbin/initctl
|
|
|
|
|
|
Now customize at your hearts content:
|
|
|
|
|
|
The filesystem is now the "edit" folder inside "mylivecd" directory. You can modify the filesystem to meet your needs. But you only have access to the chroot terminal. So make sure you can do everything with only a terminal. You can use this terminal to run GUI applications too.
|
|
|
|
|
|
To view installed packages by size:
|
|
|
|
|
|
*dpkg-query -W --showformat='${Installed-Size}\t${Package}\n' | sort -nr | less *
|
|
|
|
|
|
3.1 ***Installing softwares***
|
|
|
|
|
|
First update the repository (in chroot terminal):
|
|
|
|
|
|
*apt update
|
|
|
|
|
|
Install softwares from the chroot terminal by:
|
|
|
|
|
|
* apt install some-package
|
|
|
or
|
|
|
* aptitude install packag1 package2 ....
|
|
|
or
|
|
|
* dpkg -i some_package.deb
|
|
|
|
|
|
or
|
|
|
|
|
|
synaptic:
|
|
|
then use synaptic package manager to install software.You can run other GUI applications too.
|
|
|
|
|
|
If you use synaptic then you will probably need to delete the edit/home/* manually and also delete the edit/run/synaptic.socket in the cleaning step.
|
|
|
|
|
|
|
|
|
In this case the some_package.deb must be located somewhere inside the "edit" directory. So copy the deb files that you want to install by dpkg to a location inside that edit folder and use correct path to the files or use my conventions as below (in chroot terminal):
|
|
|
|
|
|
* mkdir /mydir
|
|
|
* chmod -R 777 /mydir
|
|
|
* cd /mydir
|
|
|
|
|
|
Now use your file manager (open as root) to copy files for your packages to this folder or you can use the host terminal too (to copy files here). Now you can use the chroot terminal to install softwares from that directory (.deb files or source). To install softwares you can see the methods written in this tutorial:
|
|
|
Installing softwares in linux
|
|
|
and to get a menu entry for the installed software (if it doesn't have any by default) you can see my other tutorial:
|
|
|
Adding menu item in linux mint
|
|
|
|
|
|
If you have the latest .deb packages then you can copy them into the "/var/cache/a34pt/archives" directory so that you will be able to install them with the
|
|
|
|
|
|
* apt install package_name
|
|
|
|
|
|
command in chroot terminal without downloading them. But if they are not latest, then this will do no good at all.
|
|
|
|
|
|
To install all the .deb packages in any directory simply run in chroot terminal:
|
|
|
|
|
|
* cd path_to_that_directory
|
|
|
* dpkg -i *.deb
|
|
|
|
|
|
|
|
|
3.2 You can do other types of modifications as you have full access to the whole filesystem, if you know how to do it in any regular distro. The main problem is, you have no GUI (Desktop) for making modifications, all there is to edit the config files and the filesystem to modify everything. So you need to be sure about the modifications that they will work correctly beforehand.
|
|
|
|
|
|
3.3 ***Kernel installation(Optional)***
|
|
|
|
|
|
First install any kernel (see this for reference) with the chroot terminal then to boot this kernel in live cd/dvd run these codes in the host terminal:
|
|
|
|
|
|
*cp edit/boot/vmlinuz* extracted/casper/vmlinuz
|
|
|
*cp edit/boot/initrd.img* extracted/casper/initrd.lz
|
|
|
|
|
|
If you install more than one kernel then replace * in the above two commands with correct version codes.
|
|
|
|
|
|
3.4 At last, run this code in chroot terminal to make sure the Linux mint installation application (in live dvd/cd) is up-to-date:
|
|
|
|
|
|
*apt install ubiquity-frontend-gtk
|
|
|
|
|
|
4. Cleanup your new system:
|
|
|
|
|
|
|
|
|
*aptitude clean
|
|
|
*rm -r /var/cache/apt/archives/*
|
|
|
*rm -r /mydir
|
|
|
*rm -rf /tmp/* ~/.bash_history
|
|
|
*rm /var/lib/dbus/machine-id
|
|
|
*rm /sbin/initctl
|
|
|
*dpkg-divert --rename --remove /sbin/initctl
|
|
|
*umount /proc || umount -lf /proc //ignore warning in this command
|
|
|
*umount /sys
|
|
|
*umount /dev/pts
|
|
|
*exit //if fails try *exit 0
|
|
|
*sudo umount edit/dev //ignore error/warning in this *command
|
|
|
*xhost -
|
|
|
|
|
|
If you used synaptic (or any other GUI) then you will probably need to do this extra cleaning:
|
|
|
|
|
|
*sudo rm -rf edit/run/synaptic.socket
|
|
|
*sudo rm -rf edit/home/*
|
|
|
|
|
|
From this moment the chroot environment is no more, but this terminal will be used for the rest of the commands, you can close the other (host) terminal.
|
|
|
|
|
|
|
|
|
5. ***Regenerate manifest (ignore any warning)***
|
|
|
*su
|
|
|
*chmod +w extracted/casper/filesystem.manifest
|
|
|
*chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extracted/casper/filesystem.manifest
|
|
|
|
|
|
*cp extracted/casper/filesystem.manifest extracted/casper/filesystem.manifest-desktop
|
|
|
|
|
|
*sed -i '/ubiquity/d' extracted/casper/filesystem.manifest-desktop
|
|
|
*sed -i '/casper/d' extracted/casper/filesystem.manifest-desktop
|
|
|
|
|
|
5. Compress***
|
|
|
|
|
|
*rm extracted/casper/filesystem.squashfs
|
|
|
*mksquashfs edit extracted/casper/filesystem.squashfs -comp xz
|
|
|
|
|
|
6. ***Update some required files***
|
|
|
|
|
|
|
|
|
*printf $(sudo du -sx --block-size=1 edit | cut -f1) > extracted/casper/filesystem.size
|
|
|
|
|
|
|
|
|
*open extracted/README.diskdefines file with a text editor and change the name of the disk.
|
|
|
|
|
|
*Remove old md5sum and calculate new md5sums:
|
|
|
|
|
|
*cd extracted
|
|
|
*rm MD5SUMS
|
|
|
*find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee MD5SUMS
|
|
|
|
|
|
7. ***Create the ISO image***
|
|
|
|
|
|
*mkisofs -D -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../Linux-Mint-cinnamon-x64_custom.iso .
|
|
|
|
|
|
*exit
|
|
|
|
|
|
*sudo chmod 777 ~/mylivecd/Linux-Mint-cinnamon-x64_custom.iso
|
|
|
|
|
|
8.***Test the ISO image***
|
|
|
|
|
|
|
|
|
You can use qemu, kvm, virtualbox for a test run of the iso or you can use your physical computer for testing (making a live usb or burning the iso to cd or dvd). If everything is satisfactory then you can make this a final release of your new custom Linux Mint dristro. |
|
|
\ No newline at end of file |