Claude Code:

最近刷屏这个词:Claude Code 以后叫 CC,它是 Anthropic 的一款智能编程工具,几个特点:

  • 在终端运行 像使用命令行工具一样,无需图形用户界面 GUI
  • 深度理解整个代码库 
  • 使用自然语言 让其修复 bug、生成代码、重构代码、甚至运行测试。
  • 代理式编程工具 "Agentic Coding Tool" 提供代码建议,还能直接在你的开发环境中编辑文件并执行命令,实现自动化编程

总而言之,CC 就是在你终端里工作的 AI 助手,能理解你的代码,并依照你给出的自然语言指令,来帮助你完成编写、修改以及调试代码。

可怜的京东云用户:

在准备安装环境时,我还以为 京东云 轻量应用服务器 VPS 掉线了。看下面截图:、

Apt 源都是清华,都是运行同样的命令:

sudo apt update && sudo apt upgrade -y

这台是 北京-腾讯云 4Mbps 带宽 VPS: 2C2G50GB

这台是 北京-京东云 带宽 5Mbps, VPS: 2C4G60GB

看看腾讯在小日本儿-京东 VPS:2C2G50GB 网络 30Mbps

下面这个 VPS 在美国,1C1G10GB 网络 50Mbps,不到 $13/yr 含一个公网IP

再看看从国外源的下载速度:

腾讯-北京云:

京东-北京云:

这就是我为什么开工单,要 “京东” 调整, 说好的 5Mbps 带宽,到了国际出口就 100.8Kbps ,只有 1/50 性能

开个工单:

运行商信息:

供应商配置 带宽每月-流量费用
京东-北京云2C4G60GB5Mbps双向 500GB36个月:498/原价2459.16
腾讯-北京云2C2G50GB4Mbps单向 1024GB12个月:99元
腾讯-日本京东云2C2G50GB30Mbps单向 300GB12个月:99元
美国加州1C1G10GB50Mbps双向 512GB12个月:不到 95元

注:C=CPU's core,G=内存,GB=硬盘

安装 Claude Code

参考:Set up Claude Code - Anthropic  
           https://docs.anthropic.com/en/docs/claude-code/setup

1 确保 Ubuntu 24 是最新的系统

sudo apt update && sudo apt upgrade -y

2 安装 Node.js 18以上的版本 与 npm 

sudo apt remove nodejs npm
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

校验 Node.js / npm 安装的版本:

node --version # Should show v20.x.x
npm --version  # Should show 10.x.x or higher

