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 04:49:12 +08:00
|
|
|
- [Install](#install)
|
|
|
|
- [Upgrading](#upgrading)
|
|
|
|
- [install.sh](#installsh)
|
|
|
|
- [Flags](#flags)
|
|
|
|
- [Detection Reference](#detection-reference)
|
|
|
|
- [Debian, Ubuntu](#debian-ubuntu)
|
|
|
|
- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse)
|
|
|
|
- [Arch Linux](#arch-linux)
|
|
|
|
- [yarn, npm](#yarn-npm)
|
|
|
|
- [macOS](#macos)
|
|
|
|
- [Standalone Releases](#standalone-releases)
|
|
|
|
- [Docker](#docker)
|
|
|
|
- [helm](#helm)
|
2020-05-22 03:17:02 +08:00
|
|
|
|
|
|
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
|
|
|
2020-05-21 00:13:03 +08:00
|
|
|
This document demonstrates how to install `code-server` on
|
|
|
|
various distros and operating systems.
|
|
|
|
|
2020-11-24 10:07:02 +08:00
|
|
|
## Upgrading
|
|
|
|
|
|
|
|
When upgrading you can just install the new version over the old one. code-server
|
|
|
|
maintains all user data in `~/.local/share/code-server` so that it is preserved in between
|
|
|
|
installations.
|
|
|
|
|
2020-05-22 05:10:29 +08:00
|
|
|
## install.sh
|
|
|
|
|
2020-06-13 22:56:50 +08:00
|
|
|
We have a [script](../install.sh) to install code-server for Linux, macOS and FreeBSD.
|
2020-05-22 11:53:02 +08:00
|
|
|
|
2020-05-22 10:16:16 +08:00
|
|
|
It tries to use the system package manager if possible.
|
2020-05-22 05:10:29 +08:00
|
|
|
|
|
|
|
First run to print out the install process:
|
|
|
|
|
|
|
|
```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
|
|
|
```
|
|
|
|
|
|
|
|
Now to actually install:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -fsSL https://code-server.dev/install.sh | sh
|
|
|
|
```
|
|
|
|
|
2020-05-22 10:16:16 +08:00
|
|
|
The script will print out how to run and start using code-server.
|
|
|
|
|
2020-05-22 11:53:02 +08:00
|
|
|
If you believe an install script used with `curl | sh` is insecure, please give
|
|
|
|
[this wonderful blogpost](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install) by
|
|
|
|
[sandstorm.io](https://sandstorm.io) a read.
|
|
|
|
|
2020-06-05 04:31:01 +08:00
|
|
|
If you'd still prefer manual installation despite the below [detection reference](#detection-reference) and `--dry-run`
|
2020-05-28 03:48:03 +08:00
|
|
|
then continue on for docs on manual installation. The [`install.sh`](../install.sh) script runs the _exact_ same
|
2020-05-22 11:53:02 +08:00
|
|
|
commands presented in the rest of this document.
|
|
|
|
|
|
|
|
### Flags
|
|
|
|
|
|
|
|
- `--dry-run` to echo the commands for the install process without running them.
|
2020-05-23 03:38:03 +08:00
|
|
|
- `--method` to choose the installation method.
|
2020-05-28 04:39:17 +08:00
|
|
|
- `--method=detect` to detect the package manager but fallback to `--method=standalone`.
|
|
|
|
- `--method=standalone` to install a standalone release archive into `~/.local`.
|
|
|
|
- `--prefix=/usr/local` to install a standalone release archive system wide.
|
2020-05-22 11:53:02 +08:00
|
|
|
- `--version=X.X.X` to install version `X.X.X` instead of latest.
|
|
|
|
- `--help` to see full usage docs.
|
|
|
|
|
2020-06-05 04:31:01 +08:00
|
|
|
### Detection Reference
|
2020-05-22 11:53:02 +08:00
|
|
|
|
2020-05-22 10:16:16 +08:00
|
|
|
- For Debian, Ubuntu and Raspbian it will install the latest deb package.
|
|
|
|
- For Fedora, CentOS, RHEL and openSUSE it will install the latest rpm package.
|
2020-05-22 05:10:29 +08:00
|
|
|
- For Arch Linux it will install the AUR package.
|
2020-05-28 04:39:17 +08:00
|
|
|
- For any unrecognized Linux operating system it will install the latest standalone release into `~/.local`.
|
2020-05-22 05:19:22 +08:00
|
|
|
|
2020-05-22 10:16:16 +08:00
|
|
|
- Add `~/.local/bin` to your `$PATH` to run code-server.
|
2020-05-22 05:10:29 +08:00
|
|
|
|
|
|
|
- For macOS it will install the Homebrew package.
|
2020-05-22 05:19:22 +08:00
|
|
|
|
2020-05-28 04:39:17 +08:00
|
|
|
- If Homebrew is not installed it will install the latest standalone release into `~/.local`.
|
2020-05-23 03:38:03 +08:00
|
|
|
- Add `~/.local/bin` to your `$PATH` to run code-server.
|
2020-05-22 05:10:29 +08:00
|
|
|
|
2020-06-13 22:56:50 +08:00
|
|
|
- For FreeBSD, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
|
|
|
|
|
2020-05-28 04:48:11 +08:00
|
|
|
- If ran on an architecture with no releases, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
|
2020-05-28 04:39:17 +08:00
|
|
|
- We only have releases for amd64 and arm64 presently.
|
2020-05-28 04:48:11 +08:00
|
|
|
- The [npm package](#yarn-npm) builds the native modules on postinstall.
|
2020-05-22 05:10:29 +08:00
|
|
|
|
2020-05-21 00:13:03 +08:00
|
|
|
## Debian, Ubuntu
|
|
|
|
|
|
|
|
```bash
|
2021-02-13 04:49:12 +08:00
|
|
|
curl -fOL https://github.com/cdr/code-server/releases/download/v3.9.0/code-server_3.9.0_amd64.deb
|
|
|
|
sudo dpkg -i code-server_3.9.0_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
|
|
|
|
|
|
|
```bash
|
2021-02-13 04:49:12 +08:00
|
|
|
curl -fOL https://github.com/cdr/code-server/releases/download/v3.9.0/code-server-3.9.0-amd64.rpm
|
|
|
|
sudo rpm -i code-server-3.9.0-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
|
|
|
|
# Installs code-server from the AUR using yay.
|
|
|
|
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
|
|
|
|
# Installs code-server from the AUR with plain makepkg.
|
|
|
|
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
|
|
|
|
```
|
|
|
|
|
|
|
|
## yarn, npm
|
|
|
|
|
2020-05-22 11:53:02 +08:00
|
|
|
We recommend installing with `yarn` or `npm` when:
|
2020-05-22 03:17:02 +08:00
|
|
|
|
2020-05-22 11:53:02 +08:00
|
|
|
1. You aren't on `amd64` or `arm64`.
|
2020-06-04 17:54:15 +08:00
|
|
|
2. If you're on Linux with glibc < v2.17 or glibcxx < v3.4.18
|
2021-02-08 22:12:57 +08:00
|
|
|
3. You're running Alpine Linux. See [#1430](https://github.com/cdr/code-server/issues/1430#issuecomment-629883198)
|
2020-05-21 00:13:03 +08:00
|
|
|
|
|
|
|
**note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies.
|
2020-05-28 03:48:03 +08:00
|
|
|
See [./npm.md](./npm.md) for installing these dependencies.
|
2020-05-21 00:13:03 +08:00
|
|
|
|
|
|
|
You will need at least node v12 installed. See [#1633](https://github.com/cdr/code-server/issues/1633).
|
|
|
|
|
|
|
|
```bash
|
|
|
|
yarn global add code-server
|
|
|
|
# Or: npm install -g code-server
|
|
|
|
code-server
|
|
|
|
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
|
|
|
```
|
|
|
|
|
|
|
|
## 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-28 04:39:17 +08:00
|
|
|
## Standalone Releases
|
2020-05-21 00:13:03 +08:00
|
|
|
|
|
|
|
We publish self contained `.tar.gz` archives for every release on [github](https://github.com/cdr/code-server/releases).
|
2020-05-23 03:38:03 +08:00
|
|
|
They bundle the node binary and `node_modules`.
|
2020-05-21 00:13:03 +08:00
|
|
|
|
2020-05-28 05:55:57 +08:00
|
|
|
These are created from the [npm package](#yarn-npm) and the rest of the releases are created from these.
|
2020-06-04 17:54:15 +08:00
|
|
|
Only requirement is glibc >= 2.17 && glibcxx >= v3.4.18 on Linux and for macOS there is no minimum system requirement.
|
2020-05-28 05:55:57 +08:00
|
|
|
|
2020-05-21 00:13:03 +08:00
|
|
|
1. Download the latest release archive for your system from [github](https://github.com/cdr/code-server/releases).
|
|
|
|
2. Unpack the release.
|
|
|
|
3. You can run code-server by executing `./bin/code-server`.
|
|
|
|
|
2020-05-23 03:38:03 +08:00
|
|
|
You can add the code-server `bin` directory to your `$PATH` to easily execute `code-server`
|
|
|
|
without the full path every time.
|
2020-05-21 00:13:03 +08:00
|
|
|
|
2020-05-28 04:39:17 +08:00
|
|
|
Here is an example script for installing and using a standalone `code-server` release on Linux:
|
2020-05-21 00:13:03 +08:00
|
|
|
|
|
|
|
```bash
|
2020-05-22 03:17:02 +08:00
|
|
|
mkdir -p ~/.local/lib ~/.local/bin
|
2021-02-13 04:49:12 +08:00
|
|
|
curl -fL https://github.com/cdr/code-server/releases/download/v3.9.0/code-server-3.9.0-linux-amd64.tar.gz \
|
2020-05-22 03:17:02 +08:00
|
|
|
| tar -C ~/.local/lib -xz
|
2021-02-13 04:49:12 +08:00
|
|
|
mv ~/.local/lib/code-server-3.9.0-linux-amd64 ~/.local/lib/code-server-3.9.0
|
|
|
|
ln -s ~/.local/lib/code-server-3.9.0/bin/code-server ~/.local/bin/code-server
|
2020-05-22 03:17:02 +08:00
|
|
|
PATH="~/.local/bin:$PATH"
|
2020-05-21 00:13:03 +08:00
|
|
|
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 \
|
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
|
|
|
|
```
|
|
|
|
|
2020-05-22 05:19:22 +08:00
|
|
|
Our official image supports `amd64` and `arm64`.
|
|
|
|
|
2020-05-23 03:38:03 +08:00
|
|
|
For `arm32` support there is a popular community maintained alternative:
|
2020-05-22 05:19:22 +08:00
|
|
|
|
|
|
|
https://hub.docker.com/r/linuxserver/code-server
|
2020-11-14 06:32:14 +08:00
|
|
|
|
|
|
|
## helm
|
|
|
|
|
|
|
|
See [the chart](../ci/helm-chart).
|