Created
August 23, 2019 14:04
-
-
Save methbkts/7bd79a31aac139e66e0dd665a1d8b0f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Quel ip? | |
| echo -n "Entrez l'adresse ip que vous desirez utiliser : 192.168.33." | |
| read -n 2 ip | |
| echo | |
| cat > Vagrantfile << eof | |
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| Vagrant.configure("2") do |config| | |
| config.vm.box = "ubuntu/xenial64" | |
| config.vm.network "private_network", ip: "192.168.33.$ip" | |
| config.vm.synced_folder "./data", "/var/www/html" | |
| config.vm.provider "virtualbox" do |vb| | |
| vb.memory = "2048" | |
| end | |
| end | |
| eof | |
| cat > install-script.sh << eof | |
| #!/bin/bash | |
| sudo apt-get install -y language-pack-fr | |
| sudo apt-get install -y software-properties-common apache2 zip | |
| sudo a2enmod rewrite | |
| sudo systemctl restart apache2.service | |
| sudo add-apt-repository -y ppa:ondrej/php | |
| sudo apt-get update | |
| # sudo apt-get install -y --allow-unauthenticated php7.2 php7.2-cli php7.2-curl php7.2-dev php7.2-dom php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml mysql-server-5.7 | |
| sudo apt-get install -y --allow-unauthenticated php7.2 php7.2-mbstring php7.2-zip php7.2-mysql mysql-server-5.7 | |
| echo "Entrez le nom de votre base de donnée " | |
| read -e dbname | |
| #mysql -uroot -e -p $dbpassword "create database $dbname;" | |
| mysqladmin -u root -p create "\$dbname" | |
| curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
| chmod +x wp-cli.phar | |
| sudo mv wp-cli.phar /usr/local/bin/wp | |
| echo -e "Entrez le mot de passe de votre base de donnée" | |
| read -es dbpassword | |
| echo "Entrez le nom d'utilisateur de Wordpress" | |
| read -e wpuser | |
| echo "Entrez le mot de passe Wordpress" | |
| read -es wppassword | |
| echo "Entrez l'adresse email" | |
| read -e wpemail | |
| echo "Entrez l'URL de votre Wordpress" | |
| read -e wpurl | |
| echo "Entrez le titre du site" | |
| read -e wptitle | |
| echo "Voulez vous lancer l'installation? (y/n)" | |
| read -e run | |
| cd /var/www/html | |
| echo "Téléchargement de Wordpress...." | |
| wp core download --locale=fr_FR --force | |
| #wp-config | |
| wp config create --dbname=\$dbname --dbuser=root --dbpass=\$dbpassword --dbprefix=wp_ | |
| echo "Wordpress installation, veulliez patienter ...." | |
| wp core install --url=\$wpurl --title="\$wptitle" --admin_user=\$wpuser --admin_email=\$wpemail --admin_password=\$wppassword | |
| echo "Wordpress Installation Done" | |
| echo "modification des options en cours" | |
| wp option update blog_public 0 | |
| wp option update timezone_string Europe/Paris | |
| wp option update date_format 'j F Y' | |
| wp option update time_format 'G \h i \m\i\n' | |
| rm index.html | |
| sudo systemctl restart apache2.service | |
| eof | |
| #Création du dossier data | |
| mkdir data | |
| #Monter VM | |
| vagrant up | |
| #Se connecter à la VM | |
| vagrant ssh -c "bash /vagrant/install-script.sh" | |
| echo "http://192.168.33.$ip" | |
| firefox http://192.168.33.$ip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment