zh

开发者离岸VPS:完整开发环境和工作流程指南

离岸VPS不仅适合托管网站,对开发者来说更是强大的开发和部署平台。在离岸服务器上运行开发工具意味着摆脱本地资源限制、保护代码隐私,并在全球任何地方都能访问一致的开发环境。本指南专为开发者打造,介绍如何将离岸VPS配置为高效的开发工作站。

Need this done for your project?

We implement, you ship. Async, documented, done in days.

Start a Brief

配置开发环境基础工具

在VPS上搭建完整的开发环境,安装以下基础工具: 通用开发工具: apt update apt install git curl wget vim tmux zsh build-essential -y 安装Oh My Zsh提升终端效率: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 安装Node.js(使用nvm管理版本): curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash source ~/.bashrc nvm install --lts nvm use --lts 安装Python: apt install python3 python3-pip python3-venv -y 安装Docker和Docker Compose: curl -fsSL https://get.docker.com | bash usermod -aG docker $USER newgrp docker apt install docker-compose-plugin -y 配置tmux多窗口(创建 ~/.tmux.conf): set -g mouse on set -g history-limit 10000 使用tmux可以在断开SSH后保持会话运行,下次连接直接恢复: tmux new -s dev (创建会话) tmux attach -t dev (恢复会话)

搭建自托管Git服务器(Gitea)

Gitea是轻量级的自托管Git服务,占用资源极少,功能完整,适合个人和小团队在离岸VPS上托管私有代码仓库。 使用Docker Compose部署Gitea: 创建 /opt/gitea/docker-compose.yml: version: '3' services: gitea: image: gitea/gitea:latest environment: - USER_UID=1000 - USER_GID=1000 - GITEA__database__DB_TYPE=sqlite3 volumes: - ./data:/data ports: - 127.0.0.1:3000:3000 - 2222:22 # Git SSH端口 启动: cd /opt/gitea && docker compose up -d 通过Nginx反向代理访问(配置与前述相同): server_name git.example.com; location / { proxy_pass http://127.0.0.1:3000; } 首次访问 https://git.example.com 完成初始化配置。 使用离岸VPS托管代码仓库的优势:代码不经过第三方平台(GitHub/GitLab),完全受您控制,特别适合敏感项目或需要遵守特定合规要求的代码。

配置轻量CI/CD流水线

使用Drone CI或Woodpecker CI(Drone的开源分支)与Gitea集成,实现自动化测试和部署。 以Woodpecker CI为例,添加到Gitea的docker-compose.yml: woodpecker-server: image: woodpeckerci/woodpecker-server:latest ports: - 127.0.0.1:8000:8000 environment: - WOODPECKER_OPEN=false - WOODPECKER_GITEA=true - WOODPECKER_GITEA_URL=https://git.example.com - WOODPECKER_GITEA_CLIENT=Gitea OAuth App ClientID - WOODPECKER_GITEA_SECRET=Gitea OAuth App Secret - WOODPECKER_AGENT_SECRET=随机生成的Agent密钥 woodpecker-agent: image: woodpeckerci/woodpecker-agent:latest volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - WOODPECKER_SERVER=woodpecker-server:9000 - WOODPECKER_AGENT_SECRET=与上面相同的Agent密钥 在代码仓库根目录创建 .woodpecker.yml 定义流水线: pipeline: test: image: node:lts commands: - npm ci - npm test deploy: image: alpine commands: - apk add rsync openssh-client - rsync -avz dist/ user@production-server:/var/www/app/ secrets: [SSH_KEY] when: branch: main

VS Code Remote SSH开发工作流

VS Code的Remote SSH扩展允许您在本地VS Code中直接编辑和运行VPS上的代码,体验与本地开发完全相同。 配置步骤: 1. 在VS Code中安装「Remote - SSH」扩展 2. 编辑本地SSH配置文件 ~/.ssh/config: Host mydev-vps HostName 服务器IP User 您的用户名 Port 50022 IdentityFile ~/.ssh/id_ed25519 3. 在VS Code中按 Ctrl+Shift+P,搜索「Remote-SSH: Connect to Host」,选择 mydev-vps 4. VS Code会自动在服务器上安装所需组件,连接成功后您可以: - 直接在VPS文件系统中打开文件夹 - 使用集成终端直接操作服务器 - 所有VS Code插件在远端运行 - Git操作直接作用于服务器上的仓库 配合tmux保持长时间运行的进程,VS Code Remote SSH打造了流畅的远程开发体验。AnubizHost离岸VPS的低延迟网络连接(欧洲节点延迟通常100-150ms)确保远程开发体验流畅。

Why Anubiz Host

100% async — no calls, no meetings
Delivered in days, not weeks
Full documentation included
Production-grade from day one
Security-first approach
Post-delivery support included

Ready to get started?

Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.

Anubiz Chat AI

Online