
{{ $('Map tags to IDs').item.json.title }}
Setting Up a Secure WireGuard VPN on AlmaLinux 9
WireGuard is a modern VPN solution that is efficient, secure, and easy to configure. In this tutorial, we will walk through the steps to install and set up WireGuard VPN on AlmaLinux 9.
Prerequisites
- An instance of AlmaLinux 9 running.
- Root or sudo access to the machine.
- Basic understanding of networking concepts.
1. Updating the System
Before installation, it’s always good practice to update your system. Open your terminal and run:
sudo dnf update -y
2. Install EPEL Repository
WireGuard is available in the EPEL (Extra Packages for Enterprise Linux) repository. To enable it, run:
sudo dnf install epel-release -y
3. Install WireGuard
Now, install WireGuard using the following command:
sudo dnf install wireguard-tools -y
4. Generate Key Pairs
WireGuard uses public and private keys for authentication. Generate your keys with:
wg genkey | tee privatekey | wg pubkey > publickey
This will create two files: privatekey and publickey.
5. Configure WireGuard
Create a configuration file for WireGuard by executing:
sudo nano /etc/wireguard/wg0.conf
In this file, insert the following content:
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = [YOUR_PRIVATE_KEY]
[Peer]
PublicKey = [PEER_PUBLIC_KEY]
AllowedIPs = 10.0.0.2/32
Make sure to replace [YOUR_PRIVATE_KEY] with your generated private key and [PEER_PUBLIC_KEY] with the public key of any peer you wish to connect.
6. Start WireGuard
To start the WireGuard interface, use:
sudo wg-quick up wg0
To enable it to start on boot, run:
sudo systemctl enable wg-quick@wg0
7. Verify the Connection
Check the status of your WireGuard interface with:
sudo wg
This command will display the current configuration and connected peers.
8. Configure Firewall (if applicable)
Ensure that the firewall allows traffic on the WireGuard port (default is 51820). You can modify the firewall settings with:
sudo firewall-cmd --add-port=51820/udp --permanent
sudo firewall-cmd --reload
9. Testing the VPN
On the client side, you will need to configure it with the server’s public key and endpoint (server’s IP and port). Also, ensure to set allowed IPs accordingly.
10. Conclusion
You have successfully set up a secure WireGuard VPN on AlmaLinux 9. This setup will provide you with a fast and secure way to connect to your network remotely. Enjoy your newfound privacy and security!