Configs for the spinning up ubuntu 20.04 server without human interventions or click.
https://gist.github.com/s3rj1k/55b10cd20f31542046018fcce32f103e
- https://opensource.com/article/17/2/linux-boot-and-startup
- https://ubuntu.com/server/docs/install/autoinstall
- https://www.ipaddressguide.com/cidr
- https://www.virtualbox.org/manual/ch06.html#networkingmodes
- https://linuxize.com/post/how-to-configure-static-ip-address-on-ubuntu-20-04/
- Basic of Cloudinit
- More info about files required in unattended installation
- https://www.geeksforgeeks.org/customising-vim-from-scratch-without-plug-ins/
- https://www.tecmint.com/speed-up-ssh-connections-in-linux/
- https://unix.stackexchange.com/a/511017
# Command to generate crypt(salt based) passwd
openssl passwd -6 -salt "/PYpVMtUyP2E18jr" "yourP@$$w0rd"
# To generate key-pair for jump-box(client machine)
ssh-keygen
# Become sudo in your host
sudo -i
# Make executable
chmod 744 build-iso.sh
# Start process
./build-iso.sh
# After server comes up:
# Login with myuser:$crypt-passwd
# Get ip of server by
ip a
# Once you have ip, try login from Jump box
# Ex: ssh -i ~/.ssh/id_rsa -p 9222 myuser@172.16.8.11
ssh -i <pathToPrivateKey> -p 9222 myuser@<ip>
Q: Why should I go with autoinstaller if I can do the same steps manually in few clicks?
A: Setting up large no. of server can be tedious sometimes and more error-prone as well. This has following advantages over click method:
- SSH keys are already setup for the initial user.
- You can just start using ansible or other tools as soon as server comes up.
Q: In which case I need to include the network config?
A: You can think of these to start with:
- You have more the one live eth adapters avaliable.
- You want to have static IP for you server given by you.
- You need to configure bond configs for adapters.
Q: What will happen if I'll not use the network config?
A: Few cases that I can imagine or have experienced:
- It will select the one which is present and request new IP from DHCP server.
- If static IP configuration is missing in your DHCP server then IP might change in next boot which can eventually break things.
Q: Where these configs are tested?
A: Legacy mode. Haven't tried it for UEFI but I guess, It should be working for that as well.
Q: How can I add more users initially?
A: I recommend to use ansible with jenkins for your next users and their management. If still you want to explore with cloudinit, try below:
user-data:
users:
- default
- name: test
passwd: "<Your crypt hash>"
shell: /bin/bash
lock-passwd: false
ssh_pwauth: True
chpasswd: { expire: False }
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
ssh_authorized_keys:
- <add-keys here>
Q: I've not changed anything in user-data so what password I need to use for login?
A: myuser:changeme
. Still you can't access server remotely if you've not created your own key-pair with ssh-keygen and replaced the public key or copied the private.key correctly and specified in ssh command.