Différences entre les versions de « WSL LAMP 3. démarrer WSL (LAMP) en même temps que Windows »

De Wiki de la famille Lambelet
Aller à la navigation Aller à la recherche
Ligne 29 : Ligne 29 :
Suivez ensuite ce petit didacticiel :
Suivez ensuite ce petit didacticiel :
<gallery mode="slideshow" showthumbnails caption="Etapes pour créer une nouvelle tâche.">
<gallery mode="slideshow" showthumbnails caption="Etapes pour créer une nouvelle tâche.">
Image:PlanificateurTache0.png|Cliquez pour créer une tâche
Image:PlanificateurTache0.png
Image:PlanificateurTache1.png
Image:PlanificateurTache1.png
Image:PlanificateurTache2.png
Image:PlanificateurTache2.png
Image:PlanificateurTache3.png|Les 30 secondes permettent au reste du système de démarrer
Image:PlanificateurTache3.png
Image:PlanificateurTache4.png
Image:PlanificateurTache4.png
Image:PlanificateurTache5.png
Image:PlanificateurTache5.png
Image:PlanificateurTache6.png
Image:PlanificateurTache6.png
Image:PlanificateurTache7.png|Insérez votre mot de passe et c'est terminé
Image:PlanificateurTache7.png
</gallery>
</gallery>


Après toutes ces étapes, redémarrez Windows et testez votre nouvel environnement !
Après toutes ces étapes, redémarrez Windows et testez votre nouvel environnement !

Version du 15 février 2021 à 04:07

Créer un batch pour démarrer WSL2

Dans un premier temps il faut créer un fichier "startWSL.bat" contenant le code suivant :

startWSL.bat :

wsl -d Debian -u root ip addr add 192.168.50.100/24 broadcast 192.168.50.255 dev eth0 label eth0:1
netsh interface ip add address "vEthernet (WSL)" 192.168.50.10 255.255.255.0

wsl -d Debian -u root service mysql start
wsl -d Debian -u root service apache2 start

Remplacez Debian avec le nom de votre distribution WSL2.

La première ligne crée une interfaces IP virtuelle pour que Linux puisse communiquer avec Windows.

La deuxième ligne fait pareil mais dans le sens inverse et crée une interface virtuelle pour Windows avec le même masque sous réseau que Linux.

Vous pouvez modifier ces adresses IP à votre guise.

Les deux dernières lignes démarrent les services dont nous avons besoin et vous pouvez rajouter vos propres services ici.

Créer une tâche planifiée pour démarrer le script avec Windows

Cliquez sur la loupe Windows en bas à gauche et cherchez "Planificateur de Tâches". Lancez-le en tant qu'administrateur avec un clique droite.

Suivez ensuite ce petit didacticiel :

Après toutes ces étapes, redémarrez Windows et testez votre nouvel environnement !