Related recommendations: "vscode Basic Tutorial"
Recently, I always have to carry a computer when I go out to study, which is quite tiring, but I A computer is required for programming. Is there any way I can just take my iPad out and program at the same time?
The answer is the open source project code-server, through which VS Code can be run on the browser. Below I will introduce how to use code-server to build your cloud VS Code.
Goal
Run VS Code on your server through code-server, and then access VS Code through the browser.
Server
First you need to prepare a server. The minimum configuration recommended by the official documentation is
- 1 GB of RAM
- 2 cores ( 1 Nuclear can run, but sometimes it gets stuck)
If you don’t have a server yet, it is recommended to buy Tencent Cloud (Conscience Cloud) server in China; it is recommended to buy Vultr abroad, which is billed by volume and has a good line. Support WeChat/Alipay. If you want to support me, you can use my AFF link and you will get a $100 credit and I will get a $25 credit.
The operating system can use any Linux distribution you like. This article uses Ubuntu 20.04 as an example.
Install code-server
We will install code-server through the official script. Use XShell or Putty to log in to your server, and then run the following commands in sequence:
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run curl -fsSL https://code-server.dev/install.sh | sh
After completion, the installation script will print out how to run and use code-server.
systemctl start code-server@$USER // 启动code-server
Access code-server
code-server uses a password to log in by default (the password is saved in ~/.config/code-server/config.yaml
), and monitors losthost thus avoids exposing itself to the outside world. But our goal is to access it on different machines.
Below I will introduce a safe and simple method to access code-server.
Before going further, you need to ensure that the server opens the HTTP/HTTPS port
ufw allow 80 ufw allow 443
1. A domain name of your own (you have already seen this, I believe you also have a domain name. If you don’t have one yet, you might consider purchasing one (I use NameCheap, the Github student package comes with a free NameCheap domain for one year).
2. Use A records to resolve your domain name to the server IP.
3. Install Caddy.
echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \ | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list sudo apt update sudo apt install caddy
Caddy server is an open source web server written in Golang that supports HTTP/2. It uses the Golang standard library to provide HTTP functionality. A notable feature of Caddy is that HTTPS is enabled by default. It is the first web server to provide HTTPS features without additional configuration.——Wikipedia
Note: The above method installs Caddy 2, and most of the Caddy documents currently searched on the Chinese Internet are version 1. There are many differences between 2 and 1. Please check it yourself. Official English documentation.
4. nano /etc/caddy/Caddyfile
, replace the content with the following
yourdomain.com reverse_proxy 127.0.0.1:8080
5. Restart caddy:
sudo systemctl reload caddy
Then visit https://<your-domain-name></your-domain-name>
in the browser to enter your code-server page!
Change Password
Just modify the value of password in ~/.config/code-server/config.yaml
, and then restart code-server:
sudo systemctl restart code-server@$USER
Reference
code-server Setup Guide(https://github.com/cdr/code-server/blob/v3.7.3/doc/guide.md)
For more programming-related knowledge, please visit: programming teaching! !
The above is the detailed content of How to use code-server to build your own cloud VSCode?. For more information, please follow other related articles on the PHP Chinese website!

VisualStudio is suitable for large-scale project development, while VSCode is suitable for lightweight and highly customizable environments. 1. VisualStudio provides powerful intelligent perception and debugging functions, suitable for large-scale projects and enterprise-level development. 2. VSCode provides flexibility and customization capabilities through extended systems, suitable for multiple programming languages and cross-platform development.

VisualStudio subscriptions are available in multiple levels, suitable for different developers' needs. 1. The basic version is free and suitable for individuals and small teams. 2. Advanced versions such as Professional and Enterprise provide advanced tools and team collaboration functions, suitable for enterprise users.

The difference between VisualStudio and VSCode in performance and resource usage is mainly reflected in: 1. Startup speed: VSCode is faster; 2. Memory usage: VSCode is lower; 3. CPU usage: VisualStudio is higher during compilation and debugging. When choosing, it must be determined based on project requirements and development environment.

VisualStudio (VS) is a powerful integrated development environment (IDE) developed by Microsoft, which supports multiple programming languages, such as C#, C, Python, etc. 1) It provides a rich set of features including code editing, debugging, versioning and testing. 2) VS processes code through powerful editors and debuggers, and supports advanced code analysis and reconstruction using Roslyn and Clang/MSVC compiler platforms. 3) Basic usage is like creating a C# console application, and advanced usage is like implementing polymorphism. 4) Common errors can be debugged by setting breakpoints, viewing output windows, and using instant windows. 5) Performance optimization suggestions include the use of asynchronous programming, code reconstruction and performance analysis.

In VisualStudio, the steps for compiling, testing and deploying the code are as follows: 1. Compiling: Use VisualStudio's compiler options to convert source code into executable files, supporting multiple languages such as C#, C and Python. 2. Testing: Use built-in MSTest and NUnit to perform unit testing to improve code quality and reliability. 3. Deployment: Transfer applications from the development environment to the production environment through web deployment, Azure deployment, etc. to ensure security and performance.

VisualStudioisMicrosoft'sflagshipIDE,supportingmultipleprogramminglanguagesandenhancingcodingefficiency.1)ItoffersfeatureslikeIntelliSenseforcodeprediction,multi-tabbedinterfaceforprojectmanagement,andtoolsfordebugging,refactoring,andversioncontrol.2

The main difference between the free and paid versions of VisualStudio is the richness of features and the service supported. The free version (Community) is suitable for individual developers and small teams, providing basic development tools; the paid version (Professional and Enterprise) provides advanced features such as advanced debugging and team collaboration tools, suitable for large projects and enterprise-level development.

VisualStudioCommunityEdition is a free IDE suitable for individual developers, small teams and educational institutions. 1) It provides functions such as code editing, debugging, testing and version control. 2) Based on the Roslyn compiler platform, it supports multiple programming languages and integrates Git and TFVC. 3) Advanced features include unit testing, optimization suggestions include turning off unnecessary extensions and using a lightweight editor.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Chinese version
Chinese version, very easy to use

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
