Code-server is a Visual Studio Code instance running on a remote server accessible through any web browser. It allows you to code anywhere and on any device such as a tablet or laptop with a consistent integrated development environment (IDE). Set up a secure Linux development machine and get coding on any device with a web browser.
Take advantage of a cloud server by offloading the system demanding tasks such as tests, compilations, and downloads to another machine. Preserve battery life when you’re on the go or spend your downtime doing something else while the computationally intensive processes are running on your cloud server.
- Code-server has the following requirements:
- 64-bit host.
- At least 1GB of RAM.
- 2 cores or more are recommended (1 core works but not optimally).
- Secure connection over HTTPS or localhost (required for service workers and clipboard support).
- For Linux: GLIBC 2.17 or later and GLIBCXX 3.4.15 or later.
In this tutorial, we’ll set up a code server on a simple cloud server running Ubuntu 18.04.
Sign up on UpCloud
The first things first, you’ll need to sign up for an UpCloud account. So if you are not yet registered, create an account with UpCloud and you can get started on a free trial and continue with as little as 5 USD/month.
Once registered, log into your UpCloud Control Panel and get cracking!
Deploy a new cloud server
The next thing you’ll need to do is deploy a new cloud server.
To get started, click the Deploy a server button under the Servers section at your UpCloud Control Panel.
You’ll need to do at least the following:
- Choose the server location from the available data centres
- Pick a configuration, the $5 per month plan is a good starting point
- Select Ubuntu 18.04 for the operating system
- Add any SSH keys you might want to use, this is optional
- Give your server a hostname and description
- Once you are happy with your selections click the Deploy button
I am going to choose below configuration and location. You can choose differently depending upon your location and requirement.



You can find more detailed instructions on server deployment in our newcomer’s tutorials.
Once the server has been deployed, you will receive the server login details on your registered email. Additionally, your temporary password will also show up in the control panel notifications. You can then find your server’s IP address on the list.

In my case, my server details are as follows:
Server IP: 209.50.53.173 Username: root Password: ########
You should also configure a domain name for your code-server by pointing an A record to the IP address of the new cloud server. This can generally be done at your domain registrars service. Read more about domain name systems and how to configure DNS records. A valid domain name is required for obtaining SSL certificates to enable HTTPS.
Connect to the cloud server using SSH
Next, you’ll need to log into your cloud server over SSH connection to access the terminal. Open your favourite SSH client software. In my case, I am going to use PuTTY.

