Installing OpenVPN on a server

How to set up and configure your own OpenVPN server

OpenVPN, is an open-source software application that is used to facilitate the creation of secure point-to-point or site-to-site connections in routed or bridged configurations.

As one of the most popular VPN protocols, OpenVPN offers a high level of security using state-of-the-art cryptographic algorithms and is widely adopted for both personal and business applications.

In this guide, we’ll show you how to set up your own VPN on a 20i Virtual Private Server (VPS).

Why should I run my own VPN?

Running your very own VPN provides not just enhanced control over your digital security, but also a bespoke experience tailored to your needs.

With your own VPN server, you’re in the driver’s seat. No more generic configurations or one-size-fits-all solutions.

Additionally, by running your own VPN you have full control over the server, the software, and the data handling. This means you don’t need to trust a third-party provider with your data.

Which VPS should I buy?

Choosing the right VPS spec for your OpenVPN setup largely depends on the anticipated number of concurrent users, the data throughput, and the specific use case (e.g., browsing, streaming, downloading).

Considering the location of your VPS is vital for optimal performance and access; with 20i, you’re presented with the flexibility to choose between hosting in the UK or the US.

While bandwidth is a crucial consideration for VPNs, if you choose to host with 20i, you can set those worries aside as we offer unlimited bandwidth on our VPS solutions.

Here are some recommended specs, based on how you plan on using the VPN:

Solo or Personal Use:

  • CPU: Single core is often sufficient.
  • RAM: 512MB – 1GB should suffice.
  • Storage: A basic SSD with 25GB or more is more than enough for the software and logs.

Small Group or Family Use

  • CPU: 1-2 cores.
  • RAM: 1GB – 2GB.
  • Storage: A basic SSD with 30GB or more.

Business or Larger Groups

  • CPU: 2-4 cores (or more, depending on the size of the group).
  • RAM: 2GB – 4GB or more.
  • Storage: A larger SSD, say 50GB or more, especially if logs are retained for a longer time.

Download and run the OpenVPN install script

Once you’ve purchased your VPS, it’s time to install the OpenVPN script.

Access your server via SSH, and using wget (or curl), you can fetch the script and then execute it:

wget https://git.io/vpn -O openvpn-install.sh 
sudo bash openvpn-install.sh

Configuration prompts

The script will then guide you through the setup:

  1. It’ll first ask for the public IP of your server. This can be found under ‘Account Information’ on the VPS overview page in My20i. In most cases though, the default it offers is correct, so you can press Enter.
  2. Then, it’ll prompt you to select the protocol (UDP is recommended).
  3. Next, you’ll pick a port (default is 1194).
  4. You can then select a DNS provider.
  5. Finally, you’ll be asked for a client name. Choose something you’ll remember, as this is how you’ll identify your connection.

Generating the .ovpn file

The beauty of this script is that once you’ve answered all the prompts, it’ll automatically generate an .ovpn file for you.

By default, the file will be named something like clientname.ovpn and will be located in the home directory of the user you ran the script as.

Installing the OpenVPN Client on your local device 

You’ll need to download the OpenVPN client on to the device that you’re looking to use the VPN, and then follow the steps below to import the configuration file into the client.  

You can download the client for your OS here: https://openvpn.net/client/  

Importing the File: 

  • Click on the ‘+’ icon in the bottom right corner of the client window. 
  • Select ‘File’, click browse and then select the .opvn file from the directory you saved it to. 
  • Enter a profile name and then select ‘Connect’. 

Transfer the .ovpn file to any device you want to connect to your VPN. Import this file into your OpenVPN client, and you’re good to go!

Transferring the .ovpn file from your server to your client device can be done in a few different ways, depending on the client’s device type and your preferences.

Here’s a brief guide:

Secure Copy Protocol (SCP) – for Linux/Mac:

On your local machine, use the terminal and the scp command:

scp username@your_server_ip:/path/to/clientname.ovpn /local/path/where/you/want/to/save/

SFTP Clients – for Windows:

Applications like WinSCP or FileZilla allow you to securely transfer files over SFTP.

Connect to your server using your credentials, navigate to the directory where the .ovpn file is, and then drag and drop it to your local machine.

Adding more clients or revoking access

If you want to add more clients or revoke access, simply run the openvpn-install.sh script again.

It will give you options to add another client, revoke access, or uninstall OpenVPN.

Final thoughts

This method indeed streamlines the process, especially for those who might not be familiar with every detail of VPN setup or who want a quick deployment.

Always remember, the key to a successful VPN is not just in its setup but its maintenance. Keep your server and software updated!

Deploy all your apps with great value virtual server hosting, no compromises. Our high-performance VPS include:

  • Lightning-fast speed with 100% SSD storage
  • Genuine unlimited bandwidth – no throttling, ever
  • Deploy standard distro, 1-click app or custom image
  • Manage your servers through one single, intuitive control panel
  • 100% green hosting powered by renewable energy

Find out how our VPS Hosting is the perfect choice, from personal projects to complex apps.

1 comment

  • The article’s emphasis on the benefits of running your own VPN server, such as increased control over security and data, is particularly noteworthy. Chris provides valuable insights into choosing the right VPS specs based on different usage scenarios, which is incredibly useful for readers looking to tailor their VPN setup to their specific needs.

    I also appreciate the step-by-step instructions provided throughout the article. Chris’s explanations are clear and concise, making it easy for readers like me to follow along and set up our own VPN servers with confidence.

    Overall, this article is a valuable resource for anyone interested in enhancing their digital security and enjoying a more personalized VPN experience. Kudos to Chris for delivering such a well-crafted and informative piece!