Last active
July 27, 2025 16:37
-
-
Save 0xAungkon/5349229d08592c2e19b582606595c9c8 to your computer and use it in GitHub Desktop.
Official Vscode Server Run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # ExecStart=/usr/bin/code serve-web --host 0.0.0.0 --without-connection-token --accept-server-license-terms | |
| # Use this for all address to publish the port | |
| if [ "$(id -u)" -ne 0 ]; then | |
| echo "This script must be run as root." >&2 | |
| exit 1 | |
| fi | |
| if ! command -v code >/dev/null 2>&1; then | |
| cd /tmp | |
| wget https://vscode.download.prss.microsoft.com/dbazure/download/stable/c306e94f98122556ca081f527b466015e1bc37b0/code_1.102.2-1753187809_amd64.deb || { echo "sudo user required for this operation."; exit 1; } | |
| sudo apt-get install -y ./code*.deb | |
| else | |
| echo "VS Code is already installed." | |
| fi | |
| sudo bash -c 'cat > /etc/systemd/system/code-server.service <<EOF | |
| [Unit] | |
| Description=VS Code Server | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| User=$(whoami) | |
| ExecStart=/usr/bin/code serve-web --host 0.0.0.0 --without-connection-token --accept-server-license-terms | |
| Restart=on-failure | |
| [Install] | |
| WantedBy=multi-user.target | |
| EOF' | |
| sudo systemctl daemon-reexec | |
| sudo systemctl daemon-reload | |
| sudo systemctl restart code-server | |
| sudo systemctl enable code-server |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -s https://gist.githubusercontent.com/0xAungkon/5349229d08592c2e19b582606595c9c8/raw/69d9afaaa2d385d3825a86adc6608d98857a7117/codeserver.sh | sudo bash