v2ray、v2fly手动安装
Linux 安装脚本
以下指令假设已在 su 环境下,如果不是,请先运行 sudo su。
依赖软件
安裝 cURL
# apt update
# apt install curl
OR
# yum makecache
# yum install curl
OR
# dnf makecache
# dnf install curl
OR
# zypper refresh
# zypper install curl
下载安装
bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
会安装以下文件
installed: /usr/local/bin/v2ray
installed: /usr/local/bin/v2ctl
installed: /usr/local/share/v2ray/geoip.dat
installed: /usr/local/share/v2ray/geosite.dat
installed: /usr/local/etc/v2ray/config.json
# installed: /usr/local/etc/v2ray/00_log.json
# installed: /usr/local/etc/v2ray/01_api.json
# installed: /usr/local/etc/v2ray/02_dns.json
# installed: /usr/local/etc/v2ray/03_routing.json
# installed: /usr/local/etc/v2ray/04_policy.json
# installed: /usr/local/etc/v2ray/05_inbounds.json
# installed: /usr/local/etc/v2ray/06_outbounds.json
# installed: /usr/local/etc/v2ray/07_transport.json
# installed: /usr/local/etc/v2ray/08_stats.json
# installed: /usr/local/etc/v2ray/09_reverse.json
installed: /var/log/v2ray/
installed: /var/log/v2ray/access.log
installed: /var/log/v2ray/error.log
installed: /etc/systemd/system/v2ray.service
installed: /etc/systemd/system/v2ray@.service
脚本运行完成后,你需要:
- 编辑 /usr/local/etc/v2ray/config.json 文件来配置你需要的代理方式;
- 运行 service v2ray start 来启动 V2Ray 进程;
- 之后可以使用 service v2ray start|stop|status|reload|restart|force-reload 控制 V2Ray 的运行。
启动并设置开机自启
systemctl start v2ray
systemctl enable v2ray
安裝和更新 V2Ray
# bash install-release.sh
安裝最新发行的 geoip.dat 和 geosite.dat
# bash install-dat-release.sh
移除 V2Ray
# bash install-release.sh --remove
参数
usage: install-release.sh [--remove | --version number | -c | -f | -h | -l | -p]
[-p address] [--version number | -c | -f]
--remove Remove V2Ray
--version Install the specified version of V2Ray, e.g., --version v4.18.0
-c, --check Check if V2Ray can be updated
-f, --force Force installation of the latest version of V2Ray
-h, --help Show help
-l, --local Install V2Ray from a local file
-p, --proxy Download through a proxy server, e.g., -p http://127.0.0.1:8118 or -p socks5://127.0.0.1:1080
从旧版v2ray改为新版v2fly
- 请确保你正在使用主流且不过时的发行版。
停止 V2Ray 服务
# systemctl disable v2ray.service --now
移除原有文档(如要保留原配置文档请先保存/etc/v2ray/config.json
)
# rm -rf /usr/bin/v2ray/
# rm -rf /etc/systemd/system/v2ray.service
# rm -rf /lib/systemd/system/v2ray.service
# rm -rf /etc/init.d/v2ray
# rm -rf /etc/v2ray/
# rm -rf /var/log/v2ray/