头图

Install

There are many ways to install code-server, and the more versatile method is to use docker and npm. Let’s take docker as an example.

Use docker to install code-server

<!-- more -->

Use this command to run after accessing container -p 127.0.0.1:8080:8080 specified 8080 port to view operating results, the console will output the required keys

# This will start a code-server container and expose it at http://127.0.0.1:8080.
# It will also mount your current directory into the container as `/home/coder/project`
# and forward your UID/GID so that all file system operations occur as your user outside
# the container.
#
# Your $HOME/.config is mounted at $HOME/.config within the container to ensure you can
# easily access/modify your code-server config in $HOME/.config/code-server/config.json
# outside the container.
mkdir -p ~/.config
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
  -v "$HOME/.config:/home/coder/.config" \
  -v "$PWD:/home/coder/project" \
  -u "$(id -u):$(id -g)" \
  -e "DOCKER_USER=$USER" \
  codercom/code-server:latest

If you need to change the configuration file, please modify the configuration ~/.config

Use npm to install code-server

The coder server uses the same major version of Node.js as VSCode's Electron, currently 14.x

npm i -g code-server

Standalone version installation

Go directly to the official website download your system, and then you can refer to the following steps to install

tar -xzvf ./<您所下载的独立版本的文件>
./<解压后的路径>/code-server

At this point, you can see the output of code-server in the console. You can also refer to the following tutorial for simple configuration

code-server configuration method
modify the default port of code-server, password
nginx reverse proxy code-server


墨抒颖
74 声望11 粉丝

msy.plus