Once you click the Open button to connect, you will be prompted to enter your login credentials
Username: root Password: <your-server-password>
Or if using an SSH client on the command line.
ssh root@<server-ip>
Then update the server software by running the following commands.
sudo apt update sudo apt upgrade -y
Then check that the code-server prerequisites are already installed.
sudo apt install libc6 libstdc++6
Once that’s done, you are good to continue.
Installing code-server
Next, we’ll install the code server itself.
Download the release package from the code-server GitHub repository with the following command.
cd ~/ wget https://github.com/cdr/code-server/releases/download/3.2.0/code-server-3.2.0-linux-x86_64.tar.gz
Then extract the software and copy it to a suitable location.
tar xvf code-server-3.2.0-linux-x86_64.tar.gz sudo mkdir /usr/lib/code-server sudo cp -r /root/code-server-3.2.0-linux-x86_64/* /usr/lib/code-server/ sudo ln -s /usr/lib/code-server/code-server /usr/bin/code-server
You will also need to create a directory to save any user files code-server might generate while in use.
sudo mkdir /var/lib/code-server
Now, code-server could already be run with a simple command-line call for code-server. However, a more maintainable way is to create a system service that manages our code-server.
Create the following service file.
sudo nano /lib/systemd/system/code-server.service
Then include the following content. Replace the code-server-password with your own.
[Unit]
Description=code-server
After=nginx.service
[Service]
Type=simple
Environment=PASSWORD=code-server-password
ExecStart=/usr/bin/code-server --bind-addr 127.0.0.1:8080 --user-data-dir /var/lib/code-server --auth password
Restart=always
[Install]
WantedBy=multi-user.target
Once done, save the file and exit the editor.
Afterwards, let’s start the code-server service.
First, reload the system daemon to include the new service file which we created above.
systemctl daemon-reload
Then start and enable the code-server.service.
systemctl start code-server systemctl enable code-server
You should now see the service running when checking for code-server status.
systemctl status code-server
* code-server.service - code-server Loaded: loaded (/lib/systemd/system/code-server.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-04-29 10:58:59 UTC; 7s ago Main PID: 20987 (code-server) Tasks: 23 (limit: 1147) CGroup: /system.slice/code-server.service |-20987 /usr/bin/code-server --host 127.0.0.1 --user-data-dir /var/lib/code-server --auth password `-20998 /usr/bin/code-server --host 127.0.0.1 --user-data-dir /var/lib/code-server --auth password Apr 29 20:58:59 ubuntu-1cpu-1gb-uk-lon1 systemd[1]: Started code-server. Apr 29 20:58:59 ubuntu-1cpu-1gb-uk-lon1 code-server[20987]: info Server listening on http://127.0.0.1:8080 Apr 29 20:58:59 ubuntu-1cpu-1gb-uk-lon1 code-server[20987]: info - Using custom password for authentication Apr 29 20:58:59 ubuntu-1cpu-1gb-uk-lon1 code-server[20987]: info - Not serving HTTPS
The code-server is now running on the background but cannot be reached just yet. For that, we’ll need to set up a secure connection using an Nginx reverse proxy.
Continue below with the instructions to do just that.
Configuring secure proxy with Nginx and Let’s Encrypt
Since we are installing code-server in the cloud, we need to secure the remote connection using HTTPS. The easiest way to do this is to obtain SSL certificates from a trusted Certificate Authority such as Let’s Encrypt.
First, we’ll install Nginx to act as a simple reverse proxy.
Run the following command to get the webserver installed.
sudo apt install nginx
Next, create a configuration file for the proxy functionality.
sudo nano /etc/nginx/sites-available/code-server.conf
Then enter the following to enable just HTTP as a place holder. Replace the code-server.example.com with your domain in the server name.
server {
listen 80;
listen [::]:80;
server_name code-server.example.com;
location / {
proxy_pass http://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
}
Once you’re done, save the file and exit the editor.
Next, delete the default site by removing the symbolic link and creating a new one for your site configuration file.
sudo rm /etc/nginx/sites-enabled/default sudo ln -s /etc/nginx/sites-available/code-server.conf /etc/nginx/sites-enabled/code-server.conf
Then start and enable nginx.
sudo systemctl start nginx sudo systemctl enable nginx
You should now be able to see the Nginx service active and running.
sudo systemctl status nginx
* nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-04-29 11:09:04 UTC; 46s ago Docs: man:nginx(8) Main PID: 21609 (nginx) Tasks: 2 (limit: 1147) CGroup: /system.slice/nginx.service |-21609 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; `-21610 nginx: worker process Apr 29 21:09:03 ubuntu-1cpu-1gb-uk-lon1 systemd[1]: Starting A high performance web server and a reverse proxy server... Apr 29 21:09:04 ubuntu-1cpu-1gb-uk-lon1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid Apr 29 21:09:04 ubuntu-1cpu-1gb-uk-lon1 systemd[1]: Started A high performance web server and a reverse proxy server.
With the webserver set up, we’ll install the Let’s Encrypt’s Certbot client following the instructions below.
You’ll need to first install the common software properties and add the Certbot repository.
sudo apt install software-properties-common sudo add-apt-repository universe sudo add-apt-repository ppa:certbot/certbot sudo apt update
Afterwards, you can install the Certbot client, now available through the package manager.
sudo apt install certbot python-certbot-nginx
With the client installed, you can obtain and install certificates using the --nginx plugin.
Note that for Certbot to work, you need to have configured an A record on your domain which points to your cloud server’s public IPv4 address and the record needs to have propagated through the network to make your domain discoverable. The propagation might take a little while depending on your domain name service.
Use the Certbot client as shown in the example below. Include your domain name by replacing the code-server.example.com with yours.
sudo certbot --nginx -d code-server.example.com
The command starts an interactive configuration script that asks a couple of questions to help with managing certificates.
- On the first installation on any specific host, you’ll need to enter a contact email.
- Then go through the Let’s Encrypt Terms of Service and select Agree if you accept the terms and wish to use the service.
- Choose whether you wish to share your email address with the Electronic Frontier Foundation (EFF) for updates on their work.
- Lastly, select to enable redirect from HTTP to HTTPS.
If the client was successful at obtaining a certificate you can find a confirmation and certificate expiration date at the end of the client output.
The certificates issued by Let’s Encrypt are saved under the directory indicated in the Certbot output, usually under /etc/letsencrypt/live/. Certbot should have reconfigured your Nginx config to enable HTTPS and the redirection from non-secured connections.
Your code-server.conf should now look something like the example below.
sudo nano /etc/nginx/sites-available/code-server.conf
server { server_name code-server.example.com; location / { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; proxy_set_header Accept-Encoding gzip; } listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/code-server.example.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/code-server.example.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = code-server.example.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name code-server.example.com; return 404; # managed by Certbot }
Restart Nginx and your code-server should be all set.
sudo systemctl restart nginx
That’s all you need to secure your connection to the code-server.
Running the code-server
Now finally we are ready to take code-server for a spin.
If everything is in order, you should be able to open your domain name on a web browser and get to the code-server login page.

As you can see on above screenshot code-server is up and running. You’ll be able to log in using the password set in the code-server.service file we created earlier.
Once logged in, you’ll enter the IDE and have full access to your developer environment saved on your own cloud server.

You did it! Now you can start coding directly in your cloud IDE!
Ilja
Nice tutorial! But unfortunately it is already outdated if you want to use the newest vscode version(which has tons of improvements)… I would suggest running code-server with docker-compose since code-server even provides docker image for it. I have set it up with jwilder/nginx-proxy image as nginx and jrcs/letsencrypt-nginx-proxy-companion image as letsencrypt. They are very well documented so if you are familiar with docker it won’t take a moment to set it up and the out come will be more robust and modular.
Janne Ruostemaa
Hi Ilja, thanks for the comment. You are right in that there had been notable updates to code-server since this guide was written, we’ve had that remedied. Running code-server with docker-compose is certainly a valid option and having a tutorial on such a setup would also be useful. If you are interested, we’d be happy to publish a community contribution on the subject and reward you for your efforts.
Pat
Fantastic tutorial. So happy to have found this after nights trying to find a cohesive walkthrough, especially for an amateur as myself. I was able to connect my home server to a Google Domain. Only issue, however, is that I’m having certificate failures when attempting to load via HTTPS. I’m sure I’ll figure that part out.
Thank you so much!
Janne Ruostemaa
Hi Pat, thanks for the comment. Glad to hear you found the tutorial useful. Enabling HTTPS should also work well but requires a bit of work to set up the reverse proxy first.