---
title: "在 RHEL、Rocky、Alma 和 Fedora 上安装 | Wantastic Docs"
description: "2 分钟内在 RHEL、Rocky Linux、AlmaLinux、CentOS Stream、Oracle Linux 和 Fedora 上安装 wantasticd：一条命令，扫描二维码，点击 Claim Device。"
url: "https://wantastic.app/zh/docs/install-rhel-fedora"
category: "Install wantasticd"
reading_time: "3 分钟"
---

# 在 RHEL、Rocky、Alma 和 Fedora 上安装

2 分钟内在 RHEL、Rocky Linux、AlmaLinux、CentOS Stream、Oracle Linux 和 Fedora 上安装 wantasticd：一条命令，扫描二维码，点击 Claim Device。

> **Outcome:** wantasticd 作为服务运行在你的 RHEL/Fedora 机器上，开机自启并自动更新，设备在控制台中显示为 Online。

## Before you start

- RHEL、Rocky、AlmaLinux 或 Oracle Linux 8 或 9，CentOS Stream 9，Fedora 38+（RHEL 7 / CentOS 7 的操作方式相同）。
- 具有 sudo 权限的用户。
- 机器可以访问互联网。
- 一部手机或一个浏览器，用于登录 Wantastic 控制台。

## 快速安装（2 分钟）

一条命令即可安装 wantasticd 并显示二维码。用手机认领设备即可，无需令牌。

1. 复制下方命令，粘贴到设备的终端中。如果 sudo 要求输入密码，请输入。
2. 设备会打印 Claim URL 和二维码。用手机扫描二维码，或在浏览器中打开 Claim URL。
3. 登录 Wantastic 控制台。Claim Wantastic Device 窗口会打开，密钥已自动填好。点击 Claim Device。
4. 终端打印 "Device claimed"。按 Ctrl+C，然后运行下方的重启命令。
5. 在控制台中打开 Devices。设备显示为 Online。

安装并认领:

```bash
curl -fsSL https://get.wantastic.app/install.sh | sudo sh; sudo wantasticd genkey
```

出现 "Device claimed" 后：按 Ctrl+C，然后重启服务:

```bash
sudo systemctl restart wantasticd
```

*安装并认领: genkey 打印 Claim URL 和二维码后进入等待。你在控制台中点击 Claim Device 后，它会打印 "Device claimed"。然后按 Ctrl+C 并重启服务。*

```
$ $ curl -fsSL https://get.wantastic.app/install.sh | sudo sh; sudo wantasticd genkey
…
Skipping login. Run 'wantasticd login' to authenticate.
…
Generated device claim key: /etc/wantastic/device-claim-key.json
Public key: Vd3hK1oQ7mR2sT9uW4xY6zA8bC0dE2fG4hJ6kL8mN0P=
Server URL: https://console.wantastic.app
Claim URL: https://console.wantastic.app/#desktop?claim_public_key=Vd3hK1oQ…%3D&wantastic_server=https%3A%2F%2Fconsole.wantastic.app

█▀▀▀▀▀█ ▄▀▄ ▀█▄ █▀▀▀▀▀█
█ ███ █ ▀█▄▀▄█ █ ███ █
█ ▀▀▀ █ ▄▀█ ▀▄ █ ▀▀▀ █
▀▀▀▀▀▀▀ ▀ ▀ █ ▀ ▀▀▀▀▀▀▀
▀█▄▀▄▀▀█▀▄█▀▄▀▀▄█▀▄▀█▄
█▀▀▀▀▀█ █▄▀▄▀█ ▀▄█ ▄▀
▀▀▀▀▀▀▀ ▀▀ ▀▀▀ ▀▀▀ ▀▀▀

2026/10/29 09:14:03 Waiting for claim. Press Ctrl+C to stop.
2026/10/29 09:15:12 Device claimed. Configuration saved to /etc/wantastic/config.conf
^C
$ $ sudo systemctl restart wantasticd
```

