Summary The Ubuntu PC server in my parents' house went wrong due to a power outage, and I needed to set up the OS again. Since the data is on the NAS, we do not retrieve the data. Since it is difficult to get various things done remotely, I used Autoinstall.
--Start installation with USB boot --The settings are fetched from the local web server, so you don't have to recreate the USB every time you change the settings. --IP address is fixed --Preparation is local Linux ――The work of burning USB is a Windows PC at home
meta-data is an empty file. The user-data Ethernet I/F is a static IP, not DHCP. If you don't know the I/F name in advance, it feels useless. You may want to set some suggestions and use match. The encrypted-password was created below. I put whois in my local Linux Mint for mkpasswd.
mkpasswd -m sha-512 <password>
user-data
#cloud-config
autoinstall:
version: 1
locale: en_US
keyboard:
layout: us
variant: ''
identity:
hostname: <hostname>
username: <usrname>
password: "<encrypted-password>"
realname: <username>
storage:
layout:
name: lvm
network:
network:
version: 2
ethernets:
enp1s0:
addresses:
- <ip-address>/24
gateway4: <gw-ip-address>
nameservers:
addresses: [<dns-ip-address>]
ssh:
install-server: true
authorized-keys:
- "ssh-rsa <local-pc-public-key>"
packages:
- build-essential
- net-tools
- lm-sensors
user-data:
timezone: Asia/Tokyo
sudo mount -o ro,loop ~/Downloads/ubuntu-20.04.1-live-server-amd64.iso /cdrom/
mkdir iso_root
cd iso_root/
sudo rsync -av /cdrom/. .
sudo chown -R $(id -un) .
If you use wq! In vi, you can write to it, so you don't need chmod. .. ..
chmod 744 iso_root/boot/grub/grub.cfg
vi iso_root/boot/grub/grub.cfg
chmod 444 iso_root/boot/grub/grub.cfg
There are user-data and meta-data under http: // \ <web-server-ip >/path/to /. If you start USB on the wrong PC, you will be in trouble, so autoinstall is prevented from running automatically with timeout = -1. It seems that it will be cut off with a semicolon, so the command options are enclosed in ".
diff -u /cdrom/boot/grub/grub.cfg iso_root/boot/grub/grub.cfg
--- /cdrom/boot/grub/grub.cfg 2020-08-01 03:35:16.000000000 +1000
+++ iso_root/boot/grub/grub.cfg 2021-01-16 20:49:10.272872571 +1100
@@ -10,7 +10,12 @@
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
-set timeout=5
+set timeout=-1
+menuentry "Auto Install Ubuntu Server" {
+ set gfxpayload=keep
+ linux /casper/vmlinuz autoinstall "ds=nocloud-net;s=http://<web-server-ip>/path/to/" quiet ---
+ initrd /casper/initrd
+}
menuentry "Install Ubuntu Server" {
set gfxpayload=keep
linux /casper/vmlinuz quiet ---
If you use wq! In vi, you can write to it, so you don't need chmod. .. ..
chmod 744 iso_root/isolinux/txt.cfg
vi iso_root/isolinux/txt.cfg
chmod 444 iso_root/isolinux/txt.cfg
There are user-data and meta-data under http: // \ <web-server-ip >/path/to /. Again, I wanted to prevent Autoinstall from running automatically because it would be a problem if I booted the USB on the wrong PC, but as shown below, auto-install runs automatically even if it is set to default live. It will end up. By default, the menu is not displayed and the first label is executed without permission? .. .. For the time being, I removed autoinstall from the command options, so "label auto-install" will run automatically, but just before I try to autoinstall, I'll be asked a Yes/No question.
diff -u /cdrom/isolinux/txt.cfg iso_root/isolinux/txt.cfg
--- /cdrom/isolinux/txt.cfg 2020-08-01 03:35:16.000000000 +1000
+++ iso_root/isolinux/txt.cfg 2021-01-17 18:16:50.052299812 +1100
@@ -1,4 +1,8 @@
default live
+label auto-install
+ menu label ^Auto Install Ubuntu Server
+ kernel /casper/vmlinuz
+ append initrd=/casper/initrd ds=nocloud-net;s=http://<web-server-ip>/path/to/ quiet ---
label live
menu label ^Install Ubuntu Server
kernel /casper/vmlinuz
Install the required packages on your local Linux Mint.
sudo apt install isolinux xorriso
Create an ISO image with the following command.
xorriso -as mkisofs -o u20.04_autoinstall.iso -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \
-e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat iso_root
Created using Etcher by remote desktop to a Windows PC in my parents' house.
Autoinstall Have the target PC insert the created USB memory and perform USB Boot. After completing Autoinstall, confirm that you can log in as the user specified in user-data by SSH.
that's all.
For the time being, install Docker/Docker-compose using local Ansible. https://github.com/skwsk/docker_playbook
After this, I will use Ansible to put in everything else I need.
https://ubuntu.com/server/docs/install/autoinstall https://ubuntu.com/server/docs/install/autoinstall-quickstart https://ubuntu.com/server/docs/install/autoinstall-reference https://netplan.io/reference/ https://wiki.syslinux.org/wiki/index.php?title=Isohybrid https://qiita.com/sakai00kou/items/7ce4a8a410251b98b2ac https://qiita.com/YasuhiroABE/items/637f1046a15938f9d3e9
Recommended Posts