sudo apt-get install -y build-essential pkg-config python3
curl -fsSL https://fnm.vercel.app/install | bash
fnm install 14
fnm default 14
npm install --global yarn
yarn global add code-server
Follow this tutorial: https://www.digitalocean.com/community/tutorials/how-to-install-and-manage-supervisor-on-ubuntu-and-debian-vps
[program:vscode-server]
command=su - ubuntu -c "/home/ubuntu/.fnm/fnm exec --using 14 node /home/ubuntu/.yarn/bin/code-server"
directory=/home/ubuntu
autostart=true
autorestart=true
stopasgroup=true
startsecs=3
user=root
numprocs=1
Replace ubuntu
with the username that you installed code-server with.
If you have problems after a server reboot try this method instead: Replace the command options in the supervysor config with:
command=/home/ubuntu/.code-start
user=ubuntu
Put this script in your home directory:
/home/ubuntu/.code-start
#!/usr/bin/bash
export HOME=/home/ubuntu/
export PATH=/home/ubuntu/.fnm:$PATH
eval "`fnm env`"
fnm exec --using 14 node /home/ubuntu/.yarn/bin/code-server