CentOS 7 安装OpenVPN

安装环境依赖:

yum install install gcc gcc-c++ libstdc++-devel autoconf automake libtool pam-devel

克隆OpenVPN源代码:

git clone https://github.com/OpenVPN/openvpn.git

配置:

./configure --prefix=/usr/local/OpenVPN --disable-lzo

编译安装:

make && make install

软连接:

ln -s /usr/local/OpenVPN/sbin/openvpn /usr/sbin/openvpn

克隆easy-rsa源代码:

git clone https://github.com/OpenVPN/easy-rsa.git

到eay-rsa的easyrsa3目录,拷贝配置:

cp vars.example vars

修改配置下面对应部分:

set_var EASYRSA_REQ_COUNTRY     "CN"
set_var EASYRSA_REQ_PROVINCE    "HUBEI"
set_var EASYRSA_REQ_CITY        "WUHAN"
set_var EASYRSA_REQ_ORG "JOYCODE"
set_var EASYRSA_REQ_EMAIL       "maxwoods@qq.com"
set_var EASYRSA_REQ_OU          "Max Woods' OpenVPN"

初始化:

./easyrsa init-pki

生成根证书:

./easyrsa build-ca

生成服务器证书:

./easyrsa gen-req server nopass

服务器证书签名:

./easyrsa sign server server

创建Diffie-Hellman:

./easyrsa gen-dh

创建客户端证书请求:

/easyrsa gen-req Ops

客户端证书导入:

./easyrsa import-req  /root/client/easy-rsa/easyrsa3/pki/reqs/Ops.req Ops

客户端证书签名:

./easyrsa sign client Ops

参考:

https://www.cnblogs.com/trymybesttoimp/p/7154319.html

最后编辑于:2019/9/9作者: 编程小战

我不入地狱,谁入地狱?

评论已关闭