云服务器安装openclaw

云服务器安装openclaw

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ssh访问云服务器
ssh opencode
# 安装screen
apt install -y screen

# 方案一
# 安装时间有点长,可以在tmux会话中进行,防止中断
tmux new -s openclaw
# 配置 npm 镜像(如果在中国,使用淘宝镜像)
npm config set registry https://registry.npmmirror.com
# 或者设置 pnpm 镜像
pnpm config set registry https://registry.npmmirror.com

# Install OpenClaw
npm i -g openclaw

# Meet your lobster
openclaw onboard

# 接入会话
tmux attach -t openclaw
# 分离会话
Ctrl+b
# 杀死会话
tmux kill-session -t openclaw
# ----------------------------------------------------------------
# 方案二,需要本地科学上网并配置http/https代理端口
ssh -R 10808:127.0.0.1:10808 opencode
# curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git
curl -fsSL https://openclaw.ai/install.sh | sed -e 's/clone/clone -c http.proxy="127.0.0.1:10808"/g' | bash
# ----------------------------------------------------------------
# 方案三
# 创建一个名字为segfault的实例
screen -S segfault
# ssh连接segfualt进行动态端口转发
ssh -D 127.0.0.1:1080 segfault.net
# 根据提示输入密码,密码为:segfault,然后根据倒计时提示敲回车
# 在当前screen下,输入先后Ctrl+A,Ctrl+D,退出该screen
Ctrl+a,Ctrl+d
# 安装nodejs,使用openclaw相关命令有时候会用到
apt install nodejs
# 使用openclaw官方脚本安装openclaw,给安装脚本中git clone配置segfault.net的代理,端口为动态转发端口
# curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git
curl -fsSL https://openclaw.ai/install.sh | sed -e 's/clone/clone -c http.proxy="127.0.0.1:1080"/g' | bash
# ----------------------------------------------------------------


# 查看当前token对应链接及端口转发命令
openclaw dashboard
# 根据端口转发命令在本地进行端口转发
ssh -N -L 18789:127.0.0.1:18789 opencode
# 端口转发后,根据前边查看的token链接在本地浏览器打开访问,然后就可以与AI进行交互了
# 如果要使用TUI模式
openclaw tui

# 可选-安装clawhub
npm i -g clawhub

# ssh连接时自动端口转发和反向隧道
cat - >> ~/.ssh/config <<'EOF'
host opencode
User root
HostName 公网IP
LocalForward 18789 localhost:18789
RemoteForward 10808 localhost:10808
ServerAliveInterval 60
IdentityFile    ~/.ssh/id_rsa
EOF
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计