Hyper-v系列---【如何安装ubuntu server系统?如何在ubuntu上安装openclaw】

1.系统下载地址

https://releases.ubuntu.com/22.04/

我这里以ubuntu-22.04.5-live-server-amd64.iso为例安装,直接ctrl+f搜这个版本。

2.创建虚拟机


🛠️ Hyper-V 虚拟机配置指南 (Ubuntu Server)

按照以下步骤在 Hyper-V 中快速构建你的 Ubuntu-server 环境。

1. 启动向导

  • 打开程序:搜索并启动 Hyper-V 管理器
  • 新建操作:点击右侧操作面板中的 新建虚拟机

2. 基础配置参数

配置项目 推荐设置 说明
虚拟机名称 Ubuntu-server 方便识别,建议不带空格
选择代数 第二代 (Generation 2) 核心推荐:支持 UEFI,性能更现代
分配内存 8192 MB (8GB) 若物理内存紧张,最低可设为 4096 MB
配置网络 Default Switch 确保虚拟机开机即可自动联网

3. 存储与系统安装

💾 虚拟硬盘

  • 推荐大小80 GB
  • 该大小能确保系统运行及后续日志/数据的存储空间充足。

💿 安装选项

  1. 选择 “从可启动的映像文件安装操作系统”
  2. 浏览并选择 ISO 文件

ubuntu-22.04.5-live-server-amd64.iso


💡 小贴士

  • 关闭安全启动 (可选):如果安装过程中遇到无法从 ISO 启动的问题,请在虚拟机创建完成后,进入“设置” -> “安全”,暂时取消勾选“启用安全启动”。
  • 检查虚拟化:确保你的 BIOS/UEFI 中已开启 Intel VT-xAMD-V

没问题,已经为你整理好了。我优化了排版,将步骤转化为列表,并将代码块进行了规范化处理,确保你一键复制后在任何 Markdown 编辑器中都能完美显示。


3. 安装 Ubuntu Server 系统

安装过程选项指南:

  • Language: English (没找到中文)
  • Update: continue without updating
  • Keyboard configuration: English US ---> done
  • Choose the type of installation: ubuntu server (系统默认) ---> done
  • Network configuration: DHCP (默认) ---> done
  • Proxy configuration: 不用输入,留空白 (默认) ---> done
  • Ubuntu archive mirror configuration: done
  • Guide storage configuration: use an entire disk (默认) ---> 光标移到 done
  • Storage configuration: done ---> confirm destructive action ---> 光标移到 continue
  • Profile configuration: 自己设置一下你的用户名密码 (可以都设置 radmin) ---> done
  • Upgrade to Ubuntu Pro: (默认) skip for now ---> continue
  • SSH configuration: (空格手动选中)install openssh server ---> done
  • Featured server snaps: (什么都不要选, 光标直接移到下面) done

结束安装与启动:

  1. 系统开始安装,耐心等待。当日志不再刷新且最下面出现 subiquity/late/run: 时,说明安装好了。
  2. 选择 reboot now
  3. 注意: 先不要按 enter。去你这台虚拟机的设置里,找到硬盘驱动器 (装系统 iso 镜像的那个),删掉/卸载镜像
  4. 点击确定后再按 enter,不必重新打开连接。
  5. 等待出现 DatesourceNone. Up 15.06 seconds,系统启动。按下 enter,输入用户名密码 radmin 登录。

基础更新:

sudo apt update
sudo apt upgrade -y

提示: 弹出 package configuration ---> which services shoud be restarted? 时,直接按 tab 键切到 ok

设置 Root 密码(可选):

我比较喜欢用 root,所以我要先给 root 设置密码:

sudo su -
# 输入 radmin 的密码 radmin,就切换到 root 用户了。

sudo passwd root
# 输入两遍一样的密码,例如:root。
# 注意:系统默认是不允许 root 直接远程登录的。所以还是建议你用普通用户操作。

su - radmin

一定要重启一下系统。


4. 安装 Node.js

使用 ip addr 查看 IP,然后用 shell 工具(如 Termius, Xshell, PuTTY)连上,方便复制粘贴。

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash - 
sudo apt-get install -y nodejs

# 验证安装
node -v
npm -v


5. 安装 Git

sudo apt install git -y


6. 安装 Docker

sudo apt install docker.io -y
sudo systemctl enable docker
sudo systemctl start docker


7. 安装 Playwright(浏览器自动化)

sudo npm install playwright
sudo npx playwright install


8. 安装 OpenClaw

sudo npm install -g openclaw
sudo openclaw onboard --install-daemon
OPENCLAW_INSECURE_CONTROL_UI=1 openclaw gateway --port 18789
openclaw tui

#webui上报这个错:把openclaw.json里的gateway.auth.token的值复制到页面的概览--->网关令牌--->点击连接
unauthorized: gateway token missing (open the dashboard URL and paste the token in Control UI settings)

配置远程访问注意:

这时候默认外部宿主机是无法访问 Web UI 界面的,默认为 http://172.19.xxx.xxx:18789

你需要将配置从:

"gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "loopback", // 这个只允许本机访问
    "controlUi": {
      "allowedOrigins": ["*"]
    }
}

修改为:

"gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan", // 改成局域网可以访问,这样宿主机就能访问了,这样还是不能,得宿主机打隧道
    "controlUi": {
      "allowedOrigins": ["*"]
    }
}

解决“离线”状态显示问题:
即使能访问了,也可能显示健康状况为“离线”,因为 Web UI 无法跨域访问 gateway。
请确保配置如下:

"gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
    "controlUi": {
      "allowedOrigins": ["*"] // 确保这里是通配符 "*"
    }
}


posted on 2026-03-12 04:12  少年攻城狮  阅读(4)  评论(0)    收藏  举报

导航