Zoecitron
Zoecitron
发布于 2024-04-25 / 84 阅读
0
0

Ubuntu服务器网络加速配置

这是一篇介绍在无GUI(纯命令行)条件下进行服务器repo访问加速配置的文章

引用自Ubuntu纯命令行走Clash终端代理(Linux同理) _ 恒HengY1毅

另外,更详细的配置dashboard可参考
Ubuntu Server利用Clash实现git代理 - wuuconix’s blog

Clash部署

# 创建环境
$ mkdir clash
$ cd clash
# 拉取下来
$ wget https://github.com/Dreamacro/clash/releases/download/v1.9.0/clash-linux-amd64-v1.9.0.gz
$ gzip -d clash-linux-amd64-v1.9.0.gz
$ mv clash-linux-amd64-v1.9.0.gz clash
# 这里clash为二进制可以运行文件了
$ chmod 755 clash
# 生成默认配置
$ ./clash -d .  # 默认配置
# 拉取机场配置
$ wget xxxx # 要么拉下来 要么自己拷贝上来
# 注意: 名称为:config.yaml
$ ./clash -d . # 就开始加载你的配置了

Clash相关指令配置

vim ~/.bashrc
alias clash_start="screen -S clash /home/xxx/clash/clash -d /home/xxx/clash/"
alias clash_stop="pkill clash"

alias proxy_on="export https_proxy=127.0.0.1:7890 && export http_proxy=127.0.0.1:7890"
alias proxy_off="unset http_proxy https_proxy"
source ~/.bashrc
$ git config --global http.proxy 'http://127.0.0.1:7890'
$ git config --global https.proxy 'https://127.0.0.1:7890'

Clash dashboard部署

docker pull dreamacro/clash
docker pull haishanh/yacd
docker run -d --name=clash -v "$PWD/config.yaml:/root/.config/clash/config.yaml" -p "7890:7890" -p "9090:9090" --restart=unless-stopped dreamacro/clash
docker run -p 1234:80 -d --name clash-dashboard haishanh/yacd
# when you need to stop clash dashboard serve

docker stop $(docker ps -q)

评论