WSL安装流程 Windows下的linux
1.开启对应Windows功能(适用于linux的Windows子系统)
2.微软商店对应下载 Windows terminal 、 ubantu
3.设置 Windows terminal
ubantu:把下面这个加到/root/.bashrc
里
#Fix mkdir command has wrong permissions
if grep -q Microsoft /proc/version; then
if [ "$(umask)" == '0000' ]; then
umask 0022
fi
fi
Windows terminal: 可将以下提供的配置文件直接复用到设置里 以后打开Windows terminal默认打开 ubantu
// This file was initially generated by Windows Terminal 1.3.2651.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"theme": "dark",
"useTabSwitcher": false,
"tabWidthMode": "equal",
"confirmCloseAllTabs": true,
"launchMode": "maximized",
"showTabsInTitlebar": true,
"snapToGridOnResize": false,
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles": {
"defaults": {
// Put settings here that you want to apply to all profiles.
},
"list": [
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "命令提示符",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
// "backgroundImageAlignment": "center" ,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl",
"startingDirectory": "\\\\wsl$\\Ubuntu\\home\\renketong",
"acrylicOpacity": 0.7,
"colorScheme": "Campbell",
//"cursorColor": "#000000",
"fontFace": "Cascadia Code PL",
"fontSize": 12,
"useAcrylic": true,
"cursorShape": "vintage",
"antialiasingMode": "cleartype",
"backgroundImage": "C:\\Users\\hhh\\Pictures\\Saved Pictures\\xbox.jpg",
"backgroundImageOpacity": 0.65,
"historySize": 1000000000
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": true,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [
{
"name": "Frost",
"background": "#FFFFFF",
"black": "#3C5712",
"blue": "#17b2ff",
"brightBlack": "#749B36",
"brightBlue": "#27B2F6",
"brightCyan": "#13A8C0",
"brightGreen": "#89AF50",
"brightPurple": "#F2A20A",
"brightRed": "#F49B36",
"brightWhite": "#741274",
"brightYellow": "#991070",
"cyan": "#3C96A6",
"foreground": "#000000",
"green": "#6AAE08",
"purple": "#991070",
"red": "#8D0C0C",
"white": "#6E386E",
"yellow": "#991070"
},
{
"name": "Raspberry",
"background": "#3C0315",
"black": "#282A2E",
"blue": "#0170C5",
"brightBlack": "#676E7A",
"brightBlue": "#80c8ff",
"brightCyan": "#8ABEB7",
"brightGreen": "#B5D680",
"brightPurple": "#AC79BB",
"brightRed": "#BD6D85",
"brightWhite": "#FFFFFD",
"brightYellow": "#FFFD76",
"cyan": "#3F8D83",
"foreground": "#FFFFFD",
"green": "#76AB23",
"purple": "#7D498F",
"red": "#BD0940",
"white": "#FFFFFD",
"yellow": "#E0DE48"
},
{
"name": "Campbell",
"cursorColor": "#FFFFFF",
"selectionBackground": "#FFFFFF",
"background": "#0C0C0C",
"foreground": "#CCCCCC",
"black": "#0C0C0C",
"blue": "#0037DA",
"cyan": "#3A96DD",
"green": "#13A10E",
"purple": "#881798",
"red": "#C50F1F",
"white": "#CCCCCC",
"yellow": "#C19C00",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5"
},
{
"name": "Retro",
"background": "#000000",
"black": "#00ff00",
"blue": "#00ff00",
"brightBlack": "#00ff00",
"brightBlue": "#00ff00",
"brightCyan": "#00ff00",
"brightGreen": "#00ff00",
"brightPurple": "#00ff00",
"brightRed": "#00ff00",
"brightWhite": "#00ff00",
"brightYellow": "#00ff00",
"cyan": "#00ff00",
"foreground": "#00ff00",
"green": "#00ff00",
"purple": "#00ff00",
"red": "#00ff00",
"white": "#00ff00",
"yellow": "#00ff00"
}
],
// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions": [
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
// {
// "command": {
// "action": "copy",
// "singleLine": false
// },
// "keys": "ctrl+c"
// },
// {
// "command": "paste",
// "keys": "ctrl+v"
// },
// Press Ctrl+Shift+F to open the search box
{
"command": "find",
"keys": "ctrl+shift+f"
},
{
"command": "nextTab",
"keys": "ctrl+tab"
},
{
"command": "prevTab",
"keys": "ctrl+shift+tab"
},
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{
"command": {
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"keys": "alt+shift+d"
}
]
}
wsl安装kubectl helm (前提:Windows安装Windows版docker并启动)
#准备配置文件
cp /mnt/d/build-agent/kube-config-template.yml .
export KUBECONFIG=/root/linux-amd64/kube-config-template.yml
chmod 600 /root/linux-amd64/kube-config-template.yml
#部署helm
wget https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz
tar zxvf helm-v3.5.2-linux-amd64.tar.gz
mv linux-amd64/helm /usr/bin/
source <(helm completion bash)
#添加变量到.bashrc
alias docker='docker.exe'
alias kubectl='kubectl.exe'
export KUBECONFIG=/root/linux-amd64/kube-config-template.yml
source <(kubectl completion bash)
source <(helm completion bash)
更新
#挂载Windows目录
sudo mount -t drvfs d: /mnt/d
参考文档
WSL(Ubuntu on Windows) 中进入/mnt/c /mnt/d 内容为空:https://www.v2ex.com/amp/t/528970
安装完成可以设置背景图片从微软的图库获取:https://wallpaperhub.app/wallpapers/