A Remote Development Server, as the name implies, is a server hosted remotely (typically on a Virtual Machine) which it’s sole purpose is to host your code and active repositories. It’s great for storing work in progress projects and allows you to pick up and go from exactly where you left off.
There are both pros and cons for using a Remote Development Server. These include:
plus many more features.
As you can see, the pros definitely outweigh the cons in this scenario.
Note: This is not an exhaustive list or pros and cons, but some of the more important reasons to utilise a Remote Development Server.
In order to follow along with this guide, you’ll need:
To get started, we first need to deploy our Linode Server. To ensure that we have plenty of headroom to run our applications, we will be deploying a Shared 4GB Linode Instance with Ubuntu as our distribution of choice.
Simply select the latest Ubuntu Distribution from the drop down menu, select a region and the select the Linode 4GB Plan.
Next, we need to give our Linode Instance a name and password. Once this has been filled out, we are ready to create our Linode Instance!
Note: I recommend that you pay for automated backups of your Linode Instance in the case that you need to rollback any changes to your server.
It can take anywhere from 5-10 minutes for the server to deploy.
Once your server has deployed successfully, we need to remotely log in to the server using the SSH protocol. To do this, open a Windows Command Prompt and type the following:
You can find your servers IP address on Linode’s Overview page as demonstrated below:
Once we have successfully logged in, we need to ensure that our Ubuntu Server is updated with the latest packages. To ensure our server is up to date, run the following command:
sudo apt update && sudo apt upgrade -y
Once our server is up to date, it is time to create a new user:
It’s strongly recommended to create a new user as running your server from the root user makes the server more vulnerable to security breaches. Creating a new user allows us to lock down the server and improve its security.
You will be asked to create an account password and fill out some additional information. The additional information is not required and you may leave the fields blank if you wish.
Please see my article for tips on securing an Ubuntu Server.
We have successfully configured a new user. However, this new user does not have any superuser privileges. To avoid having to log out and log in every time we need to run a command with higher elevation, we can grant superuser privileges to our new user.
To add these privileges, run the following command as the root user:
usermod -aG sudo example
Now, the new user can run commands with superuser privileges by typing sudo before commands.
Setting up an SSH Key with your server will make your life easier by not having to enter a username and password every single time you connect to the server.
Open a Command Prompt Terminal and type the following command to create a key pair on your local computer.
After executing the command, you should receive the following output:
Generating public/private rsa key pair. Enter file in which to save the key (/your_home/.ssh/id_rsa):
Press enter to save the key pair into the .ssh/ subdirectory. If you are asked to overwrite an existing key pair you may want to press ctrl+c and cancel if you had previously generated an SSH key pair.
You will then be prompted to enter a passphrase. This is an optionally step and requires additional configuration to setup with Visual Studio Code. If you are happy to proceed without a passphrase, simply hit enter. The SSH key pair has now been successfully generated.
Run the following command to copy your key pair to your Linode Instance:
cat ~/.ssh/id_rsa.pub | ssh [email protected] "cat >> ~/.ssh/authorized_keys"
Replace example with your user and the IP for your Linode Instance. You have now successfully copied your SSH key pair to your server!
This step covers the process of adding the SSH Key Configuration File to Visual Studio Code. You’ll need the following pieces of information:
On the left-hand side of the IDE there is a vertical row of five icons. Select the bottom icon as shown below:
Search for the Extension Remote Explorer and install the extension.
Once the extension has been installed, select it on the left hand sidebar and select the Plus Icon as shown below:
Enter your SSH details for the Ubuntu Server.
You may be prompted to choose the hosts operating system. Select Linux.
Then go back to the extension and select the configure icon as shown below:
Select the following result:
Add the following lines to the config file:
PreferredAuthentications publickey IdentityFile %d\.ssh\id_rsa
The config file should now look like the following:
Host my_remote_server HostName your_server_ip User example PreferredAuthentications publickey IdentityFile %d\.ssh\id_rsa
Here’s how this configuration file works:
Make sure your IdentityFile is linked to the id_rsa private key that was locally generated on your machine.
Save the config file and connect to SSH Target by selecting as demonstrated:
You have successfully connected your Visual Studio Code to your Linode Instance.
If you have any questions or think I could have taken a better approach, let me know! Feel free to reach out in the comments below or reach out to me via email.