Kelley Spoon | c2f86f5 | 2022-11-17 07:28:36 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -eu |
| 4 | apt-get -qq update |
| 5 | DEBIAN_FRONTEND=noninteractive apt-get install -qy \ |
| 6 | apt-transport-https \ |
| 7 | ca-certificates \ |
| 8 | curl \ |
| 9 | gnupg \ |
| 10 | gnupg-agent \ |
| 11 | openjdk-11-jdk-headless \ |
| 12 | python3 \ |
| 13 | python3-venv \ |
| 14 | software-properties-common \ |
| 15 | unzip |
| 16 | |
| 17 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - |
| 18 | add-apt-repository \ |
| 19 | "deb https://download.docker.com/linux/ubuntu \ |
| 20 | $(lsb_release -cs) \ |
| 21 | stable" |
| 22 | |
| 23 | apt-get -qq update |
| 24 | DEBIAN_FRONTEND=noninteractive apt-get install -qy --no-install-recommends \ |
| 25 | docker-ce \ |
| 26 | docker-ce-cli |
| 27 | |
| 28 | update-alternatives --install /usr/bin/python python /usr/bin/python3 1 |
| 29 | |
| 30 | if [ $(uname -m) = "aarch64" ] |
| 31 | then |
| 32 | AWS_ZIP=https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip |
| 33 | else |
| 34 | AWS_ZIP=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip |
| 35 | fi |
| 36 | |
| 37 | curl "$AWS_ZIP" -o "/tmp/awscli-bundle.zip" |
| 38 | unzip -q -d /tmp/awscli /tmp/awscli-bundle.zip |
| 39 | /tmp/awscli/aws/install -i /usr/local/aws |
| 40 | aws --version |
| 41 | |
| 42 | adduser ubuntu docker |
| 43 | |
| 44 | mkdir /home/ubuntu/.aws |
| 45 | echo '[default]' >> /home/ubuntu/.aws/config |
| 46 | echo 'region = us-east-1' >> /home/ubuntu/.aws/config |
| 47 | |
| 48 | # Disable unattended-upgrade |
| 49 | systemctl disable unattended-upgrades.service |
| 50 | apt-get -y remove unattended-upgrades |
| 51 | |
| 52 | sed -i -e 's/#PermitTTY.*/PermitTTY yes/g' /etc/ssh/sshd_config |
| 53 | |
| 54 | # install packer |
| 55 | wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg |
| 56 | echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list |
| 57 | sudo apt update && sudo apt install packer |