Installing code server with script
First, download the install script from code-server.dev
and do a dry run install
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
If this comes back with the following, you are good to install.
Ubuntu 20.04.2 LTS
Installing v3.10.0 deb package from GitHub releases.
+ mkdir -p ~/.cache/code-server
+ curl -#fL -o ~/.cache/code-server/code-server_3.10.0_amd64.deb.incomplete -C - https://github.com/cdr/code-server/releases/download/v3.10.0/code-server_3.10.0_amd64.deb
+ mv ~/.cache/code-server/code-server_3.10.0_amd64.deb.incomplete ~/.cache/code-server/code-server_3.10.0_amd64.deb
+ sudo dpkg -i ~/.cache/code-server/code-server_3.10.0_amd64.deb
To have systemd start code-server now and restart on boot:
sudo systemctl enable --now code-server@$USER
Or, if you don't want/need a background service you can run:
code-server
To install, run again omitting the options -s -- --dry-run
so
curl -fsSL https://code-server.dev/install.sh | sh
Once completed, run this to run code-server on startup, replacing USER
with your ubuntu username
sudo systemctl enable --now code-server@barry
Change port from 8080. If you don’t want to change your port or bind address, skip to first run
The default port is port 8080, and listens on 127.0.0.1. I wanted to change the port and the bind address as 8080 already in use. If you want to do this open the service file.
sudo nano /usr/lib/systemd/system/[email protected]
Change the ExecStart
line, amending what port
you want. I’m runing on 8914. I’ve added bind-addr
to 0.0.0.0 to listen on all interfaces.
ExecStart=/usr/bin/code-server --port 8914 --bind-addr 0.0.0.0
Reload the systemctl daemon.
sudo systemctl daemon-reload
First run
Browse to the site specified earlier.
http://ipofserver:8914/
or
http://ipofserver:8080/
On first load, it will ask for your password, located at ~/.config/code-server/config.yaml
cat ~/.config/code-server/config.yaml
The result will contain
auth: password
password: longrandompassword
Copy the long password and paste it into the box.
You will now have the welcome screen.