Home / How To / How to install Visual Studio Code Server on Debian 10

How to install Visual Studio Code Server on Debian 10

Code Server is a Visual Studio (VS) code version that can be run remotely on the server and accessed through a web browser. It enables the creation and operation of a consistent development environment that can be accessed at any time and anywhere.

In this tutorial, we will show you how to install the code server on Debian Buster 1

0. We install and configure the code server with Nginx as a reverse proxy, secure it with SSL Letsencrypt, and enable base code server authentication.


For this guide, we will install the code server on the latest Debian 10 with 2 GB of memory, 25 GB of free disk space, and 2 processors.

What we will do:

  • Create a new user
  • Download Code-Server
  • Setup Code-Server as Systemd Service
  • Generate SSL Letsencrypt
  • Setup Nginx as a Reverse Proxy for Code-Server
  • Testing

Step 1 – Create a new Linux user

First we create a new user on the Debian system. The code server runs under that user.

Create a new user named "code" with the command below.

  useradd-m -s / bin / bash code 
passwd code

Now enter the password for the user's "code" and the new user for running code server has been created.

Step 2 – Download Visual Studio Code-Server from GitHub

In this step, we will download the code server source code from GitHub.

Log in to the user code and download the source server code using the wget command below.

  su - code 
wget https://github.com/cdr/code-server/releases/download/3.0.0/code-server-3.0. 0-linux-x86_64.tar.gzebrit19659016achte Chapter19459062 ?? Add user and download Visual Studio Code "width =" 750 "height =" 139 "style =" display: block; margin-left: auto; margin-right: auto; "ezimgfmt =" rs rscb1 src ng ngcb1 "class =" ezlazyload "data-ezsrc =" https://www.howtoforge.com/images/how_to_install_visual_code_server_on_debian_10/1.png "/>

Extrahera source code and rename directory to & # 39; bin / & # 39;

  tar -xf code-server-3.0.0-linux-x86_64.tar.gz 
etc. code-server- * / bin /

Now make the binary file & # 39; code server & # 39; as an executable and create a new "data directory" for storing code server configurations.

  chmod + x bin / code server 
mkdir -p ~ / data [19659016] As a result, the source server of the code server has been downloaded, and we are ready for the next step.

 Unpack the archive

Step 3 - Setting up the code server as a SysteSUBMITmd service

After downloading source code code server we will set the code server as a systemd service.

Now back to the root user or if you have root-sudo privileges, run the sudo command below. [19659015] sudo su

Now go to & # 39; / etc / systemd / system & # 39; directory and create a new service file & # 39; code-server.service & # 39; with vim editor.

  cd / etc / systemd / system / 
vim code-server.service

Change & # 39; chunk code server & # 39; on & # 39; Environment = PASSWORD = ... "with your own password and paste the configuration.

Description = code server
After = nginx.service [Service]
User = code
Wor kingDirectory = / home / code
Environment = PASSWORD = hakasecodeserv
ExecStart = / home / code / bin / code-server - host - user-data-dir / home / code / data - author password
Start about = always

WantedBy = multi-user.target

Save and close.

Then load about the systemd manager using the systemctl command below.

  systemctl daemon-reload 

Start the code server service and add it to the system boot.

  systemctl start code-server 
systemctl enable code-server

 Create system service

The code server is running, check it with the following cow mmando.

  netstat -plntu 
systemctl status code-server

As a result, the code server is running as a system service on Debian Buster 10. Ads

[19659019]   Check service status

Step 4 - Generate SSL Letsencrypt

In this step, we will generate SSL song encryption with the certbot tool to secure the code server.

Install the certbot tool using the apt command below.

  sudo apt install certbot -y 

When the installation is complete, generate SSL lookup encryption with the certbot command below.

  certbot certonly - standalone --agree-tos -m [email protected] -d code.hakase-labs.io 

When done, your certificates will be in the & # 39; / etc / letsencrypt / live directory /code.hakase-labs.io/&#39 ;.

  ls -lah / etc /letsencrypt/live/code.hakase-labs.io/strong19659016??Now you have generated SSL Letsencrypt to secure the code server installation with the certbot utility. 

Step 5 - Setup Nginx as a Reverse Proxy [19659013] In this step we will install Nginx web server in the Debian system. It will be used as a reverse proxy for the code server running on the default port & # 39; 8080 & # 39 ;.

Install Nginx packages with the apt command below.

  sudo apt install nginx-y 

When installation is complete, go to directory & # 39; / etc / nginx / sites-available & # 39; and create a new virtual host configuration & # 39; code server & # 39; with the vim editor.

  cd / etc / nginx / sites-available / 
vim code -server

Change the domain name and SSL path with your own, then paste the configuration into it. Advertising Services

  server {
list 80;
server_name code.hakase-labs.io;
# maintain https
return 301 https: // $ server name: 443 $ request_uri;

server {
listen 443 ssl http2;
servername code.hakase-labs.io;

ssl_certificate /etc/letsencrypt/live/code.hakase-labs.io/fullchain.pem; ebrit19459023] ssl_certificate_key / etc / letsencrypt / live / co de.hakase-labs.io/privkey.pem;ebrit19659068] location / {
proxy_pass;ebrit19459023] proxy_set_header Host $ host;
proxy_set_header Upgrade $ http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;

Save and close.

Now enable the "virtual host" code server and check Nginx configure and make sure there is no error.

  ln-s / etc / nginx / sites-available / code-server / etc / nginx / sites-enabled / 
nginx -t

Restart Nginx now service.

  systemctl restart nginx 

As a result, the Nginx configuration as a reverse code server proxy has been completed, and the code server is now accessible through your web browser.

 Nginx configuration

Step 6 - Test code server

Open your web browser and type th e-code server URL installation. My is (replace the domain with your domain):


Now you will be redirected to secure HTTPS- connection and you will be prompted for the code server password.

 Login to the code server GUI

Enter your password and click & # 39; SUBMIT ".

Now you get Visual Code Studio Editor in your browser.

 Code - OSS

As a result, you have successfully installed the code server on Debian Buster 10 with Nginx reverse proxy and SSL Letsencrypt.

Source link