美文网首页收藏
apt临时使用socks5

apt临时使用socks5

作者: thepoy | 来源:发表于2022-04-13 09:55 被阅读0次

apt(有些发行版需要使用apt-get)使用socks5的命令为:

sudo apt -o Acquire::http::proxy="socks5h://127.0.0.1:1086/" update
# 或
sudo apt-get -o Acquire::http::proxy="socks5h://127.0.0.1:1086/" update

其是的host和port需要根据自己的实际情况修改。

为了使用方便,可以为此命令创建一个快捷方式。
如果你用bash:

echo "alias apt-proxy=\"sudo apt -o Acquire::http::proxy='socks5h://127.0.0.1:1086/'\"" >> ~/.bashrc
# 或
echo "alias apt-proxy=\"sudo apt-get -o Acquire::http::proxy='socks5h://127.0.0.1:1086/'\"" >> ~/.bashrc
source ~.bashrc

如果你用zsh:

echo "alias apt-proxy=\"sudo apt -o Acquire::http::proxy='socks5h://127.0.0.1:1086/'\"" >> ~/.zshrc
# 或
echo "alias apt-proxy=\"sudo apt-get -o Acquire::http::proxy='socks5h://127.0.0.1:1086/'\"" >> ~/.zshrc
source ~/.zshrc

然后就可以通过下面的命令更新或安装了:

apt-proxy update
apt-proxy install
apt-proxy upgrade

相关文章

网友评论

    本文标题:apt临时使用socks5

    本文链接:https://www.haomeiwen.com/subject/tectertx.html