Quickest Easiest Way to Install OpenVPN Server
| |Do you want to build your very own personal OpenVPN server but you have not much technical skill (and time) to build it from scratch? I previously posted how to manually install OpenVPN server on CentOS. I believe I explained all the steps as clear as possible but I notice there are still many comments asking some problems occur. Hence I also posted another tutorial to guide newbie installing OpenVPN-AS on Ubuntu but again it has few drawbacks like it has limitation in term of the number of users can use the VPN service.
So I started looking for another alternative until I found a cool OpenVPN Autoinstaller script by Nyr at GitHub. What makes me really impressed is the fact that the script only needs one line of command to execute. How cool is that?
Yet, the script will truly install and configure everything needed to build a working OpenVPN server. It also features multiple users which you can create and allow them to connect to special VPN server you’ve just built. Are you ready? Here’s what you need..
Requirements
- A server or VPS with at least 96MB of RAM (128MB or higher is recommended)
- Make sure it runs Debian-based distros (like Ubuntu)
- A cup of coffee and a spare time of yours
In this article I use a VPS with 96MB of RAM from BandwagonHost (the Micro-96 plan costs me $4.99 USD per year) running Debian 7 x86 Minimal template. Need recommendation? Try DigitalOcean, Ramnode or read all my recommendation here.
The Tutorial
Step 1 – Login to your VPS as root:
Step 2 – Make sure the TUN/TAP module is enabled for your VPS. You can issue this command:
cat /dev/net/tun
it should return following output:
other than output above, it means the TUN/TAP we are talking about is not enabled. It means you have to firstly enable it manually. If your VPS is based on OpenVZ virtualization and your VPS manager is SolusVM, you can simply see the option in SolusVM. Now login there and enable it:
Step 3 – Now simply issue this one line of command to start installing OpenVPN automatically:
wget git.io/vpn --no-check-certificate -O openvpn-install.sh; bash openvpn-install.sh
It will then start downloading the script:
Step 4 – It will then ask series of questions you have to answer with –mostly– yes (y) or no (n):
Step 5 – Now enter the first client username which in my example I simply use client1. You can also change that to your real name but make sure it is one word only. Once done, hit Enter and wait about 2 minutes.
A screenshot of the process..
Step 6 – And once done, you’ll see something similar to this:
That’s it.
Connecting to OpenVPN Server
First thing first, you have to download that newly created *.ovpn file to your local computer. For that, you can simply move that file to your web directory (if you have web server installed) then download it via browser. Example of mine:
cp client1.ovpn /var/www/servermom.org/public_html/
Or, you can connect to your server either via FTP or sFTP and grab a local copy of that file. Personally I prefer to use this method so I used FileZilla and downloaded the client1.ovpn file.
Next, copy that file to default OpenVPN’s configuration folder. Usually it is Program Files > OpenVPN > config.
Now launch up OpenVPN client app (OpenVPN GUI) on your computer and try to connect to your newly created VPN server.
Once connected, you can launch your favorite web browser and visit either ipchicken.com or whatismyip.com and you should now see the IP of your VPS, not your real IP. Enjoy..
very good tutorial thanx..
can i do this same on cend os with nginx?
the script is only for Debian-based distros
Does this auto start the script?
The reason I ask this is that the first day I installed this script on a vps I could connect through openvpn on my windows machine. Now days later whenever I try to connect my windows machine prompts me with “failed to connect”. The openvpn is install on the ubuntu vps but for some reason it isn’t connecting. Thanks
Hello Sawiyati,
When i try to “wget git.io/vpn –no-check-certificate -O openvpn-install.sh; bash openvpn-install.sh” i just get
–2015-02-26 19:28:01– http://git.io/vpn
Resolving git.io (git.io)… failed: Name or service not known.
wget: unable to resolve host address ‘git.io’
Any ideas ?
Thank you.
Hello Sawiyati, i wget the file, but when i run it all i get is errors about no directories ?
Thanks
Sorted, i needed to add some ip’s to my /etc/resolv.conf
Hello, thanks for the tutorial, but when i try to connect to my openvpn, it asks for a username and password? Where do I get those?
This tutorial is awesome!!! I have read and tried several out there regarding OpenVpn and most didn’t work or were so complicated that I spent several hours researchering the errors. So Bravo on this script!!!!
The only ask I have, is how to you incorporate a Dynamic DNS service such as No_IP into this install? Any help would be appreciated. Again Thank you for this EPIC script!!!
You can say thanks directly to the creator
How do I contact the creator??
Great tutorial! I was wondering if Dyn Dns can be used in this install and if so how?
Good tuts but why very slow the speed any configuration i can change so that it will be fast i have 1gbps port of vps. thanks
Hi, I have setup the VPN successfully by using this script. I can connect to VPN without any issue too. But I just cannot connect to the internet. BTW, I use port 443 to avoid possible block by some countries. Also, I have enabled the port number 443 on my VPS machine. Is there anyway I can fix this ? Thanks
Thanks for the tutorial.
How to change cipher after installation?
For this guide, is there any limit to the number of concurrent openvpn users using the vps simultaneous?
If so, boo!
If not, YAY! & what are the resources consumed per user?
Thanks!
Mam, kok udah beres tapi ga bisa buat browsing yah?
can u please teach us how to add and remove user for the openvpn server
amazing. i would like to ask how can i see the rest of my network from the server? the setup consists of a LAN 192.168.1.0/24 with gw 192.168.1.1 and the server on 192.168.1.50 (eth0) on tun0 the script creates the 10.8.0.0/24 network with gw 10.8.0.1. How can i see all the LAN 192.168.1.0/24 from a client which has an IP eg 10.8.0.2, please?