Skip to content

Commit f092b54

Browse files
committed
update penginstalan wsl windows
1 parent 28f9fa7 commit f092b54

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed

script/fish.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ fish -c "sudo apt install peco"
3434
fish -c "sudo apt install fzf"
3535
fish -c "sudo apt install trash-cli"
3636

37+
38+
3739
echo "Script selesai dijalankan."
3840

41+
# tambahan untuk tema
42+
# git clone https://github.com/oh-my-fish/oh-my-fish
43+
# cd oh-my-fish
44+
# bin/install --offline
45+
# fish -c "omf install bobthefish"
46+
47+
3948
# sudo apt install curl
4049
# fish -c "sudo snap install --classic code"
4150
# curl -L github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish

windows/old wsl.ps1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Download wsl_update_x64.msi from GitHub
2+
Invoke-WebRequest -Uri "https://github.com/rezapace/LINUX/releases/download/wsl/wsl_update_x64.msi" -OutFile "$HOME\Documents\Github\wsl_update_x64.msi"
3+
4+
# Install Windows Subsystem for Linux (WSL)
5+
wsl.exe --install
6+
7+
# Enable Windows Subsystem for Linux feature
8+
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
9+
10+
# Enable Virtual Machine Platform feature
11+
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
12+
13+
# Enable Virtual Machine Platform feature using PowerShell
14+
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart
15+
16+
# Set default WSL version to 2
17+
wsl --set-default-version 2
18+
19+
# Install Ubuntu 22.04 from the Windows Package Manager (winget)
20+
winget install Canonical.Ubuntu.2204
21+
22+
# Set WSL version for the Ubuntu 22.04 instance to 2
23+
wsl.exe --set-version Canonical.Ubuntu.2204 2
24+
25+
# List installed WSL distributions
26+
wsl --list -v
27+

wsl.ps1

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Cek apakah script dijalankan dengan hak administrator
2+
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
3+
Write-Host "Script ini harus dijalankan dengan hak administrator."
4+
Exit
5+
}
6+
7+
# Fungsi untuk menjalankan perintah dengan penanganan kesalahan
8+
function Run-Command {
9+
param (
10+
[string]$command
11+
)
12+
13+
try {
14+
Invoke-Expression -Command $command -ErrorAction Stop
15+
} catch {
16+
Write-Host "Error: $_"
17+
Exit 1
18+
}
19+
}
20+
21+
# Install Windows Subsystem for Linux (WSL)
22+
Run-Command "wsl.exe --install"
23+
24+
# Enable Windows Subsystem for Linux feature
25+
Run-Command "dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart"
26+
27+
# Enable Virtual Machine Platform feature
28+
Run-Command "dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart"
29+
30+
# Enable Virtual Machine Platform feature using PowerShell
31+
Run-Command "Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart"
32+
33+
# Set default WSL version to 2
34+
Run-Command "wsl --set-default-version 2"
35+
36+
# Install Ubuntu 22.04 from the Windows Package Manager (winget)
37+
Run-Command "winget install Canonical.Ubuntu.2204"
38+
39+
# Set WSL version for the Ubuntu 22.04 instance to 2
40+
Run-Command "wsl.exe --set-version Canonical.Ubuntu.2204 2"
41+
42+
# List installed WSL distributions
43+
Run-Command "wsl --list -v"
44+
45+
# Tentukan path ke file MSI yang telah diunduh
46+
$msiFilePath = "$HOME\Documents\Github\wsl_update_x64.msi"
47+
48+
# Cek apakah file MSI ada
49+
if (Test-Path $msiFilePath) {
50+
# Instal file MSI
51+
Start-Process -Wait -FilePath msiexec.exe -ArgumentList "/i `"$msiFilePath`" /qn"
52+
Write-Host "Instalasi wsl_update_x64.msi berhasil."
53+
} else {
54+
Write-Host "File MSI tidak ditemukan: $msiFilePath"
55+
}
56+
57+
Write-Host "di sarankan untuk melakukan restart."

0 commit comments

Comments
 (0)