WireGuard one-click installation tutorial:
Project address: https://github.com/iwantruncom/WireGuard-install-cn
Thanks to the original authors Angristan and Comrade Zhang Gousheng.
1. Who is this tutorial suitable for?
Many beginners want to build their own VPN, but when they see words like Linux, ports, firewalls, keys, and client configuration, they feel it’s very complicated.
In fact, if you only use it yourself, or configure a private WireGuard node for your phone or computer, you don’t need a high technical threshold. The WireGuard Chinese one-click installation script introduced in this article has simplified the complex installation process into a Chinese guide, and most options can be completed by simply pressing Enter.
- Suitable for users who want to build their own private VPN
- Suitable for beginners who are not familiar with Linux commands
- Suitable for people who want to quickly connect by scanning a QR code with their phone
- Suitable for people who want to create nodes for their phones, computers, and tablets separately
2. What is WireGuard?
WireGuard is a lightweight, efficient, and modern VPN protocol. Compared to traditional VPNs, it is simpler to configure, faster, and uses fewer resources, making it very suitable for individuals to build private VPNs on VPS.
3. What do you need to prepare before installation?
VPS Recommended Configuration
| Project | Suggestion |
|---|---|
| CPU | 1 core is enough |
| Memory | 512MB or more |
| Hard disk | 5GB or more |
| Traffic | The more the better |
| System | Debian 12 or Ubuntu 22.04 is more suitable for beginners |
| Virtualization | KVM preferred |
4. Which systems are supported?
This script supports common Linux distributions, but it needs to be run with root privileges.
| System | Minimum version requirement |
|---|---|
| Debian | 10 and above |
| Ubuntu | 18.04 and above |
| Fedora | 32 and above |
| CentOS / AlmaLinux / Rocky | 8 and above |
| Oracle Linux | 8 and above |
| Arch Linux | Latest version |
| Alpine Linux | Latest version |
5. How to SSH login to VPS?
After purchasing a VPS, you need to prepare the following information:
- Server IP address
- SSH port, usually 22
- Username, usually root
- root password, or SSH private key
Assuming your server IP is 1.2.3.4, and the username is root, you can use the following command to log in:
The first time you log in, the terminal may prompt:
yes
6. WireGuard one-click installation command
After SSH logging into the VPS, please confirm that you are the root user. If you are not the root user, you can first execute:
sudo su
Then execute the following three lines of commands:
wget https://raw.githubusercontent.com/iwantruncom/WireGuard-install-cn/main/wireguard-install-cn.sh
chmod +x wireguard-install-cn.sh
./wireguard-install-cn.sh
7. How to choose during the installation process?
After running the script, a Chinese installation guide will appear. Generally, beginners do not need to modify too many parameters, and most of them can be completed by pressing Enter directly.
8. What will be done automatically after installation?
The script will automatically complete most of the configuration, and you don’t need to manually edit the WireGuard configuration file.
9. How to connect WireGuard with your phone?
iPhone users
- Open the App Store
- Search for WireGuard
- Download the official WireGuard App
- Open the App, click the + in the upper right corner
- Select “Scan QR code”
- Scan the QR code displayed in the server terminal
- Save the configuration and turn on the switch to connect
Android users
Android users can search for WireGuard on Google Play, or go to the WireGuard official website to download the APK.
WireGuard Official Client Download https://www.wireguard.com/install/X. How to connect WireGuard on a computer?
Windows, macOS, and Linux users can install the official WireGuard client and then import the .conf configuration file generated by the script.
WireGuard Windows / macOS / Linux Official Client https://www.wireguard.com/install/The client configuration file generated by the script is usually in:
/root/wg0-client-your client name.conf
XI. How to download the configuration file on Mac?
If you are using a Mac, you can execute the scp command in the local Mac terminal to download the configuration file on the server to the local download directory.
scp root@your server IP:/root/wg0-client-your client name.conf ~/Downloads/
For example:
scp [email protected]:/root/wg0-client-phone.conf ~/Downloads/
After the download is complete, open the WireGuard client and import this .conf file.
XII. How to download the configuration file on Windows?
Windows beginners recommend using WinSCP to download the configuration file, the interface is more intuitive.
WinSCP Official Website https://winscp.net/Protocol: SFTP
Host name: Your server IP
Username: root
Password: Your server password
Port: 22
XIII. How to add nodes to multiple devices?
If you have already installed it, and you want to add nodes to a second phone, computer, or tablet in the future, you don’t need to reinstall the system, just rerun the script.
./wireguard-install-cn.sh
You will see a similar menu:
Please select an operation:
1) Add a new client
2) View client list
3) Delete client
4) Uninstall WireGuard
5) Exit
XIV. Most common problem: connected, but unable to access the Internet
This is the most common problem for beginners. After many people install it, the phone WireGuard shows that it is connected, but cannot open the webpage, or the Rx receiving data in the WireGuard App is always 0 B.
Correct inbound rules
| Item | Setting |
|---|---|
| Type | Custom |
| Protocol | UDP |
| Port | WireGuard port displayed during installation, such as 51413 |
| Source | 0.0.0.0/0 |
UDP 51413 0.0.0.0/0
XV. How to determine if it is a firewall problem?
Open the WireGuard App and look at the traffic data.
Tx has data
Rx is always 0 B
This usually means that the phone has sent a request, but the server has not returned data. Common reasons include:
- The VPS security group has not released the UDP port
- The VPS system firewall intercepts UDP
- WireGuard port is filled incorrectly
- Server IP is filled incorrectly
- VPS service provider blocks UDP
Prioritize checking the security group or firewall in the VPS background.
XVI. Common check commands on the server side
If you can’t connect, you can SSH log in to the server and execute the following commands to check the WireGuard status.
systemctl status wg-quick@wg0
wg
systemctl restart wg-quick@wg0
XVII. Where is the configuration file saved?
| File | Path |
|---|---|
| Server-side configuration | /etc/wireguard/wg0.conf |
| Client-side configuration | /root/wg0-client-client name.conf |
| Parameter file | /etc/wireguard/params |
/etc/wireguard directory at will, otherwise the WireGuard configuration will be lost.
XVIII. How to uninstall WireGuard?
If you don’t want to continue using it, you can rerun the script and select uninstall after entering the management menu.
./wireguard-install-cn.sh
Then select:
4) Uninstall WireGuard
/etc/wireguard directory first.
XIX. Security instructions
- The script components are installed from the system’s official software source
- The script does not collect or upload user data
- WireGuard keys are generated locally on the server
- The client configuration file is saved on the server machine
- The configuration file permissions are set to root readable
XX. Complete process summary
Twenty-one, one-click installation command summary
After SSH login to the server, execute:
wget https://raw.githubusercontent.com/iwantruncom/WireGuard-install-cn/main/wireguard-install-cn.sh
chmod +x wireguard-install-cn.sh
./wireguard-install-cn.sh
After installation, if you need to manage the client, execute:
./wireguard-install-cn.sh
Discover more from 自由档案馆
Subscribe to get the latest posts sent to your email.

