Berikut adalah langkah-langkah untuk menginstal OpenVPN di VPS dengan sistem operasi Ubuntu 22.04:
1. Update Sistem: Pertama-tama, Anda harus memastikan bahwa semua paket sistem Anda up-to-date. Anda bisa melakukan ini dengan menjalankan perintah berikut di terminal Anda:
sudo apt update
sudo apt upgrade
2. Instal OpenVPN: Setelah sistem Anda up-to-date, Anda bisa menginstal OpenVPN dengan menjalankan perintah berikut:
cd /opt sudo wget https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh -O openvpn-install.sh
sudo chmod +x openvpn-install.sh sudo ./openvpn-install.sh
Akan muncul pertanyaan
Welcome to this OpenVPN road warrior installer! Which protocol should OpenVPN use? 1) UDP (recommended) 2) TCP Protocol [1]: 1
What port should OpenVPN listen to? Port [1194]:
Select a DNS server for the clients: 1) Current system resolvers 2) Google 3) 1.1.1.1 4) OpenDNS 5) Quad9 6) AdGuard DNS server [1]:
Pertanyaan berikutnya adalah untuk membuat akun openvpn pertama kalinya
Enter a name for the first client: Name [client]: userone
OpenVPN installation is ready to begin. Press any key to continue...
The client configuration is available in: /root/userone.ovpn New clients can be added by running this script again. Silahkan config userone.ovpn nya diambil dan ditest di client Untuk melihat lognya bisa menjalankan perintah
root@ovpn:~# tail -f /run/openvpn-server/status-server.log TITLE,OpenVPN 2.5.5 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jul 14 2022 TIME,2022-11-16 05:07:18,1668596838 HEADER,CLIENT_LIST,Common Name,Real Address,Virtual Address,Virtual IPv6 Address,Bytes Received,Bytes Sent,Connected Since,Connected Since (time_t),Username,Client ID,Peer ID,Data Channel Cipher HEADER,ROUTING_TABLE,Virtual Address,Common Name,Real Address,Last Ref,Last Ref (time_t) GLOBAL_STATS,Max bcast/mcast queue length,0 END Common Name,Real Address,Last Ref,Last Ref (time_t) GLOBAL_STATS,Max bcast/mcast queue length,0 END ,123.123.123.123:61215,2022-11-16 05:09:16,1668596956 GLOBAL_STATS,Max bcast/mcast queue length,1 END Untuk menambahkan akun baru silahkan jalankan scriptnya lagi
OpenVPN is already installed. Select an option: 1) Add a new client 2) Revoke an existing client 3) Remove OpenVPN 4) Exit Option: Semoga bermanfaat