Forked from anonymous/Debian_Ubuntu_Raspberry_ Pi_OpenVPN_MysteriumNetwork
Created
August 2, 2017 10:35
-
-
Save kang000feng/dc69296c23b86b1a80fe04b3f604d70b to your computer and use it in GitHub Desktop.
Debian 8 && Ubuntu 14.04 && Raspberry Pi 2/3 及更高版本源码编译安装 OpenVPN 和 Mysterium Network(密链网络)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Debian 8 && Ubuntu 14.04 && Raspberry Pi 2/3 及更高版本源码编译安装 OpenVPN 和 Mysterium Network(密链网络) | |
OpenVPN 部分适用于服务器端和客户端,也适用于 Raspberry Pi 2/3,如果提权麻烦可以切换成 root | |
首先更新系统并安装依赖包: | |
$ sudo apt-get update | |
$ sudo apt-get install autoconf automake libtool libssl-dev liblz4-dev liblz4-tool liblzo2- dev libpam0g-dev | |
$ wget https://swupdate.openvpn.org/community/releases/openvpn-2.4.2.tar.gz | |
$ tar xvf openvpn-2.4.2.tar.gz | |
$ cd openvpn-2.4.2 | |
$ ./configure | |
$ sudo make | |
$ sudo make install | |
OpenVPN 已安装完成,安装 Mysterium Node | |
$ wget https://github.com/MysteriumNetwork/node/releases/download/0.0.6/mysterium-node_linux_amd64.deb | |
$ sudo dpkg -i mysterium-node_linux_amd64.deb | |
$ sudo apt-get install --fix-broken | |
先启动 mysterium-node 服务并查看状态 | |
$ sudo service mysterium-node start | |
$ sudo service mysterium-node status | |
查看状态时应该有红色报错内容,不用理会,暴力杀死 mysterium-node 和 OpenVPN 进程 | |
$ sudo service mysterium-node stop | |
$ sudo pkill mysterium-node | |
$ sudo pkill OpenVPN | |
设置节点的 Key,可以是一段 8 位或 10 位的随机字符,长短和内容都不太要紧 | |
$ sudo vi /etc/default/mysterium-node | |
在 =(等号)后面加上节点名称 | |
MYSTERIUM_SERVER_NODE=zifu12kjg8 | |
拷贝 mysterium-node 生成的证书 | |
$ sudo cp /etc/mysterium-node/ca.crt /etc/mysterium-node/client.crt | |
$ sudo cp /etc/mysterium-node/ca.key /etc/mysterium-node/client.key | |
启动 mysterium-node 服务 | |
$ sudo mysterium_server --config-dir=/etc/mysterium-node --node=zifu12kjg8 | |
如果用 service mysterium-client start 或 service mysterium-client restart 启动服务 | |
可能失败,改为手动,或用 pm2 后台值守进程,我通常同 pm2 启动 shell 脚本,编辑一个脚本 mysterium.sh | |
#!/bin/bash | |
mysterium_server --config-dir=/etc/mysterium-node --node=zifu12kjg8 | |
保存后用 pm2 后台启动 | |
$ chmod +x mysterium.sh | |
$ pm2 start mysterium.sh | |
$ pm2 startup | |
$ pm2 update | |
查看进程是否正常,如果列表中有绿色内容就没问题 | |
$ pm2 list | |
完成的话就可以通过客户端测试,以下是客户端部分,Debian && Ubuntu && Raspberry Pi | |
如果已经有 OpenVPN 就方便了,没有的话要编译 OpenVPN 2.4.2,编译安装方法同服务器端一样 | |
OpenVPN 可用后,下载编译好的客户端二进制文件或 deb 安装包,推荐编译好的客户端,Raspberry Pi 用 arm 版 | |
$ wget https://github.com/MysteriumNetwork/node/releases/download/0.0.6/mysterium_client_linux_amd64 | |
$ chmod +x mysterium_client_linux_amd64 | |
启动客户端,会自动调用 OpenVPN,不用其他设置 | |
$ ./mysterium_client_linux_amd64 --node=zifu12kjg8 | |
几十秒的连接时间,如果打印的命令末尾是 itialization Sequence Completed,说明连接成功了,测试是否翻墙成功 | |
$ curl https://ping.pe | |
倒数几行显示 Your IP: 123.123.123.123, IP Location: United States 或其他 IP 和国家,说明翻墙成功了。 | |
另外,如果编译 OpenVPN 觉得麻烦,用一键安装脚本 | |
$ wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh | |
macOS 可以安装 OpenVPN 2.4.2,但 mysterium_client 调用麻烦,可以安装客户端 Tunnelblick,再启动 mysterium_client_osx_amd64 就没问题 | |
时间仓促,加上懂得少、文笔差,以上内容可能有错误之处,也不能保证完全无误,请各位操作时遇到问题多 Google 搜索。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment