I need to perform various things on my custom ISO server installation during the first boot. It needs to be completely hands and internet free.

What are my options here? I see the pre and post install scripts with kickstart but they don't seem to be doing anything. For instance, I tried to set my hostname with a post install script and it didn't work, but the other options in the ks file did.

The things I need to do on first run are:

  • Set a unique hostname
  • Add lines to a conf file
  • Place down a public key
  • Place a custom shell for a certain user
  • Set firewall rules with ufw
  • Set a few internet related things and connect out to chef over vpn

I suppose most if not all of these are just static files that can be placed in a custom .deb file on the ISO and be "installed" during system installation. For those that require running services and however, what is the normal way to go about this?


In the post install script, can't you call out to a BASH Script? The in your BASH script you can then process out?

Is there not a place in in start up to check these options? Trying to understand the requirement here, I would question why you would want to do post install, and rather have a configuration script that runs at start up, trying something like hooking in to the grub configuration or something?

How to Configure the GRUB2 Boot Loader’s Settings

  • So I'm open to all options. I just want to get a server up and ready to vpn out and grab the rest of the things down from chef with absolutely no hands on keyboard. Things like vpn, keys and config files need to be setup to achieve this and that's what I'm trying to figure out. At this point I'm still trying to figure out how pre and post install scripts work since a simple "hostname blah" didn't work. The majority of information on the subjects are about the "what" but not "how". – Thisisstackoverflow Mar 23 '16 at 18:50
  • Secondly, I'm all for a a configuration script as long as it runs automatically one time. Is there a proper example you know of? Lastly, I have no idea if I need to touch grub here. – Thisisstackoverflow Mar 23 '16 at 18:54
  • Check out this post askubuntu.com/questions/814/how-to-run-scripts-on-start-up You can probably add some bash script to check if values have been set previously or something. – Gary Woodfine Mar 23 '16 at 18:57
  • Thanks, I'll check that out. On a side note, why am I having trouble finding information on this stuff? Is there a better way to do it that I'm missing? – Thisisstackoverflow Mar 23 '16 at 19:15
  • TBH , in my experience learning about Linux is long frustrating road, but really enjoyable at the same time. Linux is basically so customisable and you can literally do anything with it, the chances are sometimes what you are attempting to do, others have but they have just never blogged or commented about it. – Gary Woodfine Mar 23 '16 at 19:23

I followed shvahabi's advice here How can I make "rc.local" run on startup?. I'm creating a custom /etc/rc.local file and including it into a custom deb that will be placed onto the ISO and installed at installation time. The rc.local file simply has one line added that runs a script I made to achieve the multiple things I bulleted above.

I also placed the actual script that will do all of that work in the custom deb package so it's placed on the system as well.

Things like ssh keys will also be placed in this custom deb package and simply placed onto the file system at installation time.

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.