Home Automating Ubuntu 22 Server installs
Post
Cancel

Automating Ubuntu 22 Server installs

I go through periods where I need to make a bunch of Ubuntu 22 Server installs. Automating the install process is possible, but the information is spread out over lots of web sites. Therefore I will not be listing sources.

I wanted to make this virtualization platform agnostic. Yes, I’m sure there are better ways to do this. :-) This may even work on a physical install.

  1. Create a new VM and manually install Ubuntu 22 Server with the networking, user accounts, etc. I would suggest using DHCP and a generic hostname.
  2. Once it is created and has rebooted, go and grap the file at /var/log/installer/autoinstall-user-data. This is the data used to supply the answers.
  3. Copy and create the needed files to the config files folder:
    1
    2
    3
    4
    5
    6
    
    mkdir config_files_folder
    cp autoinstall-user-data config_files_folder
    cd config_files_folder
    mv autoinstall-user-data simplemeta-data # Rename the file to a simpler name
    cp simplemeta-data simpleuser-data       # Copy the file to another file
    touch simplevendor-data                  # Create an empty file
    
  4. You will be supplying these files via a simple web server on another computer. If you have python3, I would suggest this:
    1
    2
    
    cd config_files_folder
    python3 -m http.server --bind 192.168.1.90 9000
    

    The folder you run this command in becomes the webroot.

  5. Create the VM (CPUs, memory, etc) and attach a stock ISO for Ubuntu 22 Server
  6. Start the VM. When you get to the grub menu (“Try Ubuntu”), select “Try” and press the lower case letter ‘e’. Add the following information to the ‘linux’ line after the triple hyphen (—):
    1
    2
    
    autoinstall quiet 'ds=nocloud-net;s=http://192.168.1.90:9000/simple'
    # Supply only the base name. The installer will add the rest of the file name.
    

    Desktop View Sample grub modifaction

  7. Press F10 to proceed with the unattended install.
  8. There will be several places during the install that it seems like it is hung. Just be patient.
  9. After this, I would suggest a reboot, then you can update/upgrade you new installation.
This post is licensed under CC BY 4.0 by the author.