*Console: Claim Wantastic Device。Claim URL 和二维码会自动填入密钥，你只需点击 Claim Device。*

1. Claim public key 已自动填写
2. Wantastic server 保持默认即可
3. 点击 Claim Device

> **Tip:** 手边没有手机？从终端复制 Claim URL，在任意电脑上打开即可。

> **Operational note:** 在显示二维码之前，安装程序可能会打印 "Skipping login" 或服务错误。这在新设备上是正常的。认领并重启后服务即可正常工作。

## 检查是否正常工作

1. 运行 wantasticd status。它会显示 Status: Connected 和一个 VPN IP。
2. 在控制台中打开 Devices。设备显示为 Online。

检查:

```bash
wantasticd status
```

*wantasticd status: Status: Connected 加上 VPN IP 表示隧道已建立。*

```
$ $ wantasticd status
Status:        Connected
Version:       v1.0.54+377f3c0
Mode:          TUN (wantastic0)
VPN IPs:       10.200.0.14/32
Public key:    q7ZkV3m1yH0dTn8pXo2bLwR4sE6uJ9cA1fG5hK8iN0M=
Server:        wg.wantastic.app:51820
Exit node:     false
Local access:  false
Auto update:   true
Traffic:       ↓ 18.4 KiB  ↑ 9.2 KiB
Peers:         2 (direct 1, relay 1)
Uptime:        4m12s
```

*Console: Devices 窗口：新设备以其名称出现，并在几秒钟内变为 Online。*

1. 按名称搜索
2. 状态显示 Online
3. 覆盖网络 IP 与 wantasticd status 一致
4. Last seen 持续更新

## 管理服务

wantasticd 是普通的 systemd 服务。它开机自启，崩溃后会自动重启。

systemctl 和 journalctl:

```bash
sudo systemctl status wantasticd     # is it running?
sudo systemctl restart wantasticd    # restart
sudo systemctl stop wantasticd       # stop the tunnel
sudo journalctl -u wantasticd -f     # live logs
```

## 其他安装方式

仅在自动化或特殊情况下才需要这些方式。上面的快速安装是最简单的方法。

### 使用令牌（多台设备）

当你用脚本安装大量设备，或无人能扫描二维码时，请使用令牌。在控制台中创建一次令牌即可：Account → Secrets → + New Secret → Generate。用它替换 <TOKEN>。

令牌安装:

```bash
curl -fsSL https://get.wantastic.app/install.sh | sudo sh -s -- --token <TOKEN>
```

> 像对待密码一样对待令牌。在其过期之前，任何持有它的人都能向你的账户添加设备。

### 控制台脚本

在控制台中打开任意设备的 Show Config → UNIX 选项卡，点击 Copy。将脚本粘贴到设备终端中。脚本中已包含令牌。

### 手动安装

对于少见的 CPU、离线机器或自定义服务文件，请按照《手动安装 tarball》指南操作。

*Console: Account → Secrets → + New Secret。密钥的值就是令牌。*

1. 打开 Secrets 选项卡
2. 点击 + New Secret
3. 为其命名
4. 点击 Generate
5. 复制新密钥

## RHEL/Fedora 注意事项

- 无需任何入站端口。机器需要出站 TCP 443 和出站 UDP 51820。
- wantasticd 每小时自动更新一次，不受包管理器管理。
- firewalld 默认只过滤入站流量，因此无需修改。
- UDP 51820 无法通过 HTTP 代理。如果处于企业代理之后，请联系网络团队放行。
- NetworkManager 可能会记录 "<if> is not managed by NetworkManager"。这只是提示信息。

## Verify the result

- wantasticd status 显示 Status: Connected 和一个 VPN IP。
- 设备在控制台 Devices 窗口中显示为 Online。
- 执行 sudo reboot 后，设备会自动恢复 Online。

## Common issues

### 一键命令立即因权限错误而失败。

