forked from Nyr/wireguard-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path手工安装wireguard-go方法二
81 lines (55 loc) · 2 KB
/
手工安装wireguard-go方法二
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Github地址:https://github.com/WireGuard/wireguard-go
编译安装
一些需要的软件yum install -y wget git make
如果是debian/ubuntu:apt install -y wget git make
1.安装golang1.16
wget https://golang.org/dl/go1.16.1.linux-amd64.tar.gz
tar xvf go1.16.1.linux-amd64.tar.gz -C /usr/local
cat <<EOF >> /etc/profile
#golang env config
export GO111MODULE=on
export GOROOT=/usr/local/go
export GOPATH=~/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
EOF
source /etc/profile
2.拉取代码并编译
git clone https://git.zx2c4.com/wireguard-go.git
git checkout 0.0.20201118
cd wireguard-go
make
mv wireguard-go /usr/local/sbin
下载编译好的二进制文件安装
一些需要的软件yum install -y wget
如果是debian/ubuntu:apt install -y wget
wget https://github.com/peng4740/wireguard-go-builder/releases/download/0.0.20201118/wireguard-go-linux-amd64.tar.gz
tar zxf wireguard-go-linux-amd64.tar.gz
mv wireguard-go /usr/local/sbin
rm -f wireguard-go-linux-amd64.tar.gz
二、安装wgcf
这个是用来生成warp配置的
Github地址:https://github.com/ViRb3/wgcf
安装
wget https://github.com/ViRb3/wgcf/releases/download/v2.2.2/wgcf_2.2.2_linux_amd64 -O /usr/local/sbin/wgcf
chmod +x /usr/local/sbin/wgcf
三、用wgcf生成配置
echo|wgcf register
wgcf generate
sed -i '/0\.0\.0\.0\/0/d' wgcf-profile.conf
#sed -i '/\:\:\/0/d' wgcf-profile.conf # 如果是IPV6VPS要添加IPV4则改用这个,上一条不要执行
mkdir -p /etc/wireguard
cp -f wgcf-profile.conf /etc/wireguard/wgcf.conf
安装wireguard-tools
CentOS7:yum install -y wireguard-tools
如果提示找不到包安装失败了可能是没有epel源,先安装yum install epel-release -y
其他系统其实也是差不多的
Debian、Ubuntu:apt install wireguard
没说到系统可参考官网教程:https://www.wireguard.com/install/
四、运行测试
1.启动
wg-quick up wgcf
2.测试
curl ipv6.ip.sb
如果能正常显示ip就正常
五、配置开机自启(务必要运行测试过后再配置)
systemctl enable wg-quick@wgcf