所有平台一键安装。无需 sudo——安装在你的主目录下。
安装后进行服务器部署,请参阅 快速开始。包管理器、Docker 及其他安装方式,请参阅 服务器安装。
功能说明
- 检测操作系统、CPU 架构、平台变体(Rosetta 2/WSL)和 init 系统(systemd/OpenRC/SysV init/容器)
- 从 GitHub Releases 下载对应的二进制文件(或使用
--build从源码构建) - 安装到
~/bin或%USERPROFILE%\bin(可通过--install-dir自定义) - 通过 shell 配置文件(Bash)或注册表(Windows)将安装目录添加到
PATH - Windows 和 Linux:提供交互式问答来配置 TLS、Postgres 并创建初始管理员用户
- 输出后续步骤提示
所需环境
| 平台 | 依赖 |
|---|---|
| macOS / Linux | curl + tar |
macOS / Linux (--build) | curl + git + go + bun + make |
| Windows | PowerShell 5.1+(Windows 10/11 自带) |
快速安装
curl -fsSL https://bedrud.org/install.sh | bash重新加载 shell,然后验证:
source ~/.bashrc # 或 ~/.zshrc
bedrud --versionirm https://bedrud.org/install.ps1 | iex
bedrud --version标志与选项
Bash 安装程序
Usage: curl -fsSL https://bedrud.org/install.sh | bash -s -- [options]
| 标志 | 默认值 | 说明 |
|---|---|---|
--install-dir <dir> | ~/bin | 二进制文件安装位置 |
--version <ver> | latest | 固定到指定版本(如 v1.2.0) |
--build | 关闭 | 从源码构建而不下载预编译版本 |
--branch <name> | master | 要克隆的 Git 分支(需要 --build) |
--no-setup | 关闭 | 仅下载二进制文件,跳过交互式服务器设置 |
--skip-shell | 关闭 | 不修改 shell RC 文件或 PATH |
-h, --help | — | 打印用法并退出 |
示例:
# 默认安装
curl -fsSL https://bedrud.org/install.sh | bash
# 固定版本
curl -fsSL https://bedrud.org/install.sh | bash -s -- --version v1.2.0
# 从源码构建(自定义分支)
curl -fsSL https://bedrud.org/install.sh | bash -s -- --build --branch my-feature
# 从 fork 构建
BEDRUD_REPO=myuser/bedrud curl -fsSL https://bedrud.org/install.sh | bash -s -- --build
# 全局安装
curl -fsSL https://bedrud.org/install.sh | sudo bash -s -- --install-dir /usr/local/bin
# CI / 自动化 — 跳过 shell 配置和交互式设置
curl -fsSL https://bedrud.org/install.sh | bash -s -- --skip-shell --no-setupPowerShell 安装程序
Usage: irm https://bedrud.org/install.ps1 | iex
传参需先保存到文件:
irm https://bedrud.org/install.ps1 -OutFile install.ps1
.\install.ps1 -Version v1.2.0 -InstallDir C:\Tools -Build| 参数 | 默认值 | 说明 |
|---|---|---|
-InstallDir <path> | $HOME\bin | bedrud.exe 安装位置 |
-Version <ver> | latest | 安装指定版本 |
-SkipPath | $false | 不将安装目录添加到用户 PATH |
-Build | $false | 从源码构建而不下载 |
-Branch <name> | master | 要克隆的 Git 分支(需要 -Build) |
-NoSetup | $false | 仅下载,跳过交互式服务器设置 |
示例:
# 默认安装
irm https://bedrud.org/install.ps1 | iex
# 从源码构建
.\install.ps1 -Build -Branch main
# CI / 自动化 — 跳过交互式 Q&A
.\install.ps1 -NoSetup -SkipPath环境变量
| 变量 | 默认值 | 平台 | 说明 |
|---|---|---|---|
BEDRUD_INSTALL | ~/bin | 仅 Bash | 覆盖安装目录(等同于 --install-dir) |
BEDRUD_REPO | themadorg/bedrud | 两者 | 覆盖 GitHub 仓库(用于 fork 或镜像) |
BEDRUD_INSTALL=/opt/bedrud curl -fsSL https://bedrud.org/install.sh | bash
BEDRUD_REPO=myorg/bedrud-fork curl -fsSL https://bedrud.org/install.sh | bash$env:BEDRUD_REPO = "myorg/bedrud-fork"
irm https://bedrud.org/install.ps1 | iex平台支持
| 目标 | 操作系统 | 架构 | 备注 |
|---|---|---|---|
darwin_amd64 | macOS | Intel (x86_64) | 标准支持 |
darwin_arm64 | macOS | Apple Silicon (M1/M2/M3/M4) | 自动检测 Rosetta 2 |
linux_amd64 | Linux | x86_64 | 静态二进制文件 — 所有发行版 |
linux_arm64 | Linux | ARM64 | 静态二进制文件 — 所有发行版 |
freebsd_amd64 | FreeBSD | x86_64 | 标准支持 |
windows_amd64 | Windows | x86_64 | 标准支持 |
windows_arm64 | Windows | ARM64 | 标准支持 |
特殊情况检测
Rosetta 2(Apple Silicon 上的 macOS Intel 模式)
检测方式: sysctl -n sysctl.proc_translated 返回 1。
效果: 将 darwin_amd64 切换为 darwin_arm64,以获得原生 ARM 性能。
容器环境(Docker、Kubernetes 等)
检测方式: 检查 /.dockerenv、/run/.containerenv、/proc/1/comm(匹配 docker-init、tini、containerd、runc)以及 /proc/1/cgroup(匹配 docker、kubepods、containerd)。
效果: 服务文件安装将被跳过。安装程序会打印手动启动命令:
# 前台运行
/usr/local/bin/bedrud run --config /etc/bedrud/config.yaml
# 后台运行
nohup /usr/local/bin/bedrud run --config /etc/bedrud/config.yaml \
> /var/log/bedrud/bedrud.log 2>&1 &在 Docker 中如需正确的服务管理,请使用 --init 或 tini 作为 PID 1。
Init 系统支持
安装程序会自动检测你的 init 系统,并为服务器配置创建对应的服务文件:
| Init 系统 | 检测方式 | 服务文件 | 管理命令 |
|---|---|---|---|
| systemd | /run/systemd/system 存在 | /etc/systemd/system/*.service | systemctl |
| OpenRC | /sbin/openrc 存在 | /etc/init.d/*(OpenRC 格式) | rc-service、rc-update |
| SysV init | service 命令可用 | /etc/init.d/*(LSB 格式) | service、update-rc.d |
| 容器 | /.dockerenv、/proc/1/comm、/proc/1/cgroup | 无 — 手动启动 | 直接运行二进制文件或 nohup |
支持的系统:大多数 Linux 发行版(systemd、OpenRC、SysV init)、WSL1 及 Linux 容器。容器环境会被自动检测 — 服务文件安装将被跳过,并打印手动启动说明。
安装流程
- Windows 检查 — 在 Bash 中检测到 MINGW/MSYS/CYGWIN?重定向到 PowerShell。
- WSL 检查 — 在 PowerShell 中检测到 WSL?重定向到 Bash。
- 依赖检查 — Bash:
curl+tar。PowerShell:(默认无)。构建:git+go+bun+make。 - 平台检测 — 通过
uname(Bash)或RuntimeInformation(PowerShell)获取操作系统和架构。 - 安装二进制文件 — 两种方式:
- 下载模式(默认):下载并解压 zip/tar.xz。
- 构建模式(
--build):git clone、bun install、go mod download、make build。
- 验证 — 运行
bedrud --version。 - PATH 检查 — 已在 PATH 中?跳过。否则 → 修改 RC 文件(Bash)或注册表(PowerShell)。
- 交互式设置 — 问答式配置域名、TLS、Postgres 和管理员用户。
- 完成 — 输出成功信息及访问 URL。
下载 URL 格式:github.com/{repo}/releases/{ver}/bedrud_{TARGET}.tar.xz
构建模式从 github.com/{repo} 克隆并运行 make build(输出:server/dist/bedrud)。
PATH 与 Shell 配置
未设置 --skip-shell 时,安装程序会将安装目录添加到你的 PATH。
| Shell | RC 文件 |
|---|---|
| fish | ~/.config/fish/config.fish |
| zsh | $ZDOTDIR/.zshrc(默认 ~/.zshrc) |
| bash (macOS) | ~/.bash_profile,然后 ~/.bashrc |
| bash (Linux) | ~/.bashrc,然后 ~/.bash_profile |
添加的内容:
# bedrud
export PATH="$HOME/bin:$PATH" # bedrud# bedrud 注释标记可防止重复添加——可安全重复运行。
Windows: 使用 [Environment]::SetEnvironmentVariable("PATH", ..., "User") 在注册表级别设置。不需要 RC 文件。
安装后重新加载 shell:
source ~/.bashrc # bash
source ~/.zshrc # zsh
source ~/.config/fish/config.fish # fish离线 / 气隙安装
下载与传输
curl -fsSL -o bedrud.tar.xz \
https://github.com/themadorg/bedrud/releases/latest/download/bedrud_linux_amd64.tar.xz
scp bedrud.tar.xz airgapped-server:/tmp/
# 在目标机器上:
tar -xf /tmp/bedrud.tar.xz -C /tmp/bedrud-extracted
mv /tmp/bedrud-extracted/bedrud ~/bin/
chmod +x ~/bin/bedrud自托管镜像
BEDRUD_REPO=mycompany/bedrud-mirror curl -fsSL https://bedrud.org/install.sh | bash直接使用二进制文件
从 Releases 下载,解压后移动到 PATH 中的目录即可。
卸载
rm ~/bin/bedrud
# 从 shell RC 文件中删除 PATH 行(搜索 "# bedrud"):
# ~/.bashrc, ~/.bash_profile, ~/.zshrc, ~/.config/fish/config.fish服务器安装(systemd、OpenRC、SysV init):
sudo bedrud uninstallWindows:
Remove-Item "$env:USERPROFILE\bin\bedrud.exe"
# 通过 系统属性 → 环境变量 从 PATH 中移除故障排除
command not found: bedrud
source ~/.bashrc # 重新加载 shell
echo $PATH | tr ':' '\n' | grep "$HOME/bin" # 检查 PATH如果缺失:
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcFailed to download bedrud
- 检查网络连接
- 在 Releases 确认目标版本存在
- 尝试指定版本:
--version v1.0.0 - 你的平台可能暂无预构建二进制文件
macOS:在 Rosetta 下运行 x64(速度较慢)
强制使用原生 ARM:
arch -arm64 curl -fsSL https://bedrud.org/install.sh | arch -arm64 bashWindows:“running scripts is disabled”
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
irm https://bedrud.org/install.ps1 | iexWindows:检测到 WSL
如果你在 WSL 终端(例如 Windows 上的 Ubuntu)中运行,PowerShell 安装程序会检测到这一点并要求你改用 Bash 安装程序。这确保 Bedrud 在 WSL 内的 Linux 环境中正确安装。
Windows:ARM64 设备(Surface Pro 等)
安装程序自动检测 windows_arm64 并下载原生二进制文件。如果需要强制指定架构,请从 Releases 下载特定的 zip 文件。
Windows:用于 Postgres 的 Docker Desktop
如果你在设置过程中选择在 Docker 中运行 Postgres,请确保已安装并运行 Docker Desktop。安装程序将尝试自动启动容器。