前言
由於在壓縮磁碟的時候,一個不小心就把自己的磁碟給搞沒了,不得不重新安裝作業系統。所以打算重新配置下作業系統。
打算此系統不安裝太多內容。
由於每次滲透測試,都需要開kali,所以覺得比較麻煩,剛好趁著重新安裝作業系統,把C盤的空間給大一點,直接利用linux的windows子系統,安裝一個kali,內存消耗也小。
安裝linux子系統需要先啟用「適用於 Linux 的 Windows 子系統」可選功能,然後才能在 Windows 上安裝 Linux 分發。
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
如果是wsl1的話,需要更新到wsl2。如果已經是wsl2,那麼直接進行下面的步驟。
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
https://wslstorestorage.blob.core.windows.net/wslblob/wslupdatex64.msi
wsl --set-default-version 2
打開 Microsoft Store,輸入linux,並選擇你偏好的 Linux 分發版。
選擇相應的系統,點擊獲取即可。
首次啟動新安裝的 Linux 分發版時,將打開一個控制臺窗口,系統會要求你等待一分鐘或兩分鐘,以便文件解壓縮並存儲到電腦上。未來的所有啟動時間應不到一秒。
建立新帳戶,如下:
微軟推出的新的windows終端比以前那種醜爆的終端總體水平提高了,但還是很windows。
安裝windows終端:
https://docs.microsoft.com/zh-cn/windows/terminal/get-started
到此安裝完成。
注意:系統版本需要在2004上,下載windows易升進行升級。
字體
HACK bold:
https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Hack/Bold/complete/Hack%20Bold%20Nerd%20Font%20Complete.ttf
原生的windows終端很windows,但是可以支持自定義。效果如下:
點擊如下下拉框設置。
打開windows終端設置文件setting.json
配置文件如下:
{ "$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}",
"copyOnSelect": false,
"copyFormatting": false,
"theme": "light", "profiles": { "defaults": { "hidden": false, "name": "kali-linux", "source": "Windows.Terminal.Wsl", "backgroundImage": "C:\\Users\\olist213\\Pictures\\wallhaven-oxz575.jpg", "backgroundImageOpacity": 0.6, "backgroundImageStretchMode": "fill", "cursorShape": "vintage", "cursorColor": "#800080", "fontFace": "Hack Nerd Font" }, "list": [ { "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "name": "Windows PowerShell", "commandline": "powershell.exe", "hidden": false }, { "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "name": "Command Prompt", "commandline": "cmd.exe", "hidden": false }, { "guid": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}", "hidden": false, "name": "kali-linux", "source": "Windows.Terminal.Wsl", "backgroundImage": "C:\\Users\\olist213\\Pictures\\wallhaven-r26861.jpg", "backgroundImageOpacity": 0.6, "backgroundImageStretchMode": "fill", "cursorShape": "vintage", "cursorColor": "#800080", "fontFace": "Hack Nerd Font" }, { "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", "hidden": false, "name": "Azure Cloud Shell", "source": "Windows.Terminal.Azure" } ] },
"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" } ], "actions": [ { "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+c" }, { "command": "paste", "keys": "ctrl+v" },
{ "command": "find", "keys": "ctrl+shift+f" },
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" } ]}熟悉了配置文件,開始進行其他的美化。
安裝oh-my-posh
在powershell中輸入如下內容:
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
遇到提示直接輸入A即可。安裝完成之後,輸入如下內容:
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme PowerLine
此時,powershell的界面已經更改了,但此時的設置是針對當前用戶,退出後會重新變成以前的樣子。
在用戶的C:\Users\olist213\Documents\WindowsPowerShell目錄下,建立一個Microsoft.PowerShell_profile.ps1文件。內容如下:
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme PowerLine
那麼每次重啟都會加載此配置文件。
到此powershell美化完成。
powershell美化了,那麼linux也是可以美化的。
linux主題美化linux下的美化直接上zsh。
sudo apt-get install zsh
chsh -s /bin/zsh
繼續執行如下命令
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
報錯:
報這個錯的原因是github被DNS汙染了。通過如下方式解決。
查看github的ip,通過https://www.ipaddress.com/這個網址獲取ip地址,然後修改hosts文件。
22 │ 199.232.68.133 raw.githubusercontent.com
23 │ 140.82.112.3 github.com
zsh安裝完成後,是默認的zsh的界面。
直接使用大佬的配置文件,下載完成後,直接放到~/.zshrc中,文件連結如下:
https://raw.githubusercontent.com/daniruiz/dotfiles/master/.zshrc
報錯
將缺少的組件安裝上即可。
https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md
wget https://download.opensuse.org/repositories/shells:/zsh-users:/zsh-autosuggestions/xUbuntu_19.10/amd64/zsh-autosuggestions_0.5.0+2.1_amd64.deb
sudo dpkg -i zsh-autosuggestions_0.5.0+2.1_amd64.deb
安裝完成。
[ ! ] ZSH syntax-highlighting not installed
https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md
https://launchpad.net/ubuntu/+source/zsh-syntax-highlighting
wget https://launchpad.net/ubuntu/+archive/primary/+files/zsh-syntax-highlighting_0.7.1-2_all.deb
sudo dpkg -i zsh-syntax-highlighting_0.7.1-2_all.deb
安裝完成。
接下來安裝powerleve10k。
https://github.com/romkatv/powerlevel10k
通過zsh安裝
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
到 ~/.zshrc下設置主題
ZSH_THEME="powerlevel10k/powerlevel10k"
安裝結束。
後面如果配置文件報錯,那麼直接到~/.zshrc下面把相應的刪除即可。
lsd
https://github.com/Peltoche/lsd
wget https://github.com/sharkdp/bat/releases/download/v0.15.4/bat_0.15.4_amd64.deb
sudo dpkg -i bat_0.15.4_amd64.deb
bat
bat是cat的替代品。
wget https://github.com/sharkdp/bat/releases/download/v0.15.4/bat_0.15.4_amd64.deb
sudo dpkg -i bat_0.15.4_amd64.deb
bashtop
https://github.com/aristocratos/bashtop
sudo apt-get install bashtop
美化完成,效果如下:
順便說下新版的windows2004以上,支持hyperV和vmware之間兼容,也就是說在你的windows上直接安裝docker,同時也可以是用vmware虛擬機.
參考:
https://drasite.com/blog/Pimp my terminal
https://docs.microsoft.com/zh-cn/windows/wsl/tutorials/wsl-vscode