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 了

相关推荐
知已难寻11 分钟前
03 · OpenStack的计算管理 Nova
运维·服务器·开发语言·云原生·云计算·openstack·开源软件
huainingning1 小时前
Windows syslog日志服务器搭建与模拟器对接
运维·服务器·智能路由器
牛马鸡niumasi1 小时前
【Linux】C语言文件操作
linux
say_fall1 小时前
【Linux系统编程】Ext 文件系统:磁盘与存储、文件与目录、现代计算机究竟如何寻找文件
linux·运维·服务器·数据库·c++
wacsii2 小时前
【Linux进程(一)】Linux 进程初探:操作系统如何管理进程?fork() 为什么返回两次?
linux·运维·服务器
共享家95272 小时前
408 操作系统第一章
服务器·数据库·windows
AI+程序员在路上2 小时前
RV1126B 上支持的模型及全流程应用--从CNN及语音到 LLMVLM 与跨平台选型
linux·c语言·人工智能
默|笙2 小时前
【Linux网络】传输层协议TCP(1)---TCP报文介绍
linux·网络·tcp/ip
相思难忘成疾2 小时前
从零搭建 Kubernetes 1.30 集群:kubeadm 部署一主多从实战(RHEL 9.3 + Docker + flannel)
linux·运维·kubernetes
PellyKoo2 小时前
【docker】cifs卷改smb密码后容器起不来的解决方法
运维·docker·容器