install.md 9.1 KB
Newer Older
1 2
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
A
Anmol Sethi 已提交
3 4
# Install

J
Joe Previte 已提交
5 6 7 8 9 10 11
- [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)
J
Joe Previte 已提交
12
- [Termux](#termux)
13
  - [Known Search Issue](#known-search-issue)
J
Joe Previte 已提交
14 15 16 17 18
- [yarn, npm](#yarn-npm)
- [macOS](#macos)
- [Standalone Releases](#standalone-releases)
- [Docker](#docker)
- [helm](#helm)
B
Ben Potter 已提交
19
- [Cloud Providers](#cloud-providers)
20 21 22

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

A
Anmol Sethi 已提交
23 24 25
This document demonstrates how to install `code-server` on
various distros and operating systems.

26 27 28 29 30 31
## 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.

A
Anmol Sethi 已提交
32 33
## install.sh

34
We have a [script](../install.sh) to install code-server for Linux, macOS and FreeBSD.
A
Anmol Sethi 已提交
35

A
Anmol Sethi 已提交
36
It tries to use the system package manager if possible.
A
Anmol Sethi 已提交
37 38 39 40

First run to print out the install process:

```bash
41
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
A
Anmol Sethi 已提交
42 43 44 45 46 47 48 49
```

Now to actually install:

```bash
curl -fsSL https://code-server.dev/install.sh | sh
```

A
Anmol Sethi 已提交
50 51
The script will print out how to run and start using code-server.

A
Anmol Sethi 已提交
52 53 54 55
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.

A
Anmol Sethi 已提交
56
If you'd still prefer manual installation despite the below [detection reference](#detection-reference) and `--dry-run`
57
then continue on for docs on manual installation. The [`install.sh`](../install.sh) script runs the _exact_ same
A
Anmol Sethi 已提交
58 59 60 61 62
commands presented in the rest of this document.

### Flags

- `--dry-run` to echo the commands for the install process without running them.
A
Anmol Sethi 已提交
63
- `--method` to choose the installation method.
64 65 66
  - `--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.
A
Anmol Sethi 已提交
67 68 69
- `--version=X.X.X` to install version `X.X.X` instead of latest.
- `--help` to see full usage docs.

A
Anmol Sethi 已提交
70
### Detection Reference
A
Anmol Sethi 已提交
71

A
Anmol Sethi 已提交
72 73
- 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.
A
Anmol Sethi 已提交
74
- For Arch Linux it will install the AUR package.
75
- For any unrecognized Linux operating system it will install the latest standalone release into `~/.local`.
76

A
Anmol Sethi 已提交
77
  - Add `~/.local/bin` to your `$PATH` to run code-server.
A
Anmol Sethi 已提交
78 79

- For macOS it will install the Homebrew package.
80

81
  - If Homebrew is not installed it will install the latest standalone release into `~/.local`.
A
Anmol Sethi 已提交
82
  - Add `~/.local/bin` to your `$PATH` to run code-server.
A
Anmol Sethi 已提交
83

84 85
- For FreeBSD, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.

A
Anmol Sethi 已提交
86
- If ran on an architecture with no releases, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
87
  - We only have releases for amd64 and arm64 presently.
A
Anmol Sethi 已提交
88
  - The [npm package](#yarn-npm) builds the native modules on postinstall.
A
Anmol Sethi 已提交
89

A
Anmol Sethi 已提交
90 91
## Debian, Ubuntu

A
Akash Satheesan 已提交
92 93 94
NOTE: The standalone arm64 .deb does not support Ubuntu <16.04.
Please upgrade or [build with yarn](#yarn-npm).

A
Anmol Sethi 已提交
95
```bash
96 97
curl -fOL https://github.com/cdr/code-server/releases/download/v3.9.3/code-server_3.9.3_amd64.deb
sudo dpkg -i code-server_3.9.3_amd64.deb
A
Anmol Sethi 已提交
98
sudo systemctl enable --now code-server@$USER
A
Anmol Sethi 已提交
99 100 101
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

102
## Fedora, CentOS, RHEL, SUSE
A
Anmol Sethi 已提交
103

A
Akash Satheesan 已提交
104 105 106
NOTE: The standalone arm64 .rpm does not support CentOS 7.
Please upgrade or [build with yarn](#yarn-npm).

A
Anmol Sethi 已提交
107
```bash
108 109
curl -fOL https://github.com/cdr/code-server/releases/download/v3.9.3/code-server-3.9.3-amd64.rpm
sudo rpm -i code-server-3.9.3-amd64.rpm
A
Anmol Sethi 已提交
110
sudo systemctl enable --now code-server@$USER
A
Anmol Sethi 已提交
111 112 113 114 115 116 117 118
# 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
A
Anmol Sethi 已提交
119
sudo systemctl enable --now code-server@$USER
A
Anmol Sethi 已提交
120 121 122 123 124 125 126 127
# 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
A
Anmol Sethi 已提交
128
sudo systemctl enable --now code-server@$USER
A
Anmol Sethi 已提交
129 130 131
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

J
Joe Previte 已提交
132 133 134 135 136 137 138 139 140 141 142 143
## Termux

Termux is an Android terminal application and Linux environment, which can also run code-server from your phone.

1. Install Termux from the [Google Play Store](https://play.google.com/store/apps/details?id=com.termux&hl=en_US&gl=US)
2. Make sure it's up-to-date by running `apt update && apt upgrade`
3. Install required packages: `apt install build-essential python git nodejs yarn`
4. Install code-server: `yarn global add code-server`
5. Run code-server: `code-server` and navigate to localhost:8080 in your browser

To upgrade run: `yarn global upgrade code-server --latest`

144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
### Known Search Issue

There is a known issue with search not working on Android because it's missing `bin/rg`. To fix:

1. Install `ripgrep` with `pkg`
   ```sh
   pkg install ripgrep
   ```
2. Make a soft link using `ln -s`

```sh
# run this command inside the code-server directory
ln -s $PREFIX/bin/rg ./lib/vscode/node_modules/vscode-ripgrep/bin/rg
```

For more context, see [comment](https://github.com/cdr/code-server/issues/1730#issuecomment-721515979).

A
Anmol Sethi 已提交
161 162
## yarn, npm

A
Anmol Sethi 已提交
163
We recommend installing with `yarn` or `npm` when:
164

A
Anmol Sethi 已提交
165
1. You aren't on `amd64` or `arm64`.
A
Akash Satheesan 已提交
166 167
2. If you're on Linux with glibc < v2.17 or glibcxx < v3.4.18 on amd64, or glibc < v2.23 or glibcxx < v3.4.21 on arm64.
3. You're running Alpine Linux, or are using a non-glibc libc. See [#1430](https://github.com/cdr/code-server/issues/1430#issuecomment-629883198)
A
Anmol Sethi 已提交
168 169

**note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies.
170
See [./npm.md](./npm.md) for installing these dependencies.
A
Anmol Sethi 已提交
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188

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
```

189
## Standalone Releases
A
Anmol Sethi 已提交
190 191

We publish self contained `.tar.gz` archives for every release on [github](https://github.com/cdr/code-server/releases).
A
Anmol Sethi 已提交
192
They bundle the node binary and `node_modules`.
A
Anmol Sethi 已提交
193

A
Fix CI  
Anmol Sethi 已提交
194
These are created from the [npm package](#yarn-npm) and the rest of the releases are created from these.
A
v3.4.1  
Anmol Sethi 已提交
195
Only requirement is glibc >= 2.17 && glibcxx >= v3.4.18 on Linux and for macOS there is no minimum system requirement.
A
Fix CI  
Anmol Sethi 已提交
196

A
Anmol Sethi 已提交
197 198 199 200
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`.

A
Anmol Sethi 已提交
201 202
You can add the code-server `bin` directory to your `$PATH` to easily execute `code-server`
without the full path every time.
A
Anmol Sethi 已提交
203

204
Here is an example script for installing and using a standalone `code-server` release on Linux:
A
Anmol Sethi 已提交
205 206

```bash
207
mkdir -p ~/.local/lib ~/.local/bin
208
curl -fL https://github.com/cdr/code-server/releases/download/v3.9.3/code-server-3.9.3-linux-amd64.tar.gz \
209
  | tar -C ~/.local/lib -xz
210 211
mv ~/.local/lib/code-server-3.9.3-linux-amd64 ~/.local/lib/code-server-3.9.3
ln -s ~/.local/lib/code-server-3.9.3/bin/code-server ~/.local/bin/code-server
212
PATH="~/.local/bin:$PATH"
A
Anmol Sethi 已提交
213 214 215
code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```
216 217 218

## Docker

A
Anmol Sethi 已提交
219 220 221 222 223
```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.
224 225 226 227 228
#
# 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
A
Anmol Sethi 已提交
229
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
230
  -v "$HOME/.config:/home/coder/.config" \
A
Anmol Sethi 已提交
231 232
  -v "$PWD:/home/coder/project" \
  -u "$(id -u):$(id -g)" \
A
Anmol Sethi 已提交
233
  -e "DOCKER_USER=$USER" \
A
Anmol Sethi 已提交
234 235 236
  codercom/code-server:latest
```

237 238
Our official image supports `amd64` and `arm64`.

A
Anmol Sethi 已提交
239
For `arm32` support there is a popular community maintained alternative:
240 241

https://hub.docker.com/r/linuxserver/code-server
A
Anmol Sethi 已提交
242 243 244 245

## helm

See [the chart](../ci/helm-chart).
B
Ben 已提交
246

B
Ben Potter 已提交
247
## Cloud Providers
B
Ben 已提交
248

B
Ben Potter 已提交
249
We maintain one-click apps and install scripts for different cloud providers such as DigitalOcean, Railway, Heroku, Azure, etc. Check out the repository:
B
Ben 已提交
250

B
Ben Potter 已提交
251
https://github.com/cdr/deploy-code-server