Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 19, 2022 02:54 pm GMT

How To Set Up an OpenVPN Server on Linux Server (Ubuntu)

You can easily follow this steps to have your own VPN in your server.

Image description
1 . Install docker in your server

sudo apt install docker.io

2 . Make a directory with this command

mkdir /opt/openvpn

3 . Clone the project from this repo (https://github.com/kylemanna/docker-openvpn) with this command

git clone https://github.com/kylemanna/docker-openvpn.git

4 . Pick a name for the $OVPN_DATA data volume container

OVPN_DATA="ovpn-data"

5 . Initialize the $OVPN_DATA container that will hold the configuration files and certificates. (replace VPN.SERVERNAME.COM with your server IP)

docker volume create --name $OVPN_DATAdocker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://VPN.SERVERNAME.COMdocker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn ovpn_initpki

6 . Start OpenVPN server process

docker run -v $OVPN_DATA:/etc/openvpn -d -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn

7 . Take a rest, drink water, walk :))

Image description

8 . Generate a client certificate without a passphrase (replace CLIENTNAME with what you want!)

docker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full CLIENTNAME nopass

9 . Retrieve the client configuration with embedded certificates

docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn

10 . Now you can find your .ovpn file in /opt/openvpn

Image description
11 . (Optional) Just copy files to your machine ,go to your local machine and run this command

scp root@<your-server-ip>:/opt/openvpn/CLIENTNAME.ovpn /home/azibom

If you have any questions, you can ask here:)
Share with your friends if you like


Original Link: https://dev.to/azibom/how-to-set-up-an-openvpn-server-on-linux-server-ubuntu-7e0

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To