將WSL系統(tǒng)更換國內(nèi)源的方法(固定路徑+國內(nèi)鏡像源+詳細(xì)教程)
1.找到wsl鏡像源
首先,我們找到自己的wsl鏡像源所在的地方,在cmd中輸入**\wsl$**
按enter可以看到自己的wsl在這里了
如果不想以后難找,可以通過給一個網(wǎng)絡(luò)映射添加網(wǎng)絡(luò)位置,這樣就可以直接進(jìn)入啦
完成之后就在網(wǎng)絡(luò)位置可以看見快捷進(jìn)入的文件夾了
打開文件夾,進(jìn)入etc/apt文件夾,可以看見sources.list這一個文件,里面就是WSL-Ubuntu默認(rèn)的apt源是國外的源。
2.替換鏡像源
以下附各類國內(nèi)鏡像源:
阿里云:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
中科大:
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
清華:
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
2.1 可以直接用記事本打開
直接將國內(nèi)鏡像ctrl+c、ctrl+v放入到sources.list里面
2.2 通過sudo進(jìn)行修改
首先cd到鏡像源目錄下,為了確保 防止出現(xiàn)錯誤,用cp進(jìn)行備份
使用sudo管理員權(quán)限,使用 vim 進(jìn)行修改:
先不要按i、a、o進(jìn)入編輯模式,如果按了可以通過esc取消。
我們先通過按ggdG這幾個字母將里面的內(nèi)容全部刪除,
注:通過按下gg后發(fā)現(xiàn)光標(biāo)移動到文件首行了。其中,gg為跳轉(zhuǎn)到文件首行;dG為刪除光標(biāo)所在行以及其下所有行的內(nèi)容。d為刪除,G為跳轉(zhuǎn)到文件末尾行;
然后按i、a、o將鏡像源復(fù)制進(jìn)去就行啦。
最后按esc,再按下:wq!就可以退出啦
3.更新鏡像源列表
一次輸入以下命令就可以更新啦
sudo apt-get update sudo apt-get upgrade
我的因為更新過了,所以很快就結(jié)束了,沒有裝過的,可能會等幾分鐘,耐心等待就可以了。
到此這篇關(guān)于將WSL系統(tǒng)更換國內(nèi)源的方法(固定路徑+國內(nèi)鏡像源+詳細(xì)教程)的文章就介紹到這了,更多相關(guān)WSL國內(nèi)源內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- win10子系統(tǒng)ubuntu(WSL) 安裝Docker的教程(圖文詳解)
- 安裝Docker Desktop報錯WSL 2 installation is incomplete的問題(解決報錯)
- Windows10安裝WSL2 Ubuntu20.04并設(shè)置docker環(huán)境的方法
- Windows 安裝和配置 WSL的方法步驟
- IDEA部署Docker到WSL2的詳細(xì)過程
- 詳解Win10 Bash/WSL調(diào)試Linux環(huán)境下的.NET Core應(yīng)用程序
- 詳解Windows?利用?WSL2?安裝?Docker?的2種方式
- Windows Server 2022 升級:WSL 子系統(tǒng)全新體驗
相關(guān)文章
chrome跳轉(zhuǎn)新頁面自動打開devtools調(diào)試工具的方法
Chrome開發(fā)者工具(DevTools)是Web開發(fā)中不可或缺的利器,為了解決頁面跳轉(zhuǎn)后無法查看初始化請求的問題,可以通過提前打開開發(fā)者工具(devtools)并設(shè)置保留日志來實現(xiàn),文中通過圖文介紹的非常詳細(xì),需要的朋友可以參考下2024-10-10多種語言(big5\gbk\gb2312\utf8\Shift_JIS\iso8859-1)的網(wǎng)頁編碼切換解決方案歸納
多種語言(big5\gbk\gb2312\utf8\Shift_JIS\iso8859-1)的網(wǎng)頁編碼切換解決方案歸納2012-06-06