In this tutorial, we will discuss how to configure an OpenVPN server on Ubuntu using the Road Warrior installer, and also how to use it as a VPN on your local PC later.
Curious about how to get a VPN? Now you can also configure your own OpenVPN server on Ubuntu in an easier way thanks to the Road Warrior installer that you can use.
How to Configure an OpenVPN Server on Ubuntu
As a starting note, this tutorial was created using a server with Ubuntu 24.04 with an IP 45.32.103.127 (Vultr).
Before starting, make sure you can connect to the server you will be using as your server via SSH or console. If you are already connected to the server, you are now ready to start from the first step
1. Create and Open the OpenVPN Folder
To make it easy and ensure the configuration can be found later, you can create a folder, for example with the name /openvpn
mkdir /openvpncd /openvpn2. Download the Installer Script
Once you are in the new folder you created, you can now download the installer script
wget https://git.io/vpn -O openvpn-install.shAlso, make sure to update the permissions for the file
chmod +x openvpn-install.sh3. Run the Installer
Use bash to run the installer you downloaded previously
./openvpn-install.shSince this is your first installation, you need to determine settings like IPv4, Protocol, and others.
4. Initial Configuration
There are several things you need to configure, including:
- IPv4 Address (sometimes you cannot choose or it does not appear)
If you are using a VPS, there will usually be 3 IPs, and you can choose number 1 or the one that matches the IP you received when purchasing the VPS - Protocol
For the protocol, it is recommended to use UDP as the default - Port
For the port, you can use 1194 if using UDP, or 443 if using TCP - DNS Server
You can choose the DNS to be used, for example using Cloudflare DNS - Name [client]
Determine the client name you want to create. You can later create new clients with different names as well. Here, for example, we use the name wpgan
Once everything is filled in, you can click any key to start the installation process
When the installation process is successful, you will get information on the location of the file .ovpn which can be downloaded and used on your local PC later.
For example, because this installation was run inside the folder /openvpn and the client name is wpgan, then the client file can be found at /openvpn/wpgan.ovpn
5. Start and Enable OpenVPN
When all processes are complete, you need to start OpenVPN and also enable it so that when the server restarts or reboots, the service will run automatically
systemctl start [email protected]systemctl enable [email protected]Check and also ensure that the OpenVPN service is running
systemctl status openvpn.serviceHow to Use the OpenVPN Client
Before you start using the OpenVPN Client, whether on PC or Mobile, make sure you download and install it first from the page OpenVPN Connect.
If it is already installed, you can start from the first step of using the OpenVPN Client
1. Download the .OVPN Config
To download the config, you can use SCP via CMD or Terminal on the local PC you are using, for example
scp -P 1999 [email protected]:/openvpn/wpgan.ovpn H:/wpgan/- root: VPS username
- 192.168.1.1: Server IP address or domain
- 1999: SSH port
- /openvpn/wpgan.ovpn: location of the file to be saved
- H:/wpgan: folder that will store the file locally
For details on using SCP, you can read this page: How to Use SCP to Transfer Files
2. Import the Config
Now, open the OpenVPN application you installed, then open the Upload File menu, then Browse to select the OpenVPN config you downloaded
3. Connect OpenVPN
After the file is uploaded or imported into the OpenVPN application, click the Connect button
4. Check Your IP
Make sure you are truly connected to the VPN on your server by checking your connection IP, for example from whatismyip.com and if successful, the result will look like this
That is the easy way to configure an OpenVPN server on Ubuntu so you can create your own VPN server, allowing the VPN to be used as long as the VPS is active.
COMMENTS
Loading...