Making Linux self-configure on initial boot

bootconfigurationvirtualbox

I would like to create a single shell script which creates, starts and configures a VirtualBox image with a minimal and secure Linux variant, without manual interaction or automation software.

Creating the VirtualBox image is easy, but after booting for the first time, I am currently forced to type the following before I can run the rest of my configuration script over SSH:

setup-alpine
reboot
ifconfig eth1 192.168.56.101
adduser joe

I thought I could solve this by copying files or executing scripts from the host, but this seems to require "guest additions" which are not available for Alpine Linux, my current choice.

How do I fully automate this process without any manual interaction after starting the initial script?

Best Answer

I would suggest to add your custom commands at the end of:

/etc/rc.local

this is the first file that runs after a distro is booted up.

Related Question