Last active
April 21, 2023 22:17
-
-
Save josephbolus/619d6988bdf536740351518a3187ac39 to your computer and use it in GitHub Desktop.
WSL2 Rocky Linux and Windows Terminal Install
This file contains 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 | |
read -r -p "Enter your desired username: " USERNAME | |
dnf install -y nano mc sudo dnf-plugin-config-manager wget dnf-plugins-core tree dos2unix | |
adduser $USERNAME | |
passwd $USERNAME | |
usermod -aG wheel $USERNAME | |
newgrp wheel | |
echo "Update Windows Terminal setting to auto login $USERNAME" |
This file contains 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
@echo off | |
echo Create and cd to WSL tmp folder | |
mkdir c:\tmp\wsl | |
cd c:\tmp\wsl | |
echo Download Rocket Linux 9 Base x86_64 image | |
curl.exe -L -o Rocky-9-Container-Base.latest.x86_64.tar.xz https://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-Container-Base.latest.x86_64.tar.xz | |
echo Extract tar.gz | |
pushd c:\Program Files\7-Zip | |
7z x "c:\tmp\wsl\Rocky-9-Container-Base.latest.x86_64.tar.xz" -oc:\tmp\wsl | |
echo Create the directory where the WSL will Rocky-9 files | |
mkdir %userprofile%\AppData\RockyLinux9 | |
echo Import RockyLinux9 image | |
wsl --import RockyLinux9 c:\Users\%username%\AppData\RockyLinux9 c:\tmp\wsl\Rocky-9-Container-Base.latest.x86_64.tar --version 2 | |
echo Cleanup | |
del c:\tmp\wsl\Rocky-9-Container-Base.latest.x86_64.tar | |
This file contains 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
#Install the missing library VCLibs | |
Add-AppxPackage 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' | |
#Download the Terminal package from GitHub | |
$url = 'https://github.com/microsoft/terminal/releases/latest' | |
$request = [System.Net.WebRequest]::Create($url) | |
$response = $request.GetResponse() | |
$tagUrl = $response.ResponseUri.OriginalString | |
$version = $tagUrl.split('/')[-1].Trim('v') | |
$fileName = "Microsoft.WindowsTerminal_Win10_$($version)_8wekyb3d8bbwe.msixbundle" | |
###Create the download link | |
$downloadUrl = $tagUrl.Replace('tag', 'download') + '/' + $fileName | |
###Download the package to the Downloads folder of current logged on user | |
New-Item -Path ~/Downloads -ItemType Directory -Force | |
Invoke-WebRequest -Uri $downloadUrl -OutFile ~/Downloads/$fileName | |
###Install the Windows Terminal package | |
Add-AppxPackage -Path ~/Downloads/$fileName | |
#Verify the installation | |
Get-AppPackage -Name "*Terminal*" | Format-Table | |
Get-AppPackage -Name "*Microsoft.VCLibs*" | Format-Table |
This file contains 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 | |
# Set Docker Package Source | |
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo | |
# Run system update to rebuild DNF cache: | |
sudo dnf update | |
# Use misc tools and dependencies | |
sudo dnf install -y nano mc sudo dnf-plugin-config-manager wget dnf-plugins-core tree dos2unix iptables-legacy | |
# Use DNF to install Docker on Rocky Linux 9 | |
sudo dnf install -y docker-ce docker-ce-cli containerd.io | |
# Add user to docker group | |
sudo usermod -aG docker $USER | |
# Switch to legacy iptables | |
echo -> "Select iptables-legacy..." | |
sleep 2 | |
update-alternatives --config iptables | |
# Prepare a shared directory | |
DOCKER_DIR=/mnt/wsl/shared-docker | |
sudo mkdir -pm o=,ug=rwx "$DOCKER_DIR" | |
sudo chgrp docker "$DOCKER_DIR" | |
printf "\n[user]\ndefault = $USER\n" | sudo tee -a /etc/wsl.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment