Debian / Ubuntu: 使用 OpenVPN apt 存储库
我们维护多个 OpenVPN (OSS) 软件存储库。要设置存储库,您需要更改为根用户。通常,这是使用sudo 完成:
$ sudo -s
然后导入用于对包进行签名的公共 GPG 密钥:
$ wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg|apt-key add -
接下来,您需要创建一个源.list 片段(作为根),以便 apt 可以找到新的 OpenVPN 包。一种方法就是:
$ echo "deb http://build.openvpn.net/debian/openvpn/<version> <osrelease> main" > /etc/apt/sources.list.d/openvpn-aptrepo.list
其中<版本>可以是
- 稳定: 仅稳定版本 – 无 alpha、beta 或 RCs
- 测试: 最新版本,包括 alpha/betas/RCS
- 版本/2.3: OpenVPN 2.3 版本
- 版本/2.4: OpenVPN 2.4 版本,包括 Alphas/betas/RCs
- 版本/2.5: OpenVPN 2.5 版本,包括 Alphas/betas/RCs
和<osrelase>取决于您的分布:
- 喘息 (德比安 7.x)
- 杰西(德比安 8.x)
- 拉伸(德比安 9.x)
- 布斯特(德比安 10.x)
- 精确(Ubuntu 12.04)
- 可信(Ubuntu 14.04)
- xenial (Ubuntu 16.04)
- 仿生学 (Ubuntu 18.04)
- 焦点(Ubuntu 20.04)
此列表可能不完整。请查看存储库网页以查看完整的版本列表。
例子:
$ echo "deb http://build.openvpn.net/debian/openvpn/testing jessie main" > /etc/apt/sources.list.d/openvpn-aptrepo.list $ echo "deb http://build.openvpn.net/debian/openvpn/release/2.3 wheezy main" > /etc/apt/sources.list.d/openvpn-aptrepo.list
现在,您已设置为安装 OpenVPN。请注意,为较旧的操作系统版本构建的软件包可能在同一操作系统的较新版本上运行良好。
安装 OpenVPN
在 Debian/Ubuntu 使用
$ apt-get update && apt-get install openvpn
关于过期密钥的注意事项
如果 apt 签名密钥过期,apt 将在刷新包缓存时抱怨(例如apt-get 更新)。要解决此问题,请从 apt 密钥链中删除过期的密钥:
$ apt-key del E158C569
然后使用wget 和 apt 键添加新密钥,如上所述。然后验证新密钥是否位于钥匙串中:
$ apt-key list --- snip --- /etc/apt/trusted.gpg -------------------- pub rsa2048 2011-08-03 [SC] [expires: 2025-07-27] 30EB F4E7 3CCE 63EE E124 DD27 8E6D A8B4 E158 C569 uid [ unknown] Samuli Seppänen (OpenVPN Technologies, Inc) <samuli@openvpn.net> sub rsa2048 2011-08-03 [E] [expires: 2025-07-27]
进入 /etc/openvpn/client目录下,将 .ovpn的文件放到里面
启动服务
sudo openvpn --config /etc/openvpn/client/.ovpn
输入用户名 密码后可正常使用 可在ovpn里pass后加pass.txt 同目录下新建一个文本文件一共两行 用户名及密码以后可不在输入。
Fedora, Red Hat Enterprise Linux, CentOS, Scientific Linux
Packages for these distributions are provided via a Fedora Copr repository. Supported versions:
Distribution | Release versions |
---|---|
Fedora | 32, 33, Rawhide |
Red Hat Enterprise Linux / CentOS | 7, 8 |
If you are running Red Hat Enterprise Linux or its clones, you need to install both the Fedora EPEL repository and the yum copr module first. Instructions for enabling Fedora EPEL can be found here: https://fedoraproject.org/wiki/EPEL. Fedora releases usually have the yum/dnf copr module preinstalled.
# yum install yum-plugin-copr
With the Copr module available, it is time to enable the OpenVPN 3 Copr repository.
# yum copr enable dsommers/openvpn3
And then the OpenVPN 3 Linux client can be installed
# yum install openvpn3-client
留言