Advertisement
Justman10000

Manage Visual Studio Code Server

Oct 10th, 2023 (edited)
3,082
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.45 KB | None | 0 0
  1. // To install
  2. # The version of the Microsoft Visual Studio Code Server
  3. version=$(curl -sL https://api.github.com/repos/coder/code-server/releases | grep -oP '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)
  4.  
  5. wget https://github.com/coder/code-server/releases/download/v$version/code-server-$version-linux-amd64.tar.gz
  6. gunzip code-server-$version-linux-amd64.tar.gz
  7. tar xvf code-server-$version-linux-amd64.tar
  8. rm -r code-server-$version-linux-amd64.tar
  9. mv code-server-$version-linux-amd64 /usr/local/vscode
  10.  
  11. ln -s /usr/local/vscode/bin/code-server /usr/bin/code
  12.  
  13. # Now start the server! Arguments can be passed for advanced control of the server!
  14. ## Run this for all arguments:
  15. /usr/local/vscode/bin/code-server -h
  16. ## Use PASSWORD as env to set a password outside those in the config
  17. cat << EOF > /etc/systemd/system/vscode.service
  18. [Unit]
  19. Description=VSCode
  20. After=network.target
  21. Wants=network-online.target
  22.  
  23. [Service]
  24. Restart=always
  25. Type=simple
  26. ExecStart=/usr/local/vscode/bin/code-server --bind-addr 0.0.0.0:8932 --locale de --user-data-dir /usr/local/vscode/user --extensions-dir /usr/local/vscode/exts
  27. Environment=
  28.  
  29. [Install]
  30. WantedBy=multi-user.target
  31. EOF
  32.  
  33. systemctl enable vscode.service
  34. systemctl start vscode.service
  35.  
  36. # Now visit http://127.0.0.1:8932. Your password is in ~/.config/code-server/config.yaml
  37.  
  38.  
  39. // To uninstall
  40. systemctl disable vscode.service
  41. systemctl stop vscode.service
  42. rm -r /usr/local/vscode /etc/systemd/system/vscode.service
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement