Enable Windows Features for WSL (Windows Subsistem for Linux - aka Linux on Windows)
Run on powershell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Download and Install WSL2 Patch
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
Set Default Version to Version 2
Run on powershell
wsl --set-default-version 2
Ubuntu WSL Download - Without Using Windows Store - Online Method
Open windows CMD and run:
wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl --install -d <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
openSUSE-42 openSUSE Leap 42
SLES-12 SUSE Linux Enterprise Server v12
Ubuntu-16.04 Ubuntu 16.04 LTS
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
wsl --install --distribution Ubuntu
Ubuntu WSL Download - Without Using Windows Store - Offline Method
Open windows powershell and run:
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx
Add-AppxPackage .\Ubuntu.appx
First Run and Installation
Win+r Ubuntu
Set WSL DNS to Google DNS (default is a Windows generated, which doesn't always work)
Change the DNS to Google's DNS
sudo nano /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 8.8.8.8
Avoid windows from changing the DNS server again:
sudo nano /etc/wsl.conf
[network]
generateResolvConf = false
Ansible Installation
On the ubuntu shell run:
sudo apt update
sudo apt upgrade -y
# PYTHON
sudo apt-get install python3
sudo apt install python3-pip
# ANSIBLE
sudo apt install -y software-properties-common
sudo apt install -y ansible
# ANSIBLE COMMON MODULES / LIBRARIES (OPTIONAL)
ansible-galaxy collection install cisco.ios
sudo apt-get install python3-dnspython
sudo pip install ansible-pylibssh
sudo pip install pexpect
sudo pip install paramiko
sudo apt-get install sshpass
SSH Host Key Checking
[defaults]
host_key_checking = False
Extra - Convert Install Machines to WSL2
If you already had WSL installed and some distros and want to convert then, first check your distros and versions:
wsl --list -v
NAME STATE VERSION
* Ubuntu Running 1
then change it to version two and windows will start the conversion:
wsl --set-version Ubuntu 2
Verification
WSL
Win+r ubuntu
PYTHON
python3
ANSIBLE
ansible-playbook --version
No comments:
Post a Comment