61 lines
No EOL
2.4 KiB
Markdown
61 lines
No EOL
2.4 KiB
Markdown
unattended install of ubuntu server
|
|
Video reference
|
|
https://www.youtube.com/watch?v=DtXZ6BMaKbA
|
|
https://files.catbox.moe/fztpyo.mp4
|
|
|
|
- Download iso from here: https://cdimage.ubuntu.com/releases/18.04.6/release/
|
|
- Copy autoinstall-user-data file from `/var/log/installer` from where ubuntu-live-server-23.... .iso is installed. Then create a directory say 'server_work'. Under it create a autoinstall-user-data and copy necessary things like
|
|
```
|
|
#cloud-config
|
|
autoinstall:
|
|
identity:
|
|
hostname: tree
|
|
password: $6$oylcLD1tDk6UPHJf$xSwvFGR8314IlJBENXKKqAGbcHWuzPp7le3HRAzaSPg7I2vJk.pFEnMICyPOQwjJGjaPqejSEkPcyaG9T7kRW.
|
|
realname: tree
|
|
username: tree
|
|
kernel:
|
|
package: linux-generic
|
|
keyboard:
|
|
layout: us
|
|
toggle: null
|
|
variant: ''
|
|
locale: en_US.UTF-8
|
|
ssh:
|
|
allow-pw: true
|
|
authorized-keys: []
|
|
install-server: true
|
|
updates: security
|
|
version: 1
|
|
shutdown: poweroff
|
|
|
|
```
|
|
- Now create directory 'source-files' and use this
|
|
`xorriso -osirrox on -indev ubuntu-23.10-live-server-amd64.iso --extract_boot_images source-files/bootpart -extract / source-files/
|
|
`
|
|
- Now go to source-files dir and create dir nocloud and go to nocloud and use
|
|
`cp ../../autoinstall-user-data user-data`. Now create file named meta-data. Finally go to parent dir ie source-files.
|
|
- Now go to boot/grub and add write permission for root for file grub.cfg using `chmod 644 grub.cfg`
|
|
- Open grub.cfg. Create menuentry for automatic install like this
|
|
After the line `set menu_color_highlight=black/light-gray` add this
|
|
```
|
|
menuentry "Autoinstall Ubuntu Server" {
|
|
set gfxpayload=keep
|
|
linux /casper/vmlinuz quiet autoinstall ds=nocloud\;s=/cdrom/nocloud/ ---
|
|
initrd /casper/initrd
|
|
}
|
|
|
|
```
|
|
and set timeout=5 instead of 30
|
|
- Go to source files directory. Now use this
|
|
`xorriso -as mkisofs -r -V "ubuntu-autoinstall" -J -boot-load-size 4 -boot-info-table -input-charset utf-8 -eltorito-alt-boot -b bootpart/eltorito_img1_bios.img -no-emul-boot -o ../installer.iso .`
|
|
|
|
|
|
- ssh
|
|
`sudo nano /etc/ssh/sshd_config`
|
|
Change port if desired
|
|
|
|
`ssh username@ip_address -p 22` . here ip_address can be local or public. 22 is default port
|
|
When port forwarding externally, using pyblic ip address make sure to have some firewall like `fail2ban` or `ufw`
|
|
In order to use GUI locally when opening through ssh.
|
|
for eg: opening gui in A if remote machine is B.
|
|
`ssh -X userB@ip_address -p $DEFAULT_PORT` |