镜像源的更换
sudo sed -i 's|https://tsinghua.edu.cn|https://mirrors.tuna.tsinghua.edu.cn/ubuntu/|g' /etc/apt/sources.list.d/ubuntu.sources && sudo apt update
echo -e "nameserver 223.5.5.5\nnameserver 8.8.8.8" | sudo tee /etc/resolv.conf
ping -c 3 mirrors.tuna.tsinghua.edu.cn
sudo apt upgrade -y
nano ~/.bashrc
按下 Ctrl + O (寫入),按 Enter 確認,再按 Ctrl + X (離開)
hostip=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
export http_proxy="http://$hostip:7890"
export https_proxy="http://$hostip:7890"
# 只抓取第一個 nameserver 的 IP
hostip=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}')
export http_proxy="http://$hostip:7890"
export https_proxy="http://$hostip:7890"
wsl --shutdown
source ~/.bashrc
阅读剩余
版权声明:
作者:anutool
链接:https://www.anutool.com/index.php/2026/04/07/%e9%95%9c%e5%83%8f%e6%ba%90%e7%9a%84%e6%9b%b4%e6%8d%a2/
文章版权归作者所有,未经允许请勿转载。
THE END