{"id":15031252,"url":"https://github.com/hwdsl2/wireguard-install","last_synced_at":"2025-05-14T14:08:15.979Z","repository":{"id":40646437,"uuid":"494305627","full_name":"hwdsl2/wireguard-install","owner":"hwdsl2","description":"WireGuard VPN server installer for Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS, Fedora, openSUSE and Raspberry Pi OS","archived":false,"fork":false,"pushed_at":"2025-05-11T21:57:51.000Z","size":643,"stargazers_count":1443,"open_issues_count":0,"forks_count":313,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-11T22:28:42.735Z","etag":null,"topics":["bash","centos","debian","encryption","linux","network","raspberry-pi","security","shell","ubuntu","vpn","vpn-client","vpn-server","wireguard"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hwdsl2.png","metadata":{"funding":{"github":"hwdsl2","ko_fi":"hwdsl2"},"files":{"readme":"README-zh.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-05-20T03:19:30.000Z","updated_at":"2025-05-11T21:57:55.000Z","dependencies_parsed_at":"2024-07-28T21:28:04.514Z","dependency_job_id":"3b60122f-133c-453a-b51f-23b74179afda","html_url":"https://github.com/hwdsl2/wireguard-install","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwdsl2%2Fwireguard-install","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwdsl2%2Fwireguard-install/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwdsl2%2Fwireguard-install/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwdsl2%2Fwireguard-install/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hwdsl2","download_url":"https://codeload.github.com/hwdsl2/wireguard-install/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254159691,"owners_count":22024564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","centos","debian","encryption","linux","network","raspberry-pi","security","shell","ubuntu","vpn","vpn-client","vpn-server","wireguard"],"created_at":"2024-09-24T20:15:16.379Z","updated_at":"2025-05-14T14:08:15.969Z","avatar_url":"https://github.com/hwdsl2.png","language":"Shell","funding_links":["https://github.com/sponsors/hwdsl2","https://ko-fi.com/hwdsl2","https://ko-fi.com/post/Support-this-project-and-get-access-to-supporter-o-X8X5FVFZC"],"categories":[],"sub_categories":[],"readme":"[English](README.md) | [中文](README-zh.md) | [Video en Español](https://www.youtube.com/watch?v=99qtaJU2E2k)\n\n# WireGuard VPN 服务器一键安装脚本\n\n[![Build Status](https://github.com/hwdsl2/wireguard-install/actions/workflows/main.yml/badge.svg)](https://github.com/hwdsl2/wireguard-install/actions/workflows/main.yml) \u0026nbsp;[![License: MIT](docs/images/license.svg)](https://opensource.org/licenses/MIT)\n\n使用 Linux 脚本一键快速搭建自己的 WireGuard VPN 服务器。支持 Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS, Fedora, openSUSE 和 Raspberry Pi OS。\n\n该脚本可让你在几分钟内建立自己的 VPN 服务器，即使你以前没有使用过 WireGuard。[WireGuard](https://www.wireguard.com) 是一种快速且现代的 VPN，其设计目标是易于使用和高性能。\n\n另见：[OpenVPN](https://github.com/hwdsl2/openvpn-install/blob/master/README-zh.md) 和 [IPsec VPN](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/README-zh.md) 服务器一键安装脚本。\n\n**[\u0026raquo; :book: Book: 搭建自己的 VPN 服务器分步指南](docs/vpn-book-zh.md)** [[中文](https://books2read.com/vpnguidezh) | [English](https://books2read.com/vpnguide?store=amazon) | [Español](https://books2read.com/vpnguidees?store=amazon) | [Deutsch](https://books2read.com/vpnguidede?store=amazon) | [Français](https://books2read.com/vpnguidefr?store=amazon) | [Italiano](https://books2read.com/vpnguideit?store=amazon) | [日本語](https://books2read.com/vpnguideja?store=amazon)]\n\n## 功能特性\n\n- 全自动的 WireGuard VPN 服务器配置，无需用户输入\n- 支持使用自定义选项进行交互式安装\n- 生成 VPN 配置文件以自动配置 Windows, macOS, iOS 和 Android 设备\n- 支持管理 WireGuard VPN 用户\n- 优化 `sysctl` 设置以提高 VPN 性能\n\n## 安装说明\n\n首先在你的 Linux 服务器\\* 上下载脚本：\n\n```bash\nwget -O wireguard.sh https://get.vpnsetup.net/wg\n```\n\n\\* 一个云服务器，虚拟专用服务器 (VPS) 或者专用服务器。\n\n**选项 1:** 使用默认选项自动安装 WireGuard。\n\n```bash\nsudo bash wireguard.sh --auto\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\n查看脚本的示例输出（终端记录）。\n\u003c/summary\u003e\n\n**注：** 此终端记录仅用于演示目的。\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"docs/images/demo1.svg\"\u003e\u003c/p\u003e\n\u003c/details\u003e\n\n对于有外部防火墙的服务器（比如 [EC2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html)/[GCE](https://cloud.google.com/firewall/docs/firewalls)），请为 VPN 打开 UDP 端口 51820。\n\n**选项 2:** 使用自定义选项进行交互式安装。\n\n```bash\nsudo bash wireguard.sh\n```\n\n你可以自定义以下选项：VPN 服务器的域名，UDP 端口，VPN 客户端的 DNS 服务器以及第一个客户端的名称。\n\n对于有外部防火墙的服务器，请为 VPN 打开所选的 UDP 端口。\n\n\u003cdetails\u003e\n\u003csummary\u003e\n如果无法下载，请点这里。\n\u003c/summary\u003e\n\n你也可以使用 `curl` 下载：\n\n```bash\ncurl -fL -o wireguard.sh https://get.vpnsetup.net/wg\n```\n\n然后按照上面的说明安装。\n\n或者，你也可以使用这些链接：\n\n```bash\nhttps://github.com/hwdsl2/wireguard-install/raw/master/wireguard-install.sh\nhttps://gitlab.com/hwdsl2/wireguard-install/-/raw/master/wireguard-install.sh\n```\n\n如果无法下载，打开 [wireguard-install.sh](wireguard-install.sh)，然后点击右边的 `Raw` 按钮。按快捷键 `Ctrl/Cmd+A` 全选，`Ctrl/Cmd+C` 复制，然后粘贴到你喜欢的编辑器。\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\n高级：使用自定义选项自动安装。\n\u003c/summary\u003e\n\n高级用户可以使用自定义选项自动安装 WireGuard，方法是在运行脚本时指定命令行参数。有关更多信息，请参见下一节，查看 WireGuard 脚本的使用信息。\n\n或者，你也可以提供一个 Bash \"here document\" 作为安装脚本的输入。此方法还可用于在安装后提供输入以管理用户。\n\n首先，使用自定义选项以交互方式安装 WireGuard，并写下你对脚本的所有输入值。\n\n```bash\nsudo bash wireguard.sh\n```\n\n如需删除 WireGuard，请再次运行脚本并选择适当的选项。\n\n然后使用你的输入值创建自定义安装命令。例如：\n\n```bash\nsudo bash wireguard.sh \u003c\u003cANSWERS\nn\n51820\nclient\n2\ny\nANSWERS\n```\n\n**注：** 安装选项可能会在脚本的未来版本中发生变化。\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\n查看 WireGuard 脚本的使用信息。\n\u003c/summary\u003e\n\n```\nUsage: bash wireguard.sh [options]\n\nOptions:\n\n  --addclient [client name]      add a new client\n  --dns1 [DNS server IP]         primary DNS server for new client (optional, default: Google Public DNS)\n  --dns2 [DNS server IP]         secondary DNS server for new client (optional)\n  --listclients                  list the names of existing clients\n  --removeclient [client name]   remove an existing client\n  --showclientqr [client name]   show QR code for an existing client\n  --uninstall                    remove WireGuard and delete all configuration\n  -y, --yes                      assume \"yes\" as answer to prompts when removing a client or removing WireGuard\n  -h, --help                     show this help message and exit\n\nInstall options (optional):\n\n  --auto                         auto install WireGuard using default or custom options\n  --serveraddr [DNS name or IP]  server address, must be a fully qualified domain name (FQDN) or an IPv4 address\n  --port [number]                port for WireGuard (1-65535, default: 51820)\n  --clientname [client name]     name for the first WireGuard client (default: client)\n  --dns1 [DNS server IP]         primary DNS server for first client (default: Google Public DNS)\n  --dns2 [DNS server IP]         secondary DNS server for first client\n\nTo customize options, you may also run this script without arguments.\n```\n\u003c/details\u003e\n\n## 下一步\n\n安装完成后，你可以再次运行脚本来管理用户或者卸载 WireGuard。\n\n配置你的计算机或其它设备使用 VPN。请参见：\n\n**[配置 WireGuard VPN 客户端](docs/clients-zh.md)**\n\n**阅读 [:book: VPN book](docs/vpn-book-zh.md) 以访问 [额外内容](https://ko-fi.com/post/Support-this-project-and-get-access-to-supporter-o-X8X5FVFZC)。**\n\n开始使用自己的专属 VPN! :sparkles::tada::rocket::sparkles:\n\n## 致谢\n\n此脚本基于 [Nyr 和 contributors](https://github.com/Nyr/wireguard-install) 的出色工作，并进行了增强和更改以与 [Setup IPsec VPN](https://github.com/hwdsl2/setup-ipsec-vpn) 项目兼容。\n\n\u003cdetails\u003e\n\u003csummary\u003e\n对 Nyr/wireguard-install 的改进列表。\n\u003c/summary\u003e\n\n- 改进了与 Setup IPsec VPN 的兼容性\n- 改进了脚本的可靠性，用户输入和输出\n- 支持使用默认或自定义选项自动安装\n- 支持使用域名作为服务器地址\n- 增加了对 openSUSE Linux 的支持\n- 支持列出现有的 VPN 客户端\n- 支持显示客户端配置的二维码\n- 支持为 VPN 客户端自定义 DNS 服务器\n- 支持使用命令行参数管理 VPN 客户端\n- 优化 `sysctl` 设置以提高 VPN 性能\n- 使用 `sudo` 时改进了客户端配置文件的创建\n\n...和更多！\n\u003c/details\u003e\n\n## 授权协议\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhwdsl2%2Fwireguard-install","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhwdsl2%2Fwireguard-install","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhwdsl2%2Fwireguard-install/lists"}