镜像源的更换

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




阅读剩余
THE END