```
Error: /usr/local/bin is not writable, but / is already read-write. Run this installer as root.
```

- **Where:** install.sh
- **Likely cause:** 缺少 sudo。安装程序需要 root 权限。
- **Fix:** 使用下方的确切命令。sudo 要放在 sh 前面，而不是 curl 前面。

正确的命令:

```bash
curl -fsSL https://get.wantastic.app/install.sh | sudo sh; sudo wantasticd genkey
```

### 一键命令立即停止。

```
curl: command not found
```

- **Where:** shell
- **Likely cause:** 精简镜像不带 curl。
- **Fix:** 用 dnf 安装 curl，然后重新运行快速安装。

安装 curl（dnf）:

```bash
sudo dnf install -y curl ca-certificates
```

### 服务无法启动，或反复重启。

```
Failed to load configuration: validate config: private key required
```

- **Where:** journalctl -u wantasticd
- **Likely cause:** wantasticd 已安装，但设备尚未认领，因此其配置文件为空。
- **Fix:** 认领设备，然后重启服务。

认领并重启:

```bash
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd
```

- **Verify:** wantasticd status 显示 Status: Connected。

### 安装程序在最后打印了 systemd 错误。

```
Error: systemd service did not start
```

- **Where:** install.sh
- **Likely cause:** 设备尚未认领，因此服务没有可用的配置来启动。这在新设备上是预期行为。
- **Fix:** 认领设备，然后重启服务。

认领并重启:

```bash
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd
```

- **Verify:** systemctl is-active wantasticd 打印 active。

### 控制台显示设备已认领，但服务仍然无法连接。

- **Where:** wantasticd genkey
- **Likely cause:** genkey 运行时未使用 sudo。它把配置保存在了你的主目录（~/.config/wantastic）中，而服务不会读取该目录。
- **Fix:** 使用 sudo 重新运行 genkey 并认领新密钥。然后在 Devices 中删除旧的、未使用的设备条目。

以 root 身份认领:

```bash
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd
```

### 你已点击 Claim Device，但终端始终没有打印 "Device claimed"。

```
Claim polling not ready: claim config rejected (401): invalid signature or timestamp out of window
```

- **Where:** wantasticd genkey
- **Likely cause:** 设备时钟不准确。只有当时钟与实际时间相差在 30 秒以内时，认领才能成功。
- **Fix:** 修正时钟。genkey 会继续等待，并自行完成。

开启网络对时:

```bash
sudo timedatectl set-ntp true
date
```

### 出现了第二个接口（wantastic1），或日志显示端口冲突。

```
Port 51820 in use, using random port
```

- **Where:** 服务日志
- **Likely cause:** genkey 仍在终端中运行，而服务也在运行。现在有两个副本在争用。
- **Fix:** 在运行 genkey 的终端中按 Ctrl+C，然后重启服务。

重启:

```bash
sudo systemctl restart wantasticd
```

### wantasticd status 打印 Offline。

```
Status: Offline — daemon not running (start: sudo systemctl start wantasticd (OpenWrt: /etc/init.d/wantasticd start))
```

- **Where:** wantasticd status
- **Likely cause:** 后台服务已停止、已崩溃或仍在启动中。status 命令不会启动服务。
- **Fix:** 启动服务。

启动服务:

```bash
sudo systemctl start wantasticd
```

### status 显示 Running (tunnel down)，或 peers 显示 (server) 为 HANDSHAKE never。

```
Device health check failed: …
```

- **Where:** 服务日志
- **Likely cause:** 网络阻止了到中心节点（wg.wantastic.app）的出站 UDP 51820 端口，或 DNS 不可用。
- **Fix:** 在防火墙中放行出站 UDP 51820，然后重启服务。

测试 DNS 并重启:

```bash
nslookup wg.wantastic.app
sudo systemctl restart wantasticd
```

- **Verify:** wantasticd peers 显示 (server) 有最近的握手（例如 "8s ago"）。

### 服务一启动就立即停止。

