DEV Community

Cover image for Setting up your own secure VPN with Amnezia VPN
Amnezia
Amnezia

Posted on

Setting up your own secure VPN with Amnezia VPN

Hi all, this is Amnezia VPN!

Many people have been asking lately: how is it possible to quickly and easily set up own VPN? We have the solution!

In this guide, we explain how to set up a VPN on your own server with a wide range of protocols using Amnezia VPN. Let’s get started!

Getting Started

First, you’ll need a server. You can find a list of recommended hosting providers along with detailed purchasing instructions on our website. Here, we’ll only outline the minimum system requirements for the server:

Operating System: Linux (Ubuntu 22.04 is suitable, but version 24 is not; Debian 11/12 also works).
Processor Architecture: x86-64
Virtualization: KVM
IPv4 Server Address
RAM: 2 GB recommended, but at least 1 GB (you can also install Amnezia VPN on a server with only 512 MB of RAM, but the number of available protocols will be reduced to three).
● No pre-installed software or control panels required.

After purchasing the server, you’ll receive the setup details: IP address, login (it should be root; a different user can be used as well, but we’ll discuss that below), and password.

  • Some hosting providers (like DigitalOcean, Amazon, etc.) may have certain ports closed by default, which might be needed by Amnezia. Therefore, you’ll need to check if port 22 (for SSH) is open. Additionally, during and after installation, make sure that the necessary TCP or UDP ports for your chosen protocol are open (for example443/TCP for OpenVPN over Cloak).

Step 1:

Download the application to the device where you want to use the VPN. You can get it from the official website or from our GitHub.

  • If you’re installing the app on a Linux system, you’ll need to make the downloaded file executable. For Ubuntu systems, you may also need to install additional libraries with the following command: apt install libxcb-cursor0 libxcb-xinerama0

Step 2:

Once the application is installed, proceed with the setup. Choose the "self-hosted VPN" option.

Image description

Step 3:

Enter the server details you received from the hosting-provider.

Image description

Let’s go into a bit more detail here:

  1. If your server’s SSH is on a non-standard port (not 22), append the port number after the IP address, separated by a colon.
  2. By default, Amnezia VPN is configured using the root user. However, if you prefer not to use root, create a separate user, add it to the sudo group, and grant it permission to run sudo commands without a password or other confirmations. If you choose this method, enter the username of the created user instead of root in the setup field.
  3. Amnezia supports certain SSH key formats. Here are the commands to generate a supported format:
ssh-keygen -t rsa -m PEM -b 2048

ssh-keygen -t rsa -m PEM -b 3072

ssh-keygen -t rsa -m PEM -b 4096

ssh-keygen -t ed25519
Enter fullscreen mode Exit fullscreen mode

Paste the PrivateKey including the lines ====BEGIN==== and ====END====.

  • Amnezia currently does not support 2FA, so if it’s enabled on your server, you’ll need to disable it.

Step 4:

Choose the protocol to install.

Image description

You can select automatic mode (Low or High), and Amnezia will install a protocol based on the category (AmneziaWG for High, and WireGuard for Low). If you select the wrong protocol, don’t worry—you can always install additional protocols (OpenVPN over Cloak, XRay, Shadowsocks, etc.) and switch between them from the server menu on the main screen.

Step 5:

After selecting the protocol or mode, wait a bit for the installation to complete.

Image description

Step 6:

Congratulations! Amnezia VPN has successfully installed the protocol on your server.

Image description

Now you can click the “Connect” button to start using the VPN on your device.

Sharing Your VPN:
But that’s not all! If you want to share VPN with others, you can use the “Share” option to allow your friends and family to use the VPN connection as well.

And that’s it! :D

In addition to VPN protocols, Amnezia also allows you to set up an SFTP storage, a WordPress-based website on the Tor network, a custom DNS server for use with the VPN, and supports split tunneling (based on IP/domains as well as applications).

Let me know if you need any other assistance!

Top comments (0)