✅ How to get your OpenVPN VPN server easily and simply? ✅
In this article, we will cover a quick and easy installation of an OpenVPN VPN server via Docker on a Linux VPS.
The article will be adapted for Debian 12, Ubuntu 22.04, CentOS 8/9, AlmaLinux 9.2 based on some of the WireGuard server limitations and needs.
For the VPN server you can use any of our tariffs: https://sebekvps.com/.
1️⃣ Choose a tariff, order a server, get connection data.
2️⃣ Connect to our server via SSH (article how to connect to a server via SSH).
3️⃣ Now we will execute the following commands:
If you have Debian 12, Ubuntu 22.04:
❗️❗️ Write 1 command at a time, do not copy all commands at once ❗️❗️
- Update the package listapt update -y
- Update the system packagesapt upgrade -y
Wait for the upgrade to complete.
- Install the required packagesapt install wget curl sudo -y
- Install Dockercurl -sSL https://get.docker.com/ | CHANNEL=stable bash
- Activate Dockersystemctl enable --now docker
If you have CentOS 8/9, AlmaLinux 9.2
❗️❗️ Write 1 command at a time, don't copy all commands at once ❗️❗️
- Update package listyum update -y
- Update system packagesyum upgrade -y
Wait for the upgrade to finish.
- Install the required packagesyum install epel-release -y
- Update the list of packages againyum update -y
- Install the required packagesyum install wget curl sudo -y
- Install Dockercurl -sSL https://get.docker.com/ | CHANNEL=stable bash
- Activate Dockersystemctl enable --now docker
⬇️ ⬇️ ⬇️
Start VPN OpenVPN server via Docker on VPS Linux and connect to it
Let's create a working folder for our OpenVPN server, our connection profiles will be generated there.mkdir /home/openvpn-server
Set the preferred port for OpenVPN server operation
port=9998
Let's start initialisation of containers for config and certificate generation.docker run -v /home/openvpn-server:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://$(curl https://ipv4.icanhazip.com/):$port -e "duplicate-cn"
At this point, you will be prompted for a few questions. The container will ask for a passphrase to protect the private key used by the certificate authority. You will need to come up with a passphrase and specify it. It is important that you remember this password, because you will need it to generate client configs.
docker run -v /home/openvpn-server:/etc/openvpn --rm -it kylemanna/openvpn ovpn_initpki
Specify your passphrase 2 times and certificate generation will start.
After the generation is complete, you will be asked for the password you specified again
repeat it again 2 times and you will see the initialisation successfully completed.
Now let's start the VPN server.docker run --name=openvpn-server -v /home/openvpn-server:/etc/openvpn -d -p $port:1194/udp --restart unless-stopped --cap-add=NET_ADMIN kylemanna/openvpn
Let's generate a client certificate without a passphrase, but you will still be asked for the password you specified during the initialisation phase, you need to specify it.
In this case, SebekVPS and SebekVPS.ovpn is our openvpn user name, you can specify your name there if you wish.
docker run -v /home/openvpn-server:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full SebekVPS nopass
Getting the client configuration with embedded certificatesdocker run -v /home/openvpn-server:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient SebekVPS > /home/openvpn-server/SebekVPS.ovpn
You now have an OpenVPN client profile at /home/openvpn-server/SebekVPS.ovpn to connect to the VPN server.
You can upload the config directly from your terminal to a file share and share it.curl --upload-file /home/openvpn-server/SebekVPS.ovpn https://transfer.sh/SebekVPS.ovpn ; echo ""
Promo code: KNOWLEDGE_BASE
Select a plan: ➡️ https://sebekvps.com/.
All you need to do is import the config into the openvpn client and connect to the server, it's already working!
By default, the OpenVPN server allows 1 connection per VPN profile, but you can fix this by allowing any number of users to connect per VPN profile.
We need to specify the duplicate-cn variable in our VPN server config.echo "duplicate-cn" >> /home/openvpn-server/openvpn.conf
now restart our container with openvpn serverdocker restart openvpn-server
Now you can connect more than 1 device at a time using the same VPN profile without any problems.
SUBSCRIBE TO OUR CHANNEL
(there's a lot of useful content)
Promo code: KNOWLEDGE_BASE
Select a plan: ➡️ https://sebekvps.com/