```
Failed to start agent: create device: create tun: CreateTUN("wantastic0") failed; /dev/net/tun does not exist
```

- **Where:** 服务日志
- **Likely cause:** 内核 TUN 驱动未加载。
- **Fix:** 加载 TUN 驱动，然后重启服务。

加载 TUN:

```bash
sudo modprobe tun
sudo systemctl restart wantasticd
```

- **Verify:** ls -l /dev/net/tun 显示该设备。

### 你想把设备迁移到另一个账户，或重新进行认领。

```
Config already exists at /etc/wantastic/config.conf — skipping login.
```

- **Where:** install.sh
- **Likely cause:** 即使重新运行安装程序，设备也会保留其配置。你必须先移除旧配置。
- **Fix:** 将旧配置移到别处，然后用新密钥重新认领设备。

从头开始:

```bash
sudo mv "/etc/wantastic/config.conf" "/etc/wantastic/config.conf.bak"
sudo wantasticd genkey --force
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd
```

- **Verify:** 设备出现在新账户中，wantasticd status 显示 Connected。

### 令牌安装在下载后立即失败。

```
Login failed: registration rejected (401): invalid or expired login token
```

- **Where:** install.sh / wantasticd login
- **Likely cause:** 令牌错误、已过期、已用完（达到 Max Uses）或已被删除。
- **Fix:** 不使用令牌，改为认领设备。

改用认领:

```bash
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd
```

- **Verify:** 设备出现在 Devices 中并显示为 Online。

### 认领或登录被拒绝。

```
Login failed: account has reached its device limit — upgrade your plan or remove an existing device
```

- **Where:** wantasticd login / 控制台
- **Likely cause:** 你的套餐设备数量已满。控制台显示 "You have reached the maximum number of devices for your plan."
- **Fix:** 在 Devices 中删除一台不再使用的设备（设备行 → Delete），或升级套餐。然后重新认领。

### 在 SELinux 处于 enforcing 模式的主机上，服务因 permission denied 而失败。

- **Where:** journalctl -u wantasticd / 审计日志
- **Likely cause:** 本地 SELinux 策略阻止了该二进制文件（不常见）。
- **Fix:** 恢复默认文件标签，然后重启。不要禁用 SELinux。

恢复标签:

```bash
sudo restorecon -v /usr/local/bin/wantasticd
sudo systemctl restart wantasticd
```

## Continue with

- [Choose your install method](https://wantastic.app/zh/docs/install-overview): Find your device in one table and copy one command. Most devices install in 2 minutes: install, scan a QR code, click Claim Device.
- [wantasticd CLI reference and operations](https://wantastic.app/zh/docs/wantasticd): The most used wantasticd commands first, then every command and flag, environment variables, config and state paths per OS, log lines, local access, exit node, and the claim flow (genkey / --wait-claim).
- [Update, roll back and uninstall](https://wantastic.app/zh/docs/update-and-uninstall): Update or uninstall wantasticd with one line per OS. Also: how auto-update works, turning it off, rolling back to the previous binary, and purging all data.
- [Installer errors (install.sh and install.ps1)](https://wantastic.app/zh/docs/errors-installer): Every message the Wantastic installers print when they stop, what it means and the easiest fix.
- [Login, token and claim errors](https://wantastic.app/zh/docs/errors-login-claim): Fix claim problems (genkey, QR code, Claim Device), "Login failed: …" messages and token errors.
- [Connect and runtime errors](https://wantastic.app/zh/docs/errors-connect-runtime): Fix service start failures, config errors, TUN problems, missing handshakes and DNS warnings.
- [Enrollment secrets](https://wantastic.app/zh/docs/enrollment-secrets): Tokens for automation, Windows and mass rollouts: create, limit and delete them.
- [WebSSH sessions](https://wantastic.app/zh/docs/webssh): Open an SSH terminal in the browser through the tunnel. Port 22 stays closed to the internet.
