2

I want to know if exists an alternative to Sysprep for Linux. I'm working on VM using VMware and I want to clone that machine to create new ones based on this template. And I want to try to make a VM clear as possible.

  • Can you elaborate what you expect from a "sysprep for Linux"? In ancient times, Windows needed clean hardware-specific settings. Linux can be copied from one disk to another and is good to go. The only thing you probably want to do is changing the hostname and SSH key (if present). There is not much more to do. – Hermann Jul 11 '18 at 18:38
  • @Hermann: Windows 10 still needs sysprep so I don't know what you mean by "In ancient times" – jesse_b Jul 11 '18 at 20:24
  • 1
    Sysprep isn't really the approach you take w/ Linux. We use packer to build images of Linux systems which we then store in VMWare, Openstack, AWS, and Azure. When we boot these boxes they start up clean. – slm Jul 11 '18 at 20:57
1

According to the Redhat website there's virt-sysprep which does similar things that Sysprep does under Windows.

The virt-sysprep command-line tool can be used to reset or unconfigure a guest virtual machine so that clones can be made from it. This process involves removing SSH host keys, removing persistent network MAC configuration, and removing user accounts. Virt-sysprep can also customize a virtual machine, for instance by adding SSH keys, users or logos. Each step can be enabled or disabled as required.

In the linked man page they show things like this:

--append-line '/etc/hosts:10.0.0.1 foo'
--append-line '/etc/hosts:10.0.0.2 bar'

And this:

--commands-from-file FILENAME (see customize below)

Which would then use this file as input:

delete /some/file
install some-package
password some-user:password:its-new-password

References

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.