# How to set up a Visual Studio Code server for remote development over Meshnet

## Introduction <a href="#introduction" id="introduction"></a>

[Visual Studio Code](https://code.visualstudio.com/) (VS Code) is a free and open-source code editor. It is a more lightweight alternative to the [Visual Studio](https://visualstudio.microsoft.com/) integrated development environment (IDE). VS Code provides a heavily customizable and easy-to-use interface for most development needs.

With traveling and work from anywhere (WFA) becoming more popular, the need for a centralized and easily accessible development environment is growing. With the combination of [Meshnet ](https://nordvpn.com/meshnet/)and the open-source project [code-server](https://coder.com/docs/code-server/latest), you can host your own VS Code server and securely work on all of your projects using any device from anywhere in the world.

The code-server tool creates a VS Code instance that can be accessed using an internet browser. Meshnet ensures an encrypted network tunnel between the connecting devices and the server. This network configuration allows you to work on your projects remotely and securely.

This article contains instructions on how you can install code-server on Linux and macOS and access the created VS Code server from remote devices over Meshnet.

## Install code-server

{% tabs %}
{% tab title="Linux" %}
{% hint style="info" %}
**Note**

Ubuntu 24.04.1 LTS distribution is used as an example in this article.
{% endhint %}

To install code-server on Linux:

1. Open **Terminal**.
2. Download and execute the installation script by running this command:\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">curl -fsSL https://code-server.dev/install.sh | sh
   </code></pre>

   &#x20;
3. Once the script finishes, enter this command to ensure that the code-server background process is started each time the system reboots:\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo systemctl enable --now code-server@$USER
   </code></pre>

{% hint style="success" %}
**Tip**

If you want a preview of the installation process before proceeding, you can use this command:

{% code overflow="wrap" %}

```bash
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
```

{% endcode %}
{% endhint %}
{% endtab %}

{% tab title="macOS" %}
For convenient deployment and control, use the [Homebrew](https://brew.sh/) package manager to install code-server on macOS.

### Installing Homebrew <a href="#installing-homebrew" id="installing-homebrew"></a>

1. Open **Terminal**.
2. Enter the following command to install Homebrew:\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
   </code></pre>

   &#x20;\
   For additional information about the installation process, refer to the [Homebrew documentation](https://docs.brew.sh/Installation).
3. Follow the on-screen instructions to finish the Homebrew installation.

### Installing code-server using Homebrew <a href="#installing-code-server-using-homebrew" id="installing-code-server-using-homebrew"></a>

1. Install code-server by running the following command in the terminal:\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">brew install code-server
   </code></pre>

   &#x20;
2. Generate the required configuration files by restarting code-server with this command:\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">brew services start code-server
   </code></pre>

   &#x20;
3. Check the status of the code-server service using the provided command. The output should indicate that the service is started.\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">brew services list
   </code></pre>

   &#x20;&#x20;

   <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F8b07YiGdHotzKe9ZgfAi%2Fcode_mac_status_dark.png?alt=media&#x26;token=4f707865-3c82-4315-8f7a-987131e07c60" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FQFx50ibPfdToqOB8Ahwj%2Fcode_mac_status.png?alt=media&#x26;token=c607026a-5958-4bb2-8027-3e08751c65d5" alt="Status of the &#x27;code-server&#x27; process is started"></picture><figcaption></figcaption></figure>

{% endtab %}
{% endtabs %}

## Allow connections to your VS Code server <a href="#allow-connections-to-your-vs-code-server" id="allow-connections-to-your-vs-code-server"></a>

Some changes to the code-server configuration file are required to allow connections from other devices. By default, the server listens only on `127.0.0.1:8080`. This means that no other devices can reach it.

1. Open **Terminal**.
2. Open the code-server configuration file using the Nano text editor by running this command:\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nano ~/.config/code-server/config.yaml
   </code></pre>

   &#x20;
3. Change the IP and port combination in the first line to `0.0.0.0:8080` as shown:

   <figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F7GfdLDRuDk9Zugl8MpKa%2Fcode_bind_ip.png?alt=media&#x26;token=02c32be1-2588-4a90-9c04-0c672dc4d4b4" alt="Changing bind-addr to 0.0.0.0:8080 in the config.yaml file"><figcaption></figcaption></figure>

   &#x20;
4. Press **Ctrl** + **X**, **Y**, and **Enter** to save changes and exit the file.

{% hint style="info" %}
**Note**

In the same `config.yaml` file, you can find the login password for your VS Code server, which is necessary for every device that connects to the server.

To change the password, edit the string following `password:` in the `config.yaml` file.
{% endhint %}

## Start your VS Code server  <a href="#start-your-vs-code-server" id="start-your-vs-code-server"></a>

After altering the configuration file, you can restart the code-server process.

{% tabs %}
{% tab title="Linux" %}
Run the following command to apply changes and restart the code-server process:

{% code overflow="wrap" %}

```bash
sudo systemctl restart code-server@$USER
```

{% endcode %}
{% endtab %}

{% tab title="macOS" %}
Run the following command to apply changes and restart the code-server process:

{% code overflow="wrap" %}

```bash
brew services restart code-server
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Access your VS Code server over Meshnet <a href="#access-your-vs-code-server-over-meshnet" id="access-your-vs-code-server-over-meshnet"></a>

Your VS Code server is now up and running. Due to the changes in the `config.yaml` file, the server can be reached from the same local area network (LAN) and by your Meshnet peer devices.

To access your server using Meshnet:

1. Copy the Nord name of the VS Code server device from the NordVPN app.
2. Open your internet browser.
3. Paste the copied Nord name followed by `:8080/` to the URL field and press **Enter**.\
   &#x20;\
   **Example**\
   `secret.meerkat-atlas.nord:8080/` \
   &#x20;

   <figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FxaAItwzPTl51omAylMWU%2Fcode_remote_access.png?alt=media&#x26;token=f72bb636-148c-4c78-a793-a75d0005ae48" alt="The code-server login screen after entering the Nord name and port 8080 to the internet browser"><figcaption></figcaption></figure>

   &#x20;
4. Enter the login password and click **Submit**.
5. Select the **Trust the authors of all files in the parent folder** option and click **Yes, I trust the authors**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FtoqLkmcsysCUdTFKr3Rx%2Fcode_trust_author_dark.png?alt=media&#x26;token=d8001b44-849d-4c0b-8aef-35bc19d515c6" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FDmhRo9ggXQn01Kc0bgYX%2Fcode_trust_author.png?alt=media&#x26;token=87522e7a-846f-46fb-a34f-181f46380afc" alt="Confirmation that the authors of the files are trusted" width="375"></picture><figcaption></figcaption></figure></div>

   &#x20;
6. Follow the on-screen guidelines to customize your VS Code interface.

You now have access to a fully functional VS Code instance and can work on your development projects directly from the internet browser. In addition, your Meshnet peer devices can connect to your VS Code server and work on the same project in real time.
