latest
This commit is contained in:
25
ubuntu-makevm/Makefile
Normal file
25
ubuntu-makevm/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
export VMNAME := ubuntu1804
|
||||
export DISK_DIR := /storage/scratch/tmp
|
||||
export HOST := las1.local
|
||||
|
||||
.PHONY: clean install reinstall rcopy rrun
|
||||
|
||||
default: remote
|
||||
|
||||
clean:
|
||||
-virsh destroy $(VMNAME)
|
||||
-virsh undefine $(VMNAME)
|
||||
rm -f $(DISK_DIR)/$(VMNAME).qcow2
|
||||
|
||||
install:
|
||||
bash install.sh
|
||||
|
||||
reinstall: clean install
|
||||
|
||||
remote: rrun
|
||||
|
||||
rcopy:
|
||||
rsync -avP ./ root@$(HOST):/storage/admin/vms/
|
||||
|
||||
rrun: rcopy
|
||||
ssh -t root@$(HOST) "cd /storage/admin/vms && make reinstall"
|
||||
16
ubuntu-makevm/install.sh
Normal file
16
ubuntu-makevm/install.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
virt-install \
|
||||
--name $VMNAME \
|
||||
--ram 32768 \
|
||||
--disk path=$DISK_DIR/$VMNAME.qcow2,size=20 \
|
||||
--vcpus 8 \
|
||||
--os-type linux \
|
||||
--os-variant generic \
|
||||
--network bridge=virbr0 \
|
||||
--graphics none \
|
||||
--console pty,target_type=serial \
|
||||
--initrd-inject=preseed.cfg --extra-args "ks=file:/preseed.cfg" \
|
||||
--location 'http://us.archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/' \
|
||||
--extra-args 'console=ttyS0,115200n8 serial'
|
||||
|
||||
185
ubuntu-makevm/preseed.cfg
Normal file
185
ubuntu-makevm/preseed.cfg
Normal file
@@ -0,0 +1,185 @@
|
||||
|
||||
### Preseed for Ubuntu 18.04
|
||||
# Derived from: https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
|
||||
# Derived again from https://gist.github.com/CalvinHartwell/f2d7f5dedbfee2d7d47c583539a10859
|
||||
|
||||
d-i auto-install/enable boolean true
|
||||
|
||||
d-i debian-installer/language string en
|
||||
d-i debian-installer/locale string en_US.UTF-8
|
||||
d-i debian-installer/country string US
|
||||
d-i keyboard-configuration/xkb-keymap select US
|
||||
|
||||
d-i /choose_interface select auto
|
||||
# d-i netcfg/hostname string device
|
||||
d-i netcfg/get_hostname string unassigned-hostname
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
d-i hw-detect/load_firmware boolean true
|
||||
|
||||
### Account setup
|
||||
d-i passwd/root-login boolean true
|
||||
d-i passwd/root-password-crypted password !!
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string UTC
|
||||
d-i clock-setup/ntp boolean true
|
||||
|
||||
# LG provided NTP, should be replaced!
|
||||
d-i clock-setup/ntp-server string 10.100.202.175
|
||||
|
||||
### Partitioning
|
||||
#d-i preseed/early_command string umount /media || true
|
||||
d-i partman-auto/method string lvm
|
||||
d-i partman-auto-lvm/guided_size string max
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-lvm/confirm boolean true
|
||||
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||
d-i partman-auto-lvm/new_vg_name string vg0
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
d-i partman-md/confirm boolean true
|
||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
d-i partman-basicmethods/method_only boolean false
|
||||
|
||||
### Partitioning
|
||||
d-i partman-auto/method string lvm
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-lvm/confirm boolean true
|
||||
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||
|
||||
### Grub
|
||||
d-i grub-installer/only_debian boolean true
|
||||
d-i grub-installer/with_other_os boolean true
|
||||
|
||||
d-i partman-auto-lvm/new_vg_name string vg-root
|
||||
|
||||
|
||||
d-i partman-auto/expert_recipe string \
|
||||
custom-lvm :: \
|
||||
269 269 269 ext4 $primary{ } $bootable{ } \
|
||||
mountpoint{ /boot } \
|
||||
method{ format } \
|
||||
format{ } \
|
||||
use_filesystem{ } \
|
||||
filesystem{ ext4 } \
|
||||
. \
|
||||
2152 2152 100% linux-swap $lvmok{ } \
|
||||
lv_name{ lv_swap } \
|
||||
in_vg { vg-root } \
|
||||
method{ swap } \
|
||||
format{ } \
|
||||
. \
|
||||
8608 1 8608 ext4 $lvmok{ } \
|
||||
mountpoint{ / } \
|
||||
lv_name{ lv_root } \
|
||||
in_vg { vg-root } \
|
||||
method{ format } \
|
||||
format{ } \
|
||||
use_filesystem{ } \
|
||||
filesystem{ ext4 } \
|
||||
. \
|
||||
1076 1 1076 ext4 $lvmok{ } \
|
||||
mountpoint{ /export/home } \
|
||||
lv_name{ lv_home } \
|
||||
in_vg { vg-root } \
|
||||
method{ format } \
|
||||
format{ } \
|
||||
options/nodev{ nodev } \
|
||||
use_filesystem{ } \
|
||||
filesystem{ ext4 } \
|
||||
. \
|
||||
1076 1 1076 ext4 $lvmok{ } \
|
||||
mountpoint{ /tmp } \
|
||||
lv_name{ lv_tmp } \
|
||||
in_vg { vg-root } \
|
||||
method{ format } \
|
||||
format{ } \
|
||||
options/nodev{ nodev } \
|
||||
options/nosuid{ nosuid } \
|
||||
options/noexec{ noexec } \
|
||||
use_filesystem{ } \
|
||||
filesystem{ ext4 } \
|
||||
. \
|
||||
2152 1 2152 ext4 $lvmok{ } \
|
||||
mountpoint{ /var } \
|
||||
lv_name{ lv_var } \
|
||||
in_vg { vg-root } \
|
||||
method{ format } \
|
||||
format{ } \
|
||||
use_filesystem{ } \
|
||||
filesystem{ ext4 } \
|
||||
. \
|
||||
2152 1 2152 ext4 $lvmok{ } \
|
||||
mountpoint{ /var/log } \
|
||||
lv_name{ lv_log } \
|
||||
in_vg { vg-root } \
|
||||
method{ format } \
|
||||
format{ } \
|
||||
use_filesystem{ } \
|
||||
filesystem{ ext4 } \
|
||||
. \
|
||||
538 1 538 ext4 $lvmok{ } \
|
||||
mountpoint{ /var/log/audit } \
|
||||
lv_name{ lv_audit } \
|
||||
in_vg { vg-root } \
|
||||
method{ format } \
|
||||
format{ } \
|
||||
use_filesystem{ } \
|
||||
filesystem{ ext4 } \
|
||||
. \
|
||||
128 1 -1 ext4 $lvmok{ } \
|
||||
mountpoint{ /tmp/delete } \
|
||||
lv_name{ lv_delete } \
|
||||
in_vg { vg-root } \
|
||||
method{ format } \
|
||||
format{ } \
|
||||
use_filesystem{ } \
|
||||
filesystem{ ext4 } \
|
||||
.
|
||||
|
||||
d-i partman-lvm/confirm boolean true
|
||||
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman-auto-lvm/guided_size string max
|
||||
|
||||
### Base system installation
|
||||
d-i base-installer/install-recommends boolean true
|
||||
d-i base-installer/kernel/image string linux-generic
|
||||
d-i debconf debconf/frontend select Noninteractive
|
||||
|
||||
d-i mirror/http/hostname string 10.100.202.204
|
||||
d-i mirror/http/directory string /ubuntu
|
||||
d-i mirror/http/mirror select 10.100.202.204
|
||||
|
||||
### Package selection
|
||||
d-i tasksel/first multiselect none
|
||||
d-i pkgsel/include string openssh-server
|
||||
d-i pkgsel/upgrade select full-upgrade
|
||||
#d-i pkgsel/update-policy select unattended-upgrades
|
||||
d-i pkgsel/include string openssh-server \
|
||||
vim \
|
||||
byobu \
|
||||
git \
|
||||
tmux \
|
||||
build-essential \
|
||||
open-vm-tools \
|
||||
telnet \
|
||||
wget \
|
||||
curl \
|
||||
python
|
||||
|
||||
d-i preseed/late_command string \
|
||||
in-target sh -c 'mkdir -p --mode=0700 /root/.ssh'; \
|
||||
in-target sh -c 'curl https://sneak.cloud/authorized_keys > /root/.ssh/authorized_keys'; \
|
||||
in-target sh -c 'chmod 0600 /root/.ssh/authorized_keys'; \
|
||||
in-target sh -c 'echo "IPv4: \\\4" >> /etc/issue && echo "IPv6: \\\6" >> /etc/issue && echo "" >> /etc/issue';
|
||||
|
||||
d-i debian-installer/splash boolean false
|
||||
|
||||
### Shutdown machine
|
||||
#d-i finish-install/reboot_in_progress note
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
Reference in New Issue
Block a user