How to Install WireGuard on Manjaro

WireGuard is a free and open-source VPN protocol that is gaining popularity because of its simplicity, speed, and security. In this tutorial, we will guide you on how to install WireGuard on Manjaro.

Prerequisites

Before you proceed with the installation, make sure you have the following requirements:

Step 1: Update system

Before starting the installation, update your system using the following command:

sudo pacman -Syu

Step 2: Install WireGuard

To install WireGuard on Manjaro, run the following command:

sudo pacman -S wireguard-dkms wireguard-tools

This command will install both the WireGuard kernel module and the tools needed to configure and manage WireGuard connections.

Step 3: Generate Keys

To use WireGuard, you need to generate a private key and a public key. We will generate these keys using the wg command, which is part of the WireGuard tools.

umask 077
wg genkey | tee privatekey | wg pubkey > publickey

This command will create two files privatekey and publickey in the current directory. The umask command ensures that the private key is only accessible by the current user.

Step 4: Configure WireGuard

After generating the keys, you should create a configuration file for your WireGuard connection. You can create the configuration file using any text editor. In this tutorial, we will use the nano text editor.

sudo nano /etc/wireguard/wg0.conf

In the wg0.conf file, replace the contents with the following:

[Interface]
PrivateKey = <privatekey>
Address = <private_ip_address>/24
DNS = <dns_server_ip>

[Peer]
PublicKey = <server_publickey>
Endpoint = <server_ip_address>:<server_port>
AllowedIPs = 0.0.0.0/0, ::/0

Replace the <privatekey> with the contents of the privatekey file you generated earlier. Replace the <private_ip_address> with the local IP address you want to use for your connection, e.g., 192.168.1.2. Replace the <dns_server_ip> with your preferred DNS server address.

Replace the <server_publickey> with the public key of the WireGuard server you want to connect to. Replace the <server_ip_address> with the IP address of the WireGuard server, and <server_port> with the port that the server is listening on.

Finally, save and close the file by pressing CTRL+X, then Y, and Enter.

Step 5: Start the WireGuard Service

To start the WireGuard service, run the following command:

sudo wg-quick up wg0

This command will start the WireGuard service and activate the configuration file you created earlier. You should now be able to connect to your WireGuard server.

Conclusion

In this tutorial, you learned how to install WireGuard on Manjaro and configure a WireGuard connection. If you encounter any issues during the installation, please consult the official WireGuard documentation for further troubleshooting.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!