diff --git a/documents/alpine/alpine_cloud_init_setup/content.md b/documents/alpine/alpine_cloud_init_setup/content.md index 0987595..43ef821 100755 --- a/documents/alpine/alpine_cloud_init_setup/content.md +++ b/documents/alpine/alpine_cloud_init_setup/content.md @@ -35,10 +35,10 @@ reboot ## **CONFIGURATION** ## set nano as default editor -```bin +```bash apk add nano ``` -```bin +```bash echo "EDITOR=nano" > /etc/profile.d/default_editor.sh echo "export EDITOR" >> /etc/profile.d/default_editor.sh ``` @@ -46,24 +46,24 @@ save and exit log out and back in ## update repos -```bin +```bash echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" > /etc/apk/repositories echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories ``` ## update and install packages -```bin +```bash apk update && apk upgrade apk add util-linux e2fsprogs-extra qemu-guest-agent sudo cfdisk cloud-init ``` ## enable qemu-guest-agent on boot -```bin +```bash rc-update add qemu-guest-agent ``` ## add root ssh public keys -```bin +```bash mkdir /root/.ssh echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHWiw5lVzQIZiZc1SPphvHhdSpFl9UN6Xm4znFqq5xs4 server-root" > /root/.ssh/authorized_keys echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBI/kuy/SVCxShVBNtWtNREX9cpWrlsthV3z15ky+bPy winpc-root" >> /root/.ssh/authorized_keys @@ -71,20 +71,20 @@ chmod 600 /root/.ssh/* ``` ## change sshd config back to default -```bin +```bash sed -i 's/PermitRootLogin yes/#PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config ``` save and exit restart sshd -```bin +```bash /etc/init.d/sshd restart ``` log out and back in with root public key ## configure sudo -```bin +```bash visudo ``` remove comment on #%wheel ALL=(ALL:ALL) ALL @@ -92,27 +92,27 @@ remove comment on #%sudo ALL=(ALL:ALL) ALL save and exit ## configure cloud-init -```bin +```bash sed -i 's/disable_root: true/disable_root: false/g' /etc/cloud/cloud.cfg sed -i 's/groups: [adm, wheel]/groups: [adm, wheel, sudo]/g' /etc/cloud/cloud.cfg ``` -```bin +```bash nano /etc/cloud/cloud.cfg ``` remove all but NoCloud for datasource_list save and exit ## download scripts -```bin +```bash mkdir /root/scripts wget -qO /root/scripts/download-alpine-scripts.sh aknlw.com/download-alpine-scripts chmod +x /root/scripts/download-alpine-scripts.sh ``` ## **FINALIZE - DO NOT POWER BACK ON BEFORE CONVERTING TO TEMPLATE** -```bin +```bash setup-cloud-init ``` -```bin +```bash poweroff ``` \ No newline at end of file