With a VPS server, you don’t need to invest in a virtual private network subscription. Although I have a lifetime VPN subscription with a certain provider, lots of the IP address have already been blacklisted on certain sites. This is one of the downsides of sharing IP addresses with other users.
If you’re not using a dedicated VPN with a unique IP address, chances are that someone else is using that shared VPN IP address to send spam messages or carrying out some other shady activities on the internet.
I recently decided to have OpenVPN installed on my VPS server and the installation was even easier than I thought. I should warn you that if you’re going to do this on the same server you’re using to host your website, it’s best not to share the details with anyone. You don’t want your site suspended when someone starts using your server for illegal activities and the IP address is traced back to you.
There are basically four stages involved:
- Enabling TUN/TAP
- Downloading OpenVPN
- Installing OpenVPN
- Configuring OpenVPN
TUN and TAP are virtual network kernel interfaces that need to be enabled before you even get started. I believe you already have a VPS and you’re already familiar with using either PuTTY on Windows or Terminal on macOS.
1. On Terminal, access your server using ssh firstname.lastname@example.org replacing username with your real username and using the correct IP address in place of 008.008.008.008.
On PuTTY, just type in your IP address and key in your password when asked.
2. To check if TUN/TAP is enabled, run this command:
If TUN/TAP is enabled, the output should be:
cat: /dev/net/tun: File descriptor in bad state
Anything different from this means it’s not enabled. In that case, you should contact your web host.
Downloading the latest version of OpenVPN
Next, you need to download the latest version of OpenVPN to your server.
1. You need to be sure to know whether you’re on a 32-bit or 64-bit CentOS. Most web hosts these days sell 64-bit CentOS VPS.
2. You also need to get the link to the latest version of OpenVPN. You can check the download page to get the correct link. The current version is v2.5.2.
For CentOS 7 (64-bit), run this command:
For CentOS 6 (32-bit), run this command:
Again, be sure to get the latest link and replace before running this command.
3. Watch the window and the download should be done in a few seconds.
4. Note the name of the downloaded file highlighted in red in the image above. You’re now ready to install OpenVPN on your server.
Installing OpenVPN on your VPS
1. Run this command to install the package:
rpm -i openvpn-as-2.5.2-CentOS7.x86_64.rpm
Be sure you replace
openvpn-as-2.5.2-CentOS7.x86_64.rpm with the package name you noted in the previous step. This is important.
2. The output should look like this.
You need to copy Admin UI address and Client UI address to a note. You’re going to need them shortly.
3. To complete the installation, you need to set a password. Run this command:
You should be prompted to enter a new password. Be sure your password is complex.
Retype the new password and you’re almost ready to use OpenVPN.
4. To confirm you got everything right, you need to paste the Admin UI address and visit.
You should be able to see the admin dashboard.
If you don’t know much about these things, the default settings are just fine; you don’t need to change anything.
The good thing is that you can use this VPN on all your devices. To get started, visit the client UI address with your browser. If you’re using Windows or Mac, the right version is download if you select the Connect option before logging in.
The downloaded OpenVPN client is already preconfigured. Simply install and launch. Hit connect, enter your password and you’re good to go.
If you’re visiting this page with an Android phone or an iOS device, download one of the recommended OpenVPN clients on your device.
You should also go back to the page to download your preconfigured OpenVPN profile.