root@usw:~# sudo apt remove nodejs npm
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'nodejs' is not installed, so not removed
Package 'npm' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  linux-image-6.8.0-35-generic linux-modules-6.8.0-35-generic linux-modules-extra-6.8.0-35-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2025-06-23 07:50:58 - Installing pre-requisites
Hit:1 http://security.ubuntu.com/ubuntu noble-security InRelease
Get:2 https://pkgs.tailscale.com/stable/ubuntu noble InRelease                                      
Get:3 http://nova.clouds.archive.ubuntu.com/ubuntu noble InRelease [256 kB]                         
Hit:4 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:5 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports InRelease
Fetched 262 kB in 2s (170 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apt-transport-https is already the newest version (2.8.3).
ca-certificates is already the newest version (20240203).
curl is already the newest version (8.5.0-2ubuntu10.6).
The following packages were automatically installed and are no longer required:
  linux-image-6.8.0-35-generic linux-modules-6.8.0-35-generic linux-modules-extra-6.8.0-35-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  dirmngr gnupg-utils gpg-agent gpgsm keyboxd libksba8 pinentry-curses
Suggested packages:
  pinentry-gnome3 tor parcimonie xloadimage gpg-wks-server scdaemon pinentry-doc
Recommended packages:
  gnupg-l10n gpg-wks-client
The following NEW packages will be installed:
  dirmngr gnupg gnupg-utils gpg-agent gpgsm keyboxd libksba8 pinentry-curses
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 1485 kB of archives.
After this operation, 3411 kB of additional disk space will be used.
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 libksba8 amd64 1.6.6-1build1 [122 kB]
Get:2 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 dirmngr amd64 2.4.4-2ubuntu17.2 [323 kB]
Get:3 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 gnupg-utils amd64 2.4.4-2ubuntu17.2 [109 kB]
Get:4 http://nova.clouds.archive.ubuntu.com/ubuntu noble/main amd64 pinentry-curses amd64 1.2.1-3ubuntu5 [35.2 kB]
Get:5 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 gpg-agent amd64 2.4.4-2ubuntu17.2 [227 kB]
Get:6 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 gpgsm amd64 2.4.4-2ubuntu17.2 [232 kB]
Get:7 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 keyboxd amd64 2.4.4-2ubuntu17.2 [78.3 kB]
Get:8 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates/main amd64 gnupg all 2.4.4-2ubuntu17.2 [359 kB]
Fetched 1485 kB in 0s (4153 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libksba8:amd64.
(Reading database ... 55112 files and directories currently installed.)
Preparing to unpack .../0-libksba8_1.6.6-1build1_amd64.deb ...
Unpacking libksba8:amd64 (1.6.6-1build1) ...
Selecting previously unselected package dirmngr.
Preparing to unpack .../1-dirmngr_2.4.4-2ubuntu17.2_amd64.deb ...
Unpacking dirmngr (2.4.4-2ubuntu17.2) ...
Selecting previously unselected package gnupg-utils.
Preparing to unpack .../2-gnupg-utils_2.4.4-2ubuntu17.2_amd64.deb ...
Unpacking gnupg-utils (2.4.4-2ubuntu17.2) ...
Selecting previously unselected package pinentry-curses.
Preparing to unpack .../3-pinentry-curses_1.2.1-3ubuntu5_amd64.deb ...
Unpacking pinentry-curses (1.2.1-3ubuntu5) ...
Selecting previously unselected package gpg-agent.
Preparing to unpack .../4-gpg-agent_2.4.4-2ubuntu17.2_amd64.deb ...
Unpacking gpg-agent (2.4.4-2ubuntu17.2) ...
Selecting previously unselected package gpgsm.
Preparing to unpack .../5-gpgsm_2.4.4-2ubuntu17.2_amd64.deb ...
Unpacking gpgsm (2.4.4-2ubuntu17.2) ...
Selecting previously unselected package keyboxd.
Preparing to unpack .../6-keyboxd_2.4.4-2ubuntu17.2_amd64.deb ...
Unpacking keyboxd (2.4.4-2ubuntu17.2) ...
Selecting previously unselected package gnupg.
Preparing to unpack .../7-gnupg_2.4.4-2ubuntu17.2_all.deb ...
Unpacking gnupg (2.4.4-2ubuntu17.2) ...
Setting up libksba8:amd64 (1.6.6-1build1) ...
Setting up pinentry-curses (1.2.1-3ubuntu5) ...
Setting up gpg-agent (2.4.4-2ubuntu17.2) ...
Created symlink /etc/systemd/user/sockets.target.wants/gpg-agent.socket → /usr/lib/systemd/user/gpg-agent.socket.
Created symlink /etc/systemd/user/sockets.target.wants/gpg-agent-ssh.socket → /usr/lib/systemd/user/gpg-agent-ssh.socket.
Created symlink /etc/systemd/user/sockets.target.wants/gpg-agent-extra.socket → /usr/lib/systemd/user/gpg-agent-extra.socket.
Created symlink /etc/systemd/user/sockets.target.wants/gpg-agent-browser.socket → /usr/lib/systemd/user/gpg-agent-browser.socket.
Setting up gpgsm (2.4.4-2ubuntu17.2) ...
Setting up dirmngr (2.4.4-2ubuntu17.2) ...
Created symlink /etc/systemd/user/sockets.target.wants/dirmngr.socket → /usr/lib/systemd/user/dirmngr.socket.
Setting up keyboxd (2.4.4-2ubuntu17.2) ...
Created symlink /etc/systemd/user/sockets.target.wants/keyboxd.socket → /usr/lib/systemd/user/keyboxd.socket.
Setting up gnupg-utils (2.4.4-2ubuntu17.2) ...
Setting up gnupg (2.4.4-2ubuntu17.2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.4) ...
Hit:1 http://security.ubuntu.com/ubuntu noble-security InRelease
Get:2 https://deb.nodesource.com/node_20.x nodistro InRelease [12.1 kB]                                                                                              
Get:3 http://nova.clouds.archive.ubuntu.com/ubuntu noble InRelease [256 kB]                                                                                          
Get:4 https://pkgs.tailscale.com/stable/ubuntu noble InRelease                       
Get:5 https://deb.nodesource.com/node_20.x nodistro/main amd64 Packages [11.5 kB]    
Hit:6 http://nova.clouds.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:7 http://nova.clouds.archive.ubuntu.com/ubuntu noble-backports InRelease
Fetched 286 kB in 2s (176 kB/s)
Reading package lists... Done
2025-06-23 07:51:13 - Repository configured successfully.
2025-06-23 07:51:13 - To install Node.js, run: apt-get install nodejs -y
2025-06-23 07:51:13 - You can use N|solid Runtime as a node.js alternative
2025-06-23 07:51:13 - To install N|solid Runtime, run: apt-get install nsolid -y 

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-6.8.0-35-generic linux-modules-6.8.0-35-generic linux-modules-extra-6.8.0-35-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.0 MB of archives.
After this operation, 199 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_20.x nodistro/main amd64 nodejs amd64 20.19.2-1nodesource1 [32.0 MB]
Fetched 32.0 MB in 5s (6893 kB/s) 
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package nodejs.
(Reading database ... 55243 files and directories currently installed.)
Preparing to unpack .../nodejs_20.19.2-1nodesource1_amd64.deb ...
Unpacking nodejs (20.19.2-1nodesource1) ...
Setting up nodejs (20.19.2-1nodesource1) ...
root@usw:~# 
root@usw:~# 
root@usw:~# 
root@usw:~# node --version # Should show v20.x.x
npm --version  # Should show 10.x.x or higher
v20.19.2
10.8.2
root@usw:~# 

3 配置 npm

mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global

添加路径:

echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

添加依赖包(可选)

sudo apt install -y git ripgrep

4 安装 CC

npm install -g @anthropic-ai/claude-code

root@usw:~# mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
root@usw:~# echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
root@usw:~# sudo apt install -y git ripgrep
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
git is already the newest version (1:2.43.0-1ubuntu7.2).
The following packages were automatically installed and are no longer required:
  linux-image-6.8.0-35-generic linux-modules-6.8.0-35-generic linux-modules-extra-6.8.0-35-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  ripgrep
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1551 kB of archives.
After this operation, 5335 kB of additional disk space will be used.
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu noble/universe amd64 ripgrep amd64 14.1.0-1 [1551 kB]
Fetched 1551 kB in 0s (3722 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package ripgrep.
(Reading database ... 60606 files and directories currently installed.)
Preparing to unpack .../ripgrep_14.1.0-1_amd64.deb ...
Unpacking ripgrep (14.1.0-1) ...
Setting up ripgrep (14.1.0-1) ...
root@usw:~# npm install -g @anthropic-ai/claude-code

added 3 packages in 12s

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

5 启动 CC

创建项目文件夹

mkdir ~/projects

复制项目到文件夹

root@usw:~/projects# ll
total 12
drwxr-xr-x  3 root root 4096 Jun 23 08:22 ./
drwx------ 12 root root 4096 Jun 23 08:25 ../
drwxr-xr-x  6 root root 4096 Jun 23 08:23 48.removebg/
root@usw:~/projects# 

进入项目的文件夹中,运行 claude

root@usw:~/projects# cd 48.removebg/
root@usw:~/projects/48.removebg# claude 

claude 

第一次运行 CC

1 配置显示风格

柔光用 1,我最后选的 3 为了看清楚些。

2 订阅用户登录或使用 API 付费

打折时付了年度会员,用的 1,如下:

用浏览器打开上面的链接,会拿到验证码:

粘贴到屏幕提示区

成功后,如图:

下一页,安全须知

3 进入项目

总结:

在没有 GUI 的环境里 Claude Code 是一个玩美的终端上使用 AI 的方案。如果你也是 Claude 订阅用户 ( Claude Pro ),你的 $20/月的 Claude Pro 订阅本身就包含了在终端使用 Claude Code 的权限,并且会提供比免费用户更多的使用量。 

如上图中,Anthropic 也提供另一种方式:API 令牌使用费来使用 CC,这种按量付费模式独立于你的 $20 订阅,对于需要更高使用量、灵活或特定需求的用户。

以上是在加州服务器运行,如果你的终端在国内,就要使用工具。

在国内安装 CC

使用本地代理安装 Claude Code

npm config set proxy http://127.0.0.1:1081
npm config set https-proxy http://127.0.0.1:1081
npm install -g @anthropic-ai/claude-code

注: socket port 1081 根据你自己的实际情况修改

最后把 npm anthropic 有关域加到路由,如: (以前有篇文章 用 DELETED tunel 组网)

{"type": "field","domain": ["registry.npmjs.org","*.npmjs.org","npmjs.com","*.npmjs.com","anthropic.com","*.anthropic.com","console.anthropic.com","api.anthropic.com","claude.ai","*.claude.ai"],"outboundTag": "usw_outbound"
}

修改后要重启应用

下面是日志反映出主机路由的变化,BJN:

USW:

这样在北京的主机上就可以使用 CC 来维护代码

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/bicheng/86416.shtml
繁体地址,请注明出处:http://hk.pswp.cn/bicheng/86416.shtml
英文地址,请注明出处:http://en.pswp.cn/bicheng/86416.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Docker部署prometheus+grafana+...

Docker部署prometheusgrafana… prometheus官网 官网 https://prometheus.io/ 中文网址 https://prometheus.ac.cn/ Prometheus简介 Prometheus(普罗米修斯)是一套开源的监控&报警&时间序列数据库的组合,由SoundCloud公司开发。 Prometheus基…

Python爬虫实战:研究Spynner相关技术

1 引言 1.1 研究背景与意义 随着互联网的迅速发展,网页内容呈现形式日益复杂。传统的静态网页逐渐被动态网页所取代,大量内容通过 JavaScript 动态生成或 AJAX 异步加载。这使得传统爬虫(如基于 Requests 库的爬虫)难以获取完整的网页信息,因为它们只能获取页面的初始 H…

人工智能训练知识学习-TTS(智能语音合成)

人机对话——TTS(TextToSpeech) 概念: TTS技术,即文本转语音技术,是一种将文字内容转换为语音输出的技术。它通过计算机程序和算法,将文本信息转化为自然流畅的语音信号,让用户能够听到文字内…

【Java高频面试问题】JVM篇

【Java高频面试问题】JVM篇 类加载机制加载(Loading)连接(Linking)‌初始化(Initialization)‌使用(Using)与卸载(Unloading) 类加载器和双亲委派模型类加载器…

DBeaver的sql编辑器文本格式字体大小设置

DBeaver的sql编辑器文本格式字体大小设置。开始就没有找到。早上比较清醒被我发现了。记录下来

自学Java怎么入门

自学Java其实没有想象中那么难,只要找对方法,循序渐进地学习,很快就能上手。下面我结合自己的经验,给你整理一条清晰的学习路径,咱们一步步来。 一、先了解Java能做什么 在开始之前,建议你先看看Java都能…

操作系统面试知识点(1):操作系统基础

目录 1.什么是操作系统: 2.操作系统有哪些功能? 3.常见的操作系统有哪些 4.用户态和内核态 5.内核态权限这么高,为什么不还要用户态? 6.用户态和内核态是如何切换的? 7.系统调用 8,系统调用的过程 ​​​​​​​1.什么是操作系统: (1)操作系统(OS)是管理计算机软硬…

Linux 和 Windows 服务器:哪一个更适合您的业务需求?

在选择服务器操作系统时,Linux 和 Windows 服务器是最常见的两种选择。它们各有特点,适合不同的业务需求和使用环境。本文将详细分析 Linux 和 Windows 服务器的主要差异,包括成本、安全性、性能、定制化能力和用户界面等方面,帮助…

CertiK联创顾荣辉将于港大活动发表演讲,分享Web3安全与发展新视角

CertiK联合创始人、哥伦比亚大学教授顾荣辉,将于6月30日出席香港大学经管学院主办的“Web3革新与商业机遇”活动,并发表主题演讲《规模化Web3:面向全球受众的创新与安全平衡之道》。 本次活动由港大经管学院高层管理教育主办,Met…

SpringAI系列---【SpringAI如何接入阿里云百炼大模型?】

1.导言 阿里云百炼的通义千问模型支持 OpenAI 兼容接口,您只需调整 API Key、BASE_URL 和模型名称,即可将原有 OpenAI 代码迁移至阿里云百炼服务使用。 如果是要接入阿里云百炼模型,首先推荐使用Spring AI Alibaba,而不是使用Spri…

电子电气架构 --- 实时系统评价的概述

我是穿拖鞋的汉子,魔都中坚持长期主义的汽车电子工程师。 老规矩,分享一段喜欢的文字,避免自己成为高知识低文化的工程师: 做到欲望极简,了解自己的真实欲望,不受外在潮流的影响,不盲从,不跟风。把自己的精力全部用在自己。一是去掉多余,凡事找规律,基础是诚信;二是…

Flink SQL执行流程深度剖析:从SQL语句到分布式执行

在大数据处理领域,Flink SQL凭借其强大的处理能力和易用性,成为众多开发者的选择。与其他OLAP引擎类似,Flink SQL的SQL执行流程大致都需要经过词法解析、语法解析、生成抽象语法树(AST)、校验以及生成逻辑执行计划等步…

什么是redis

Redis是一个开源的、基于内存的高性能键值存储数据库,广泛用于缓存、消息队列、会话存储等场景。 - 核心特点: - 内存存储:数据存储在内存中,读写速度极快。 - 键值对:以键值对形式存储数据,键通常是字…

《从0到1:C/C++音视频开发自学指南》

开启自学之旅:为何选择 C/C 音视频开发 在当今数字化时代,音视频开发的应用场景极为广泛,深刻融入了我们生活与工作的方方面面。从火爆的直播行业,无论是电商直播中主播与观众的实时互动,还是游戏直播里精彩赛事的实时…

学习日记-spring-day37-6.25

知识点: 1.使用utillist进行配置 知识点 核心内容 重点 Spring框架中utl名称空间创建List 通过utl名称空间创建并管理集合对象,实现数据复用 utl list与普通list赋值的区别; 名称空间引入方法 无参构造器使用规则 当类中没有其他构造器时&#x…

【Python练习】012. 使用字符串的upper()方法将字符串转换为大写

012. 使用字符串的upper方法将字符串转换为大写 012. 使用字符串的upper()方法将字符串转换为大写示例代码运行结果代码解释 扩展:动态输入字符串示例运行 何时使用upper方法基本用法示例忽略大小写的字符串比较数据清洗标准化 注意事项 012. 使用字符串的upper()方…

Python Polars库详解:高性能数据处理的新标杆

在数据驱动的时代,高效的数据处理能力已成为开发者和数据科学家的核心竞争力。作为Pandas的强劲挑战者,Polars库凭借其基于Rust的底层架构和创新的表达式引擎,在性能测试中展现出惊人的速度优势。本文将深入解析Polars的核心特性、使用技巧及…

Go语言- 单元测试

实际开发中,需要保证单元功能正确。 传统方式:在main函数中直接调用,查看结合是否和预期一致。 缺点:1. 不方便 2. 不利于管理 因此,单元测试具有必要性 testing测试框架 Go语言中自带testing轻量级测试框架和go…

Vue移动端开发的适配方案与性能优化技巧

文章目录 1. 移动端适配方案1.1. 视口适配1.2. 基于rem/em的适配方案1.3. vw/vh视口单位适配1.4. 移动端UI组件库适配 2. 移动端性能优化技巧2.1. 虚拟列表实现长列表优化2.2. 图片懒加载与优化2.3. 减少首屏加载时间2.4. 事件节流与防抖 3. 移动端常见问题解决方案3.1. 移动端…

如何微调和部署OpenVLA在机器人平台上

这个教程来自这个英伟达网址 教程的目标是提供用于部署 VLA 模型的优化量化和推理方法,以及针对新机器人、任务和环境的参考微调流程。在一个自包含的仿真环境中,结合场景生成和领域随机化(MimicGen)对性能和准确性进行严格验证。…