日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Ubuntu >内容正文

Ubuntu

debian换源_WSL2安装Debian(Ubuntu)并配置国内apt源

發布時間:2025/3/15 Ubuntu 59 豆豆
生活随笔 收集整理的這篇文章主要介紹了 debian换源_WSL2安装Debian(Ubuntu)并配置国内apt源 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

從我本科學編程以來一直用的mac,配環境都用homebrew,省心到都不曉得外面的世界多險惡。最近得到一臺windows,需要在上面配置開發環境,把過程記錄下來免得下次重裝機時忘了。

一、安裝WSL和Debian並切換至WSL2

  • 在“啟用或關閉Windows功能”中啟用以下兩個選項:Windows虛擬機平臺、適用于Linux的Windows子系統。
  • 在Windows應用商店中選擇需要安裝的Linux發行版。(我選Debian)
  • 打開Debian,完成安裝。(這步很多教程沒有強調,是先安裝Linux再轉換WSL2)
  • 在PowerShell中運行以下指令,將WSL1轉換成WSL2
  • 2 wsl —set-default-version

    二、切換Debian的apt-get至國內源

    1. 用預設源做sudo apt-get update(不能一開始就換源!否則換源後需要的ca-certificates組件沒辦法裝)

    sudo apt-get update

    2. 安裝ca-certificates,Debian Buster(10) 版開始己經不需要apt-transport-https

    sudo apt-get install ca-certificates

    3. 打開內建的vim,編輯/etc/apt/sources.list,注意是vi不是vim

    sudo vi /etc/apt/sources.list

    4. 將以下內容取代原本的,記得先備份([trusted=yes]很重要)。內建的vim有bug,Insert模式下按方向鍵會輸出ABCD,所以正確姿勢是按dd清除每一行,按i進入insert,按右鍵黏貼,按esc退出insert,:wq保存後離開。

    deb [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free # deb-src [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free deb [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free #deb-src [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free deb [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free # deb-src [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free deb [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free # deb-src [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free

    5. 幹掉坑爹內建vim,換成完整版,測試一下換源是否成功。

    sudo apt-get update sudo apt-get remove vim-common sudo apt-get install vim

    三、Shell從bash換成zsh

    最難的換源己經結束,再來要把預設shell換成用習慣的zsh + oh-my-zsh,找篇ubuntu安裝zsh的教學照做即可。(debian換shell方式同ubuntu)

    Ubuntu 16.04下安裝zsh和oh-my-zsh?www.cnblogs.com

    四、安裝pyenv和Python3

    同樣找篇教學照做即可,如果己經換了shell,要在~/.zshrc更新pyenv的PATH而不是~/.bashrc。

    https://blog.csdn.net/wanyu_lss/article/details/81138268?blog.csdn.net

    總結

    還是homebrew好。

    參考資料

    量子位:微軟更新Linux子系統,編譯WSL 2內核只需3步

    Tsinghua Open Source Mirror

    總結

    以上是生活随笔為你收集整理的debian换源_WSL2安装Debian(Ubuntu)并配置国内apt源的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。