One of my colleagues needed to set up a server to run the software I was developing. To make his task easier, he suggested that I create a disk image from my development virtual machine.
The most important thing is the configuration would be taken from my Linux environment and so would be guaranteed to run with minimal setup required. As a bonus, he would also get the latest version of my code.
My colleague suggested using Remastersys. This is a tool which can image the Linux environment that it is running on.
Installation of Remastersys was straightforward.
$sudo apt-get update
$sudo apt-get install remastersys remastersys-gui
Once installed, I attempted to make a backup of my entire virtual machine.
$sudo remastersys backup custom.iso
It was soon obvious that this was not the best approach. I had a lot of large files from previous work. The disk image failed to create as I ran out of space on my fixed size virtual disk. On failure, the image size was over 11GB, which was way too big for my purpose.
My first reaction was to remove most of the large files. This time the ISO file was created properly, but again it was large at over 3.4GB. My colleague was at a remote location, and I needed to share the image with him through DropBox. A quick check confirmed that my DropBox account was restricted to 2.5GB of data.
So, I needed a different approach. At this point, I realised that the image did not need most of the files in my home directory, which included a lot of test data as well as development tools. So, I could make a distribution image which excluded my home directory.
In order to accomplish this, I needed to move my project code out of its cloned repository in my home directory and move it to an accessible location for the distribution image. I had to update my Apache virtual hosting configuration and reload Apache. [Please see my last post , Installing Laravel on Linux Mint / Ubuntu/]
Once, this change was made and tested, I removed the Remastersys data related to creating the previous image.
$sudo remastersys clean
Now, I was ready to create my distribution image.
$sudo remastersys dist custom.iso
Once complete, the new ISO image was 2.4GB in size. While still large, it was manageable. I managed to upload the image to my DropBox account and share it with my colleague, who was able to set up his server with a single clean installation.
Finally, as the disk image was created, I reset my Apache virtual host to point to my cloned source code repository, so that I could continue my development as before.