linux安装Code Server 以便Comate IDE和CodeBuddy等都可以远程连上来

因为在FreeBSD下安装Code Server 失败,所以到linux下去安装。所用的机器为FreeBSD下的Ubuntu虚拟机主机,ip192.168.1.12.

安装node

安装node参考这个文档:https://skywalk.blog.csdn.net/article/details/149314275

二进制安装

先从网站下载node .xz文件

解开xz文件

复制代码
tar -xvf node.xz

然后把路径加上就行了。

复制代码
 export PATH=/home/skywalk/node-v24.11.1-linux-x64/bin:$PATH

后面还尝试了安装npm新版本,我也不知道这样做对不对:

复制代码
root@ubjail1:~/node-v24.11.1-linux-x64/bin# ./node npm install npm

added 1 package in 10s

25 packages are looking for funding
  run `npm fund` for details
npm notice
npm notice New patch version of npm available! 11.6.2 -> 11.6.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.6.3
npm notice To update run: npm install -g npm@11.6.3
npm notice
root@ubjail1:~/node-v24.11.1-linux-x64/bin# ./node npm install  -g npm@11.6.3

removed 9 packages, and changed 54 packages in 8s

25 packages are looking for funding
  run `npm fund` for details

用普通用户装node就这么简单

复制代码
cd ~
tar -xvf /tmp/node-v24.11.1-linux-x64.tar.xz
export PATH=/home/skywalk/node-v24.11.1-linux-x64/bin:$PATH

也可以选择:

一句话安装node

复制代码
# 下载并安装 nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

# 代替重启 shell
\. "$HOME/.nvm/nvm.sh"

# 下载并安装 Node.js:
nvm install 24

# 验证 Node.js 版本:
node -v # Should print "v24.11.1".

# 验证 npm 版本:
npm -v # Should print "11.6.2".

不过近期github有时候会抽风,这个一句话安装node有可能会失败。

安装code server

也是一句话安装:

复制代码
curl -fsSL --http1.1 https://code-server.dev/install.sh | sh

安装完成:

复制代码
curl -fsSL --http1.1 https://code-server.dev/install.sh | sh

Ubuntu 22.04 LTS
Installing v4.106.2 of the amd64 deb package from GitHub.

+ mkdir -p ~/.cache/code-server
+ curl -#fL -o ~/.cache/code-server/code-server_4.106.2_amd64.deb.incomplete -C - https://github.com/coder/code-server/releases/download/v4.106.2/code-server_4.106.2_amd64.deb
######################################################################## 100.0%
+ mv ~/.cache/code-server/code-server_4.106.2_amd64.deb.incomplete ~/.cache/code-server/code-server_4.106.2_amd64.deb
+ sudo dpkg -i ~/.cache/code-server/code-server_4.106.2_amd64.deb
[sudo] password for skywalk:
Sorry, try again.
[sudo] password for skywalk:
Selecting previously unselected package code-server.
(Reading database ... 46336 files and directories currently installed.)
Preparing to unpack .../code-server_4.106.2_amd64.deb ...
Unpacking code-server (4.106.2) ...
Setting up code-server (4.106.2) ...

deb package has been installed.

To have systemd start code-server now and restart on boot:
  sudo systemctl enable --now code-server@$USER
Or, if you don't want/need a background service you can run:
  code-server

Deploy code-server for your team with Coder: https://github.com/coder/coder

从这里拿到密码

复制代码
/home/skywalk/.config/code-server/config.yaml

浏览器打开8080端口:

输入token,这个token可以从文件.config/code-server/config.yaml拿到,文件内容类似

复制代码
bind-addr: 127.0.0.1:8080
auth: password
password: 813545bf9adb121b199374xx
cert: false

VSCode的远程编辑页面就出来了:

同时,用Comate IDE和CodeBuddy等都可以远程连上来了!

总结

Code server在Linux下非常好安装,但是在FreeBSD下可能会有较多的波折。

安装好Code server后,VSCode家族的编程软件都可以在"远程资源管理器"里添加远程资源。

也可以通过8080端口,使用web远程打开!

调试

安装报错curl: (16) Error in the HTTP2 framing layer

curl -fsSL https://code-server.dev/install.sh | sh

curl: (16) Error in the HTTP2 framing layer

尝试用http1.1协议

复制代码
curl -fsSL --http1.1 https://code-server.dev/install.sh | sh

ok 了

相关推荐
C_心欲无痕1 天前
ts - tsconfig.json配置讲解
linux·前端·ubuntu·typescript·json
冰西瓜6001 天前
国科大2025操作系统高级教程期末回忆版
linux
HIT_Weston1 天前
93、【Ubuntu】【Hugo】搭建私人博客:面包屑(一)
linux·运维·ubuntu
cuijiecheng20181 天前
Linux下Beyond Compare过期
linux·运维·服务器
喵叔哟1 天前
20.部署与运维
运维·docker·容器·.net
HIT_Weston1 天前
92、【Ubuntu】【Hugo】搭建私人博客:侧边导航栏(六)
linux·运维·ubuntu
CodeAllen嵌入式1 天前
Windows 11 本地安装 WSL 支持 Ubuntu 24.04 完整指南
linux·运维·ubuntu
期待のcode1 天前
前后端分离项目 Springboot+vue 在云服务器上的部署
服务器·vue.js·spring boot
AI 智能服务1 天前
第6课__本地工具调用(文件操作)
服务器·人工智能·windows·php
码农小韩1 天前
基于Linux的C++学习——指针
linux·开发语言·c++·学习·算法