WireGuard: A Normal VPN Server replacing OpenVPN etc.
There is also another option to setup normal VPN Server, I choose WireGuard as an example
1. Install Wireguard
Update Debian first
sudo-iapt-getupdate&&apt-getupgrade-y
Install cloud-amd64 linux header
aptinstalllinux-headers-$(uname-r)-y
reboot once
reboot
Enable package forward
nano/etc/sysctl.conf
find #net.ipv4.ip_forward=1 and delete the # in front
Activate changes then install wireguard
Case: If there is error showing E: unable to locate package wireguard
2. Configure wireguard server
Generate key pairs (privatekey=server private key, publickey= server public key, priclikey=private client key, pubclikey=public server key)
Copy the following result of keys
Check the interface name of VPS (there should be 2, one name as "lo", we need another one)
For example: en0
Edit config file (note: eth0 should change to the name you find in previous step, in my case is en0)
Activate the server
Open UDP port : 51820 in VPS firewall
3. Generate QR code for mobile use
Install QR Code Generator (For desktop users, you can skip installing, just change the config file below)
Setup the config file for mobile device
Things to change: PrivateKey, PublicKey, PresharedKey, a.bname.com
You may type your setting in mobile directly if you want, but I'm lazy
For DNS, if you created DNS server in the same Debian server, you can change to 192.168.69.1
sudo sh -c "echo 'deb https://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware' > /etc/apt/sources.list.d/bookworm-backports.list"
apt update
apt-get install wireguard -y
cd /etc/wireguard
umask 077; wg genkey | tee privatekey | wg pubkey > publickey
umask 077; wg genkey | tee private_client_key | wg pubkey > public_client_key
umask 077; wg genpsk > presharedkey