This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Mohammad Reza
You can easily follow this steps to have your own VPN in your server.
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_DATA
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://VPN.SERVERNAME.COM
docker 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 :))
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
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
This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Mohammad Reza
Mohammad Reza | Sciencx (2022-09-19T14:54:04+00:00) How To Set Up an OpenVPN Server on Linux Server (Ubuntu). Retrieved from https://www.scien.cx/2022/09/19/how-to-set-up-an-openvpn-server-on-linux-server-ubuntu/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.