Easy OpenVPN Setup Script for Debian Based OpenVZ VPS

What is OpenVPN?

OpenVPN is a reliable and well tested VPN solution that is able to run over a single port, supports compression, tunnels over NAT, and is very secure.

What does this script do?

This script will automatically install, configure, and add users to OpenVPN all in under 5 minutes, even with minimal Linux skills. The port forwarding, server configuration, and authentication setup is all taken care of for you.

Features

  • Automatic .ovpn file generation with inline certificates in a single file
  • Google DNS servers
  • Port 53 captive portal bypass server option

How do I install it?

1. Make sure that your VPS has its TUN module working. Run the following command to check:

cat /dev/net/tun

Your VPS TUN module is set correctly if you get this message:

cat: /dev/net/tun: No such file or directory

If not, then you need to enable it in SolusVM (or disable and re-enable it).

SolusVM OpenVZ Enable TUN

2. Copy and paste these lines into your SSH client of choice:

wget https://raw.github.com/cwaffles/ezopenvpn/master/ezopenvpn.sh --no-check-certificate -O ezopenvpn.sh; chmod +x ezopenvpn.sh; ./ezopenvpn.sh

Once it ends, you can run it again to add more users.

How can I contribute?

I’ve set up a Github repository here that you can fork and submit patches back to.

Want to just download it?

Here’s a nice download link for you:

Compatibility

Tested working in Debian 6 and 7. Recent Ubuntu versions should work as well.

Credits

This script is based on Nyr’s openvpn-install work.

Licence

This script is licensed under the MIT License.

Bookmark the permalink.
  • noah

    This needs a little more instruction, like what to do with the certificates. It doesn’t work for me, says it can’t connect immediately.

  • The opvn generated seems to be not working for openvpn android. the [inline] is causing problem. Also it does not put the correct IP/hostname at the hostname place, the use/client name still says as “client” although i changed it.
    Can you please check? Thanks

  • Fitz

    Your last instruction said TUN/TAP device is ready for use when it shows message that File descriptor in bad state. But this one said TUN is set correctly when it shows No such file or directory. So which one is correct???

  • Pingback: RamNode VPS()

  • Pingback: PPTPD 一键VPN脚本安装时错误619 | elegant ocean()

  • how can i it on openvpn gui windows

  • Pingback: debian – openvpn | Nova's NUC()