Unattended Ubuntu 20.04 Server Offline Installation
Last year, I wrote a post about how to install Ubuntu 18.04 Server automatically. The major reason why I choose to install the older version is I failed to make Ubuntu 20.04 install without pressing any key at that time while the approach for the offline installation recommended by the official is not working.
There is an article already described the detailed steps about the automatic installation of Ubuntu 20.04 Server, but according what its author said, their blog system ripped out some important characters. So, by checking with this script, I figured out the correct way to achieve our goal.
Download the image
Download the live CD image in whichever way you prefer. For the user locates in China, I would suggest you download from https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/focal/ubuntu-20.04.3-live-server-amd64.iso.
Update some files in ISO image
Only thing we need to do is updating several files. And here are some recommended editors.
- For Windows user, I strongly recommend you use
Ultraiso
to edit the ISO file. - For Linux user,
ISO Master
should work. (I didn't try it before.) - For the user who wants to deeply customize the ISO file, including unpacking
rootfs
image,cubic
is everything you need. You can refer to my previous post and learn how it works.
Add Kernel Arguments
Assume the root directory of ISO image is /cdrom
. There are two bootloader configuration files need to modify, one for UEFI system, one for the legacy one. Append the kernel arguments like this,
/cdrom/isolinux/txt.cfg
1 | label live |
/cdrom/boot/grub/grub.cfg
1 | menuentry "Install Ubuntu Server" { |
If you would like to skip the integrity check, you could try to append the kernel argument fsck.mode=skip
as the following example shows.
1 | # File: /cdrom/isolinux/txt.cfg |
Note: HWE Kernel is a higher version of Linux kernel compared to the default one, which is shipped with the newer drivers. Theoretically, it has a better support for the latest hardware.
Add Auto-install Configurations
Two new files are also required for automatic answering.
/cdrom/user-data
This configuration is what I am using now, and it is for the machine without Internet. I have verified that it can make the installation procedure fully automatic.
1 | #cloud-config |
Note:
direct
storage layout means using and erasing the whole disk. (The default option provided by the interactive installer.)- The password is
ubuntu
. This can be generated bymkpasswd
.
For more usages, check this example.
/cdrom/meta-data
Just create an empty file and put it there.