Debian12上配置代理

clearmind
12
2024-12-13

Debian上配置v2ray代理

1、下载v2ray核心

curl -L -o v2ray_core_install.sh https://gh-proxy.com/raw.githubusercontent.com/ClearMind1/some_script/main/v2ray_core_install.sh && bash v2ray_core_install.sh

使用cdn.jsdelivr.net 代理下载,国内也能使用

2、简单配置

下载后执行提示中的开机启动

systemctl enable v2ray

备份并编辑配置文件,复制导入自己使用的配置(右击选择导入服务端完整配置到剪贴板)

cp /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.backup_$(date +%Y%m%d_%H%M%S)
# 输入 ggdGi 能在vim中快速删除所有
vim /usr/local/etc/v2ray/config.json

启动

systemctl start v2ray

测试是否有效

curl -x http://127.0.0.1:10809 https://www.google.com

3、常用命令

  • v2ray服务相关
systemctl start/stop/restart v2ray
  • /etc/profile 系统代理设置
# 添加系统代理
export http_proxy='[http://127.0.0.1:10809](http://127.0.0.1:10809/)'
export https_proxy='[http://127.0.0.1:10809](http://127.0.0.1:10809/)'

# 查看是否配置成功
echo $http_proxy
echo $https_proxy

# 重启配置让其生效
source /etc/profile

# 取消系统代理
unset http_proxy
unset https_proxy
  • 查看日志(有点问题)
# access
cat /var/log/v2ray/access.log
# error
cat /var/log/v2ray/error.log
动物装饰