-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_commands_full
38 lines (38 loc) · 2.84 KB
/
user_commands_full
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
user_data = <<-EOF
#!/bin/bash
echo 'echo "##########################"' >> /home/ubuntu/.bashrc
echo 'echo "# #"' >> /home/ubuntu/.bashrc
echo 'echo "# Built with Terraform #"' >> /home/ubuntu/.bashrc
echo 'echo "# #"' >> /home/ubuntu/.bashrc
echo 'echo "# #"' >> /home/ubuntu/.bashrc
echo 'echo "##########################"' >> /home/ubuntu/.bashrc
sudo apt update -y && sudo apt upgrade -y
#######################"Installing Docker & compose"###########################
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo usermod -aG docker ubuntu
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
#######################"Installing certbot"####################################
yes '' | sudo add-apt-repository ppa:certbot/certbot
sudo apt install python3-certbot-nginx -y
#######################"Installing nginx and breaking it"############
sudo apt install nginx -y
sudo chown ubuntu:ubuntu /usr/share/nginx/html/ -R
sudo chown ubuntu:ubuntu /var/www/html -R
sudo bash -c 'echo "Hello!" > /var/www/html/index.html'
#######################"Setup PHP & Composer"############################################
sudo apt-add-repository ppa:ondrej/php
sudo apt update -y
sudo apt install -y php7.1 php7.1-cli php7.1-common php7.1-fpm
sudo apt install -y php7.1-mysql php7.1-dom php7.1-simplexml php7.1-ssh2 php7.1-xml php7.1-xmlreader php7.1-curl php7.1-exif php7.1-ftp php7.1-gd php7.1-iconv php7.1-imagick php7.1-json php7.1-mbstring php7.1-posix php7.1-sockets php7.1-tokenizer php7.1-mongodb
sudo apt install -y php7.1-mysqli php7.1-pdo php7.1-sqlite3 php7.1-ctype php7.1-fileinfo php7.1-zip php7.1-exif
cd ~
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
HASH=`curl -sS https://composer.github.io/installer.sig`
echo $HASH
php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
###################"Setup Supervisor"#####################################################
sudo apt install supervisor
EOF