Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is purely theoretical but suppose I would like to deploy a linux distribution on many servers. The only solution I can think of would be to create an initramfs with a custom script to perform checks on the underlying hardware, then format the main hard drive and install the OS.

Now I am not entirely satisfied by my approach, I would rather do the same thing after the kernel has launched init. Usually, what init does is spawn a shell for the user to log in.

How can I replace this with my own script?

share|improve this question
Just to be clear, do you want users to have your custom shell/script as soon as they log in or am I doing some mistake in understanding the question? – Aditya Patawari May 16 '13 at 12:32
I don't understand what exactly you are trying to achieve. Installing many servers, workstations, setting up booting from network or something else? – peterph May 16 '13 at 15:46
using init=/bin/sh is common but when there is nothing mounted at the begining of system how do you want to run an script? – Hojat Taheri Jul 7 '13 at 16:49

There is no need to modify initramfs. There is fai-project.

FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments.

It's a tool for unattended mass deployment of Linux. You can take one or more virgin PC's, turn on the power, and after a few minutes, the systems are installed, and completely configured to your exact needs, without any interaction necessary.

share|improve this answer

You can do most (pehaps all?) of the above by unattended network install of Fedora, and (altought I'm not that familiar with other distributions) you should be able do the same at least with any of the larger/most popular ones.

What distribution do you want to install? (No, a "homebrew system built by me, myself and I" won't ever come close to anything that merits installation on dozens of machines; there are literally many thousands of people, with a sizeable number employed full time, behind any of the more popular distributions, and a few hundred behind the smaller ones. Only distributions that are not much more than a spin of a major one can get away with less manpower.) The answer to that will narrow down the options significantly. Look at what Amazon and other "cloud" vendors provide for their virtual machines, you might be able to swizzle much of that for your own use. Check what the webhosting/-housing outfits use, see if you can pilfer something there.

Make sure that whatever you use has a proven track record, and isn't likely to dissapear from sight anytime soon. Make sure the licenses involved are clear (getting into legal hot waters isn't fun) and to your liking.

share|improve this answer
You might have missed my first sentence: "this is purely theoretical". I have no plans to spread my own buggy version of linux for the moment, I just want to know how I could do it if I wanted to. – qdii May 16 '13 at 17:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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