Loading... # 引言 迁移部署云开发环境,原汁原味的开发即生产的编码模式,哈哈哈 # 下载 下载适配您系统的版本 [github](https://github.com/coder/code-server/releases) 如:https://github.com/coder/code-server/releases/download/v4.22.1/code-server-4.22.1-amd64.rpm 我这里使用了加速镜像源。 ```bash curl https://git.xfj0.cn/https://github.com/coder/code-server/releases/download/v4.22.1/code-server-4.22.1-amd64.rpm -o code.rpm # curl https://git.xfj0.cn/https://github.com/coder/code-server/releases/download/v4.22.1/code-server-4.22.1-amd64.rpm -o code.rpm % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 93.9M 100 93.9M 0 0 10.1M 0 0:00:09 0:00:09 --:--:-- 11.9M yum install code.rpm -y Last metadata expiration check: 1:15:17 ago on Fri 15 Mar 2024 10:05:02 AM CST. Dependencies resolved. =============================================================================================================================================================================================================================================== Package Architecture Version Repository Size =============================================================================================================================================================================================================================================== Upgrading: code-server x86_64 4.22.1-1 @commandline 94 M Transaction Summary =============================================================================================================================================================================================================================================== Upgrade 1 Package Total size: 94 M Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Upgrading : code-server-4.22.1-1.x86_64 1/2 Cleanup : code-server-4.22.0-1.x86_64 2/2 Running scriptlet: code-server-4.22.0-1.x86_64 2/2 Verifying : code-server-4.22.1-1.x86_64 1/2 Verifying : code-server-4.22.0-1.x86_64 2/2 Upgraded: code-server-4.22.1-1.x86_64 Complete! ``` # 注册服务 ```bash sudo systemctl enable --now code-server@$USER ``` # 设置密码 ```bash cd ~/.config/code-server/ vi config.yaml # 在这里配置监听地址和端口号 bind-addr: 127.0.0.1:8192 auth: password password: 这里是密码 cert: false ``` # 配置nginx 按照官网上的配置是会报错的,websocket连接会出问题 ```properties location /code/ { proxy_pass http://localhost:8192/; proxy_set_header Host $host:8192/code; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; proxy_set_header Accept-Encoding gzip; proxy_set_header X-Forwarded-Host $http_host; } ``` ![image.png](https://www.zunmx.top/usr/uploads/2024/03/494647996.png) © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