diff --git a/README.md b/README.md new file mode 100644 index 0000000..0003e18 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# Debian unattended install + +> **ATTENTION:** this repo is focused on my thesis work so expect some mess and low generalization. + +## Usage + +Get help: + +```sh +./regeniso-sid.sh -h +``` + +### Examples: + +> **Note:** `preseed/kube.cfg` at the moment works only with the _netinst_ image. The reason is that with the _netinst-minimal_ I should manually install some kernel modules (`cdrom` for example) and at the moment I don't know how to do this. + +Generate a _netinst_ with a _kube_ preseed: + +```sh +./regeniso-sid.sh preseed/kube.cfg netinst stable amd64 auto "bluetooth.blacklist=yes bnep.blacklist=yes" +``` + +## Initialize the VM + +Create a VM and launch the unattended install. + +Minimal requirements: + ++ 2 Cores ++ 3GB RAM (8GB for a decent experience) + +Once the unattended installation finished successfully we should prepare the environment inside the VM. + +Launch this script: + +```sh +/srv/custom/main.sh +``` + +Once it concluded successfully shut down the VM. + +Use the image of the first VM as a base and create 3 different linked volumes: + +```sh +qemu-img create -f qcow2 -b baseImage.qcow2 deltaImage.qcow2 +``` + +Create 3 clones of the base VM and associate at each one a delta image. Beware that each VM **_must_** have a different MAC address. + +Launch the 3 VM clones and in one of them (usually the first) login and then install Rancher: + +Login without polluting the _known hosts_ file: + +```sh +ssh virtualuser@ipAddress -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" +``` + +And then launch this to install Rancher: +```sh +docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --privileged rancher/rancher +``` diff --git a/custom/install_kubectl.sh b/custom/install_kubectl.sh index f7aef5a..a29f7a1 100755 --- a/custom/install_kubectl.sh +++ b/custom/install_kubectl.sh @@ -50,10 +50,15 @@ systemctl restart kubelet echo "Pulling some base images.." kubeadm config images pull -echo "Initializing kuvernetes.." +echo "Initializing kubernetes.." kubeadm init echo "Adding kubernetes config to this user home folder (useful for non-root users)..." mkdir -p "$HOME/.kube" cp -i /etc/kubernetes/admin.conf "$HOME/.kube/config" chown "$(id -u)":"$(id -g)" "$HOME/.kube/config" + +# This last one thanks to: +# https://stackoverflow.com/questions/53814150/how-to-setup-a-2-node-kubernetes-cluster-in-custom-environment + +echo "export KUBECONFIG=/etc/kubernetes/admin.conf" | tee -a ~/.bashrc diff --git a/custom/install_rancher.sh b/custom/install_rke.sh similarity index 100% rename from custom/install_rancher.sh rename to custom/install_rke.sh diff --git a/custom/main.sh b/custom/main.sh index 49d2457..e8565ba 100755 --- a/custom/main.sh +++ b/custom/main.sh @@ -11,8 +11,8 @@ eval "${SCRIPTPATH}/install_packages.sh" eval "${SCRIPTPATH}/install_docker.sh" eval "${SCRIPTPATH}/install_docker-compose.sh" eval "${SCRIPTPATH}/disable_swap.sh" -eval "${SCRIPTPATH}/install_kubectl.sh" -eval "${SCRIPTPATH}/install_rancher.sh" eval "${SCRIPTPATH}/generate_ssh_cluster.sh" +#eval "${SCRIPTPATH}/install_kubectl.sh" +#eval "${SCRIPTPATH}/install_rke.sh" apt-get clean diff --git a/preseed/preseed.cfg b/preseed/preseed.cfg index 326b273..b9cda9b 100644 --- a/preseed/preseed.cfg +++ b/preseed/preseed.cfg @@ -463,5 +463,3 @@ d-i debian-installer/exit/poweroff boolean true # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. #d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh - -d-i preseed/late_command string modprobe usb-storage isofs; mkdir -p /cdrom; mount /dev/cdrom /cdrom; cp -r /cdrom/custom /target/srv/custom