早睡早起,方能养生
Sleep early rise early, way to keep healthy

Linux安装V2Ray CentOS版本

super
2021-03-13 18:15
views 39768

更改权限:

 

su

 

1)安装unzip

 

yum install -y unzip zip

 

2)下载官方的安装脚本

 

# 官方脚本
wget https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh  --user-agent="Mozilla/5.0"

 

 

 如果报错 Unable to establish SSL connection. 安装openssl

 

yum install openssl

 

查看目录,install-release.sh为我们下载的安装脚本

 

ls

 

 

3)执行安装脚本

 

 bash install-release.sh

 

 

4)开启V2Ray

 

systemctl enable v2ray
systemctl start v2ray
systemctl status v2ray

 

绿色或者黄色小灯亮起(running)表示V2Ray已成功运行

 

 

5)修改V2Ray配置文件

 

vi /usr/local/etc/v2ray/config.json

 

基本配置如下:

 

{
	"inbound": {
    	"port": 10086,		// 监听端口号,建议更改
    	"protocol": "vmess",	// 通信协议,建议vmess
    	"settings": {
			"clients": [
        		{
	    			"id": "54f0f20d-7ff9-4dbd-ada0-fa1e27622d85",	// UUID识别码,建议使用V2Ray(客户端)重新生成
            		"level": 1,
            		"alterId": 64
        		}
			]
		}
  	},
  	"streamSettings": {
	  	"network": "tcp"
  	},
  	"outbound": {
    	"protocol": "freedom",
    	"settings": {}
  	},
  	"outboundDetour": [
		{
			"protocol": "blackhole",
      		"settings": {},
      		"tag": "blocked"
    	}
  	]
}

 

6)重启V2Ray以重载配置文件

 

systemctl stop v2ray
systemctl start v2ray

 

7)使用V2RayN客户端测试连接

 

github项目地址 (可随时关注更新)

https://github.com/2dust/v2rayN/releases

 

或者直接下载

https://github.com/2dust/v2rayN/releases/download/4.9/v2rayN-Core.zip

 

 

 

填写完成点击确定。鼠标单击选中新加的服务器(记得设置别名,便于区分),单击鼠标右键 设置为活动服务器 (或者点击Enter键)

 

 

右下角找到 V2Ray图标

 

 

系统代理 - 自动配置系统代理 (新版本:Http代理 - 开启PAC,并自动配置系统代理(PAC模式))

 

测试连接是否成功

 

注:如果无法连接,请进入服务商控制台检查网络安全组(10086)端口是否放行(本文使用为10086端口,如果使用了其他的端口,那么只需上下文一致即可)

注:本教程仅供学习交流使用,请勿用于非法用途!



分享
16 条讨论
  • evaluate

    第五步配置文件缺,实现不了

    回复
  • evaluate

    你好,有流控:xtls-rprx-vision无法使用,能联上但出现([root@localhost clashwenjian]# curl --socks5 127.0.0.1:7890 https://ipinfo.io curl: (35) Encountered end of file) v2ray.service - V2Ray Service Loaded: loaded (/etc/systemd/system/v2ray.service; disabled; vendor preset: disabled) Drop-In: /etc/systemd/system/v2ray.service.d └─10-donot_touch_single_conf.conf Active: active (running) since 四 2023-11-02 20:55:47 CST; 4s ago Docs: https://www.v2fly.org/ Main PID: 15325 (v2ray) CGroup: /system.slice/v2ray.service └─15325 /usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json 11月 02 20:55:47 localhost.localdomain systemd[1]: Started V2Ray Service. 11月 02 20:55:47 localhost.localdomain v2ray[15325]: V2Ray 5.10.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.21.3 linux/amd64) 11月 02 20:55:47 localhost.localdomain v2ray[15325]: A unified platform for anti-censorship. 11月 02 20:55:47 localhost.localdomain v2ray[15325]: 2023/11/02 20:55:47 [Warning] V2Ray 5.10.1 started [root@localhost clashwenjian]# curl --socks5 127.0.0.1:7890 https://ipinfo.io curl: (35) Encountered end of file [root@localhost clashwenjian]#

    回复
top