Skip to content

Instantly share code, notes, and snippets.

@didinahmadi
Created December 23, 2018 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save didinahmadi/0cafb9c2be792b7b96f7d2327094416a to your computer and use it in GitHub Desktop.
Save didinahmadi/0cafb9c2be792b7b96f7d2327094416a to your computer and use it in GitHub Desktop.
script provision
#!/bin/bash
sudo service apache2 stop -y
sudo apt remove apache2.* -y
sudo apt-get remove apache2 -y
sudo apt-get autoremove -y
sudo apt-get purge apache2 -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.2 -y
sudo apt-get install php7.2-mysql php7.2-mbstring -y
sudo apt-get install nginx -y
sudo apt-get install mariadb-server -y
aptitude -y install expect
MYSQL_ROOT_PASSWORD=root
SECURE_MYSQL=$(expect -c "
set timeout 10
spawn mysql_secure_installation
expect \"Enter current password for root (enter for none):\"
send \"$MYSQL\r\"
expect \"Change the root password?\"
send \"n\r\"
expect \"Remove anonymous users?\"
send \"y\r\"
expect \"Disallow root login remotely?\"
send \"y\r\"
expect \"Remove test database and access to it?\"
send \"y\r\"
expect \"Reload privilege tables now?\"
send \"y\r\"
expect eof
")
echo "$SECURE_MYSQL"
aptitude -y purge expect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment