Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of using code-server to build cloud VSCode

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Xiaobian to share with you the use of code-server to build cloud VSCode method, I hope you read this article after the harvest, let us discuss it together!

Target

Run VS Code on your server via code-server and access VS Code via browser.

server

First you need to prepare a server, the official document recommends the minimum configuration is

1 GB of RAM2 cores (1 core runs but sometimes gets stuck)

If you don't have a server yet, it is recommended to buy Tencent Cloud (Cloud)(Conscience Cloud) server in China; Vultr recommended abroad, billing by volume, 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 be any Linux distribution you like, and this article uses Ubuntu 20.04 as an example.

Install code-server

We will install code-server via the official script provided. Log in to your server using XShell or Putty, and run the following commands:

curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-runcurl -fsSL https://code-server.dev/install.sh | sh

After running, the installation script will print out how to run and use code-server.

systemctl start code-server@$USER //start code-server access code-server

By default, code-server logs in with a password (stored in ~/.config/code-server/config.yaml) and listens to losthost to avoid exposing itself to the outside world. But our goal is to access it on different machines.

Below I will introduce a secure and simple way to access code-server.

Before going any further, you need to make sure that the server has HTTP/HTTPS ports open.

ufw allow 80ufw allow 443

1, a domain name of your own (you have seen here believe that you are also a domain name person. If you don't already have one, consider buying one, I use NameCheap, Github student pack has free NameCheap domain name for one year).

2. Use A record 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.listsudo apt updatesudo apt install caddyCaddy server is an open source web server written in Golang and supporting HTTP/2. It uses the Golang standard library to provide HTTP functionality. One notable feature of Caddy is that HTTPS is enabled by default. It was the first Web server to offer HTTPS features without additional configuration.

--Wikipedia

Note: Caddy 2 is installed in the above method, and most of the Caddy documents searched out from the Internet in Chinese are version 1. There are many differences between 2 and 1. Please refer to the official English documents by yourself.

nano /etc/caddy/Caddyfile, replace the following with the contents of

yourdomain.comreverse_proxy 127.0.0.1:8080

5. Restart caddy:

sudo systemctl reload caddy

Then visit https://in your browser to get to your code-server page!

change the password

Just change the password value in ~/.config/code-server/config.yaml and restart code-server:

sudo systemctl restart code-server@$USER After reading this article, I believe you have a certain understanding of how to use code-server to build a cloud VSCode. If you want to know more about it, please pay attention to the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report