2022-10-14 06:16:55 +08:00
<!-- prettier - ignore - start -->
2020-05-22 03:17:02 +08:00
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE - RUN doctoc TO UPDATE -->
2020-05-21 00:13:03 +08:00
# Install
2021-02-13 05:05:01 +08:00
- [install.sh ](#installsh )
2021-07-08 00:00:51 +08:00
- [Detection reference ](#detection-reference )
2022-08-31 01:00:11 +08:00
- [npm ](#npm )
2021-07-08 00:00:51 +08:00
- [Standalone releases ](#standalone-releases )
2021-02-13 05:05:01 +08:00
- [Debian, Ubuntu ](#debian-ubuntu )
- [Fedora, CentOS, RHEL, SUSE ](#fedora-centos-rhel-suse )
- [Arch Linux ](#arch-linux )
2022-08-10 02:31:28 +08:00
- [Artix Linux ](#artix-linux )
2021-02-13 05:05:01 +08:00
- [macOS ](#macos )
- [Docker ](#docker )
2021-07-08 00:00:51 +08:00
- [Helm ](#helm )
2021-08-23 02:50:49 +08:00
- [Windows ](#windows )
2021-07-08 00:00:51 +08:00
- [Raspberry Pi ](#raspberry-pi )
- [Termux ](#termux )
- [Cloud providers ](#cloud-providers )
2021-07-23 07:10:09 +08:00
- [Uninstall ](#uninstall )
- [install.sh ](#installsh-1 )
- [Homebrew ](#homebrew )
2022-08-31 01:00:11 +08:00
- [npm ](#npm-1 )
2021-07-23 07:10:09 +08:00
- [Debian, Ubuntu ](#debian-ubuntu-1 )
2020-05-22 03:17:02 +08:00
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2022-10-14 06:16:55 +08:00
<!-- prettier - ignore - end -->
2020-05-22 03:17:02 +08:00
2021-07-08 00:00:51 +08:00
This document demonstrates how to install `code-server` on various distros and
operating systems.
2020-11-24 10:07:02 +08:00
2020-05-22 05:10:29 +08:00
## install.sh
2021-07-08 00:00:51 +08:00
The easiest way to install code-server is to use our [install
2022-02-02 00:45:19 +08:00
script](https://github.com/coder/code-server/blob/main/install.sh) for Linux, macOS and FreeBSD. The install script
2021-07-08 00:00:51 +08:00
[attempts to use the system package manager ](#detection-reference ) if possible.
2020-05-22 05:10:29 +08:00
2021-07-08 00:00:51 +08:00
You can preview what occurs during the install process:
2020-05-22 05:10:29 +08:00
```bash
2020-05-28 03:48:03 +08:00
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
2020-05-22 05:10:29 +08:00
```
2021-07-08 00:00:51 +08:00
To install, run:
2020-05-22 05:10:29 +08:00
```bash
curl -fsSL https://code-server.dev/install.sh | sh
```
2021-07-08 00:00:51 +08:00
You can modify the installation process by including one or more of the
following flags:
2020-05-22 10:16:16 +08:00
2021-07-08 00:00:51 +08:00
- `--dry-run` : echo the commands for the install process without running them.
- `--method` : choose the installation method.
- `--method=detect` : detect the package manager but fallback to
`--method=standalone` .
- `--method=standalone` : install a standalone release archive into `~/.local` .
- `--prefix=/usr/local` : install a standalone release archive system-wide.
- `--version=X.X.X` : install version `X.X.X` instead of latest version.
- `--help` : see usage docs.
2022-11-11 02:50:37 +08:00
- `--edge` : install the latest edge version (i.e. pre-release)
2020-05-22 11:53:02 +08:00
2021-07-08 00:00:51 +08:00
When done, the install script prints out instructions for running and starting
code-server.
2020-05-22 11:53:02 +08:00
2021-07-08 00:00:51 +08:00
> If you're concerned about the install script's use of `curl | sh` and the
> security implications, please see [this blog
> post](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install)
> by [sandstorm.io](https://sandstorm.io).
2020-05-22 11:53:02 +08:00
2021-07-08 00:00:51 +08:00
If you prefer to install code-server manually, despite the [detection
references](#detection-reference) and `--dry-run` feature, then continue on for
2022-02-02 00:45:19 +08:00
information on how to do this. The [`install.sh` ](https://github.com/coder/code-server/blob/main/install.sh ) script runs the
2021-07-08 00:00:51 +08:00
_exact_ same commands presented in the rest of this document.
2020-05-22 11:53:02 +08:00
2021-07-08 00:00:51 +08:00
### Detection reference
2020-05-22 11:53:02 +08:00
2021-07-08 00:00:51 +08:00
- For Debian and Ubuntu, code-server will install the latest deb package.
- For Fedora, CentOS, RHEL and openSUSE, code-server will install the latest RPM
package.
- For Arch Linux, code-server will install the AUR package.
- For any unrecognized Linux operating system, code-server will install the
latest standalone release into `~/.local` .
2020-05-22 05:19:22 +08:00
2021-07-08 00:00:51 +08:00
- Ensure that you add `~/.local/bin` to your `$PATH` to run code-server.
2020-05-22 05:10:29 +08:00
2021-07-08 00:00:51 +08:00
- For macOS, code-server will install the Homebrew package (if you don't have
Homebrew installed, code-server will install the latest standalone release
into `~/.local` ).
2020-05-22 05:19:22 +08:00
2021-07-08 00:00:51 +08:00
- Ensure that you add `~/.local/bin` to your `$PATH` to run code-server.
2020-05-22 05:10:29 +08:00
2022-08-31 01:00:11 +08:00
- For FreeBSD, code-server will install the [npm package ](#npm ) with `npm`
2020-06-13 22:56:50 +08:00
2021-07-08 00:00:51 +08:00
- If you're installing code-server onto architecture with no releases,
2022-08-31 01:00:11 +08:00
code-server will install the [npm package ](#npm ) with `npm`
2021-07-08 00:00:51 +08:00
- We currently offer releases for amd64 and arm64.
2022-08-31 01:00:11 +08:00
- The [npm package ](#npm ) builds the native modules on post-install.
2021-07-08 00:00:51 +08:00
2022-08-31 01:00:11 +08:00
## npm
2021-07-08 00:00:51 +08:00
2022-08-31 01:00:11 +08:00
We recommend installing with `npm` when:
2021-07-08 00:00:51 +08:00
1. You aren't using a machine with `amd64` or `arm64` .
2023-09-22 05:42:17 +08:00
2. You are installing code-server on Windows.
3. You're on Linux with `glibc` < v2.28 or `glibcxx` < v3 . 4 . 21 .
4. You're running Alpine Linux or are using a non-glibc libc. See
2022-02-02 00:45:19 +08:00
[#1430 ](https://github.com/coder/code-server/issues/1430#issuecomment-629883198 )
2021-07-08 00:00:51 +08:00
for more information.
2022-08-31 01:00:11 +08:00
Installing code-server with `npm` builds native modules on install.
2021-07-08 00:00:51 +08:00
2022-09-07 00:38:55 +08:00
This process requires C dependencies; see our guide on [installing with npm ](./npm.md ) for more information.
2021-07-08 00:00:51 +08:00
## Standalone releases
We publish self-contained `.tar.gz` archives for every release on
2022-02-02 00:45:19 +08:00
[GitHub ](https://github.com/coder/code-server/releases ). The archives bundle the
2021-07-08 00:00:51 +08:00
node binary and node modules.
2022-08-31 01:00:11 +08:00
We create the standalone releases using the [npm package ](#npm ), and we
2021-07-08 00:00:51 +08:00
then create the remaining releases using the standalone version.
2023-09-22 05:42:17 +08:00
The only requirement to use the standalone release is `glibc` >= 2.28 and
`glibcxx` >= v3.4.21 on Linux (for macOS, there is no minimum system
2021-07-08 00:00:51 +08:00
requirement).
To use a standalone release:
1. Download the latest release archive for your system from
2022-02-02 00:45:19 +08:00
[GitHub ](https://github.com/coder/code-server/releases ).
2021-07-08 00:00:51 +08:00
2. Unpack the release.
3. Run code-server by executing `./bin/code-server` .
You can add `./bin/code-server` to your `$PATH` so that you can execute
`code-server` without providing full path each time.
Here is a sample script for installing and using a standalone code-server
release on Linux:
```bash
mkdir -p ~/.local/lib ~/.local/bin
2022-02-02 00:45:19 +08:00
curl -fL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz \
2021-07-08 00:00:51 +08:00
| tar -C ~/.local/lib -xz
mv ~/.local/lib/code-server-$VERSION-linux-amd64 ~/.local/lib/code-server-$VERSION
ln -s ~/.local/lib/code-server-$VERSION/bin/code-server ~/.local/bin/code-server
PATH="~/.local/bin:$PATH"
code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```
2020-05-22 05:10:29 +08:00
2020-05-21 00:13:03 +08:00
## Debian, Ubuntu
2021-07-08 00:00:51 +08:00
> The standalone arm64 .deb does not support Ubuntu 16.04 or earlier. Please
2022-08-31 01:00:11 +08:00
> upgrade or [build with npm](#npm).
2021-04-09 02:12:01 +08:00
2020-05-21 00:13:03 +08:00
```bash
2022-09-08 07:23:36 +08:00
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb
sudo dpkg -i code-server_${VERSION}_amd64.deb
2020-07-23 03:58:51 +08:00
sudo systemctl enable --now code-server@$USER
2020-05-21 00:13:03 +08:00
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```
2020-05-22 03:17:02 +08:00
## Fedora, CentOS, RHEL, SUSE
2020-05-21 00:13:03 +08:00
2021-07-08 00:00:51 +08:00
> The standalone arm64 .rpm does not support CentOS 7. Please upgrade or [build
2022-08-31 01:00:11 +08:00
> with npm](#npm).
2021-04-09 02:12:01 +08:00
2020-05-21 00:13:03 +08:00
```bash
2022-02-02 00:45:19 +08:00
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-amd64.rpm
2021-05-18 03:59:41 +08:00
sudo rpm -i code-server-$VERSION-amd64.rpm
2020-07-23 03:58:51 +08:00
sudo systemctl enable --now code-server@$USER
2020-05-21 00:13:03 +08:00
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```
## Arch Linux
```bash
2021-07-08 00:00:51 +08:00
# Install code-server from the AUR using yay.
2020-05-21 00:13:03 +08:00
yay -S code-server
2020-07-23 03:58:51 +08:00
sudo systemctl enable --now code-server@$USER
2020-05-21 00:13:03 +08:00
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```
```bash
2021-07-08 00:00:51 +08:00
# Install code-server from the AUR with plain makepkg.
2020-05-21 00:13:03 +08:00
git clone https://aur.archlinux.org/code-server.git
cd code-server
makepkg -si
2020-07-23 03:58:51 +08:00
sudo systemctl enable --now code-server@$USER
2020-05-21 00:13:03 +08:00
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```
2022-08-10 02:31:28 +08:00
## Artix Linux
```bash
# Install code-server from the AUR
git clone https://aur.archlinux.org/code-server.git
cd code-server
makepkg -si
```
Save the file as `code-server` in `/etc/init.d/` and make it executable with `chmod +x code-server` . Put your username in line 3.
```bash
#!/sbin/openrc-run
name=$RC_SVCNAME
description="$name - VS Code on a remote server"
user="" # your username here
homedir="/home/$user"
command="$(which code-server)"
# Just because you can do this does not mean you should. Use ~/.config/code-server/config.yaml instead
#command_args="--extensions-dir $homedir/.local/share/$name/extensions --user-data-dir $homedir/.local/share/$name --disable-telemetry"
command_user="$user:$user"
pidfile="/run/$name/$name.pid"
command_background="yes"
extra_commands="report"
depend() {
use logger dns
need net
}
start_pre() {
checkpath --directory --owner $command_user --mode 0755 /run/$name /var/log/$name
}
start() {
default_start
report
}
stop() {
default_stop
}
status() {
default_status
report
}
report() {
# Report to the user
einfo "Reading configuration from ~/.config/code-server/config.yaml"
}
```
Start on boot with default runlevel
```
rc-update add code-server default
```
Start the service immediately
```
rc-service code-server start
```
2020-05-21 00:13:03 +08:00
## macOS
```bash
brew install code-server
brew services start code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```
2020-05-22 03:17:02 +08:00
## Docker
2020-05-22 05:10:29 +08:00
```bash
# 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.
2020-08-27 01:00:10 +08:00
#
# 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
2020-09-04 06:38:40 +08:00
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
2023-09-23 09:07:07 +08:00
-v "$HOME/.local:/home/coder/.local" \
2020-08-27 01:00:10 +08:00
-v "$HOME/.config:/home/coder/.config" \
2020-05-22 05:10:29 +08:00
-v "$PWD:/home/coder/project" \
-u "$(id -u):$(id -g)" \
2020-09-04 06:38:40 +08:00
-e "DOCKER_USER=$USER" \
2020-05-22 05:10:29 +08:00
codercom/code-server:latest
```
2021-07-08 00:00:51 +08:00
Our official image supports `amd64` and `arm64` . For `arm32` support, you can
use a [community-maintained code-server
alternative](https://hub.docker.com/r/linuxserver/code-server).
2020-11-14 06:32:14 +08:00
2021-07-08 00:00:51 +08:00
## Helm
2020-11-14 06:32:14 +08:00
2021-08-26 03:15:34 +08:00
You can install code-server using the [Helm package manager ](https://coder.com/docs/code-server/latest/helm ).
2021-02-16 13:43:10 +08:00
2021-08-23 01:36:41 +08:00
## Windows
2023-02-14 06:52:48 +08:00
We currently [do not publish Windows
releases](https://github.com/coder/code-server/issues/1397). We recommend
installing code-server onto Windows with [`npm` ](#npm ).
2021-08-23 01:49:52 +08:00
2021-07-08 00:00:51 +08:00
## Raspberry Pi
2021-07-02 06:19:16 +08:00
2022-08-31 01:00:11 +08:00
We recommend installing code-server onto Raspberry Pi with [`npm` ](#npm ).
2021-07-02 06:19:16 +08:00
2022-08-02 00:04:41 +08:00
If you see an error related to `node-gyp` during installation, See [#5174 ](https://github.com/coder/code-server/issues/5174 ) for more information.
2021-07-08 00:00:51 +08:00
## Termux
2021-07-02 06:19:16 +08:00
2021-07-08 00:00:51 +08:00
Please see code-server's [Termux docs ](./termux.md#installation ) for more
information.
2021-07-02 06:19:16 +08:00
2021-07-08 00:00:51 +08:00
## Cloud providers
2021-07-02 06:19:16 +08:00
2021-07-08 00:00:51 +08:00
We maintain [one-click apps and install scripts for cloud
2022-02-02 00:45:19 +08:00
providers](https://github.com/coder/deploy-code-server) such as DigitalOcean,
2021-07-08 00:00:51 +08:00
Railway, Heroku, and Azure.
2021-07-23 07:10:09 +08:00
## Uninstall
code-server can be completely uninstalled by removing the application directory, and your user configuration directory.
To delete settings and data:
```shell
rm -rf ~/.local/share/code-server ~/.config/code-server
```
### install.sh
If you installed with the install script, by default code-server will be in `~/.local/lib/code-server-<version>` and you can remove it with `rm -rf` . e.g.
```shell
rm -rf ~/.local/lib/code-server-*
```
### Homebrew
To remove the code-server homebrew package, run:
```shell
brew remove code-server
# Alternatively
brew uninstall code-server
```
2022-08-31 01:00:11 +08:00
### npm
2021-07-23 07:10:09 +08:00
To remove the code-server global module, run:
2022-04-14 01:15:21 +08:00
```shell
2022-08-31 01:00:11 +08:00
npm uninstall --global code-server
2021-07-23 07:10:09 +08:00
```
### Debian, Ubuntu
To uninstall, run:
```shell
sudo apt remove code-server
```