Skip to content

Instantly share code, notes, and snippets.

@methbkts
Last active March 15, 2022 08:59
Show Gist options
  • Select an option

  • Save methbkts/6582bc9d2c68abba45a97142bb3b4c12 to your computer and use it in GitHub Desktop.

Select an option

Save methbkts/6582bc9d2c68abba45a97142bb3b4c12 to your computer and use it in GitHub Desktop.
#!/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.3 php7.3-mbstring php7.3-zip php7.3-mysql mysql-server-5.7
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