Nap Joseph Calub

Software Engineer and Open Source Enthusiast

Create a Remote Web Development Environment Using Linode

Published on April 9, 2021

Linode

In this guide, we will create our own remote web development environment using Linode.

##Pre-requisities

##Generate SSH Key for your local machine

Follow GitHub's guide to generate your SSH key pair. For Windows users, you may need to check this guide from Microsoft to enable SSH in your machine.

Afterwards, add the key to your GitHub and Linode account.

##Generate SSH Key for your new Linode instance

Create a new SSH Key for your new Linode instance. Save this for now as we'll use this later.

##Generate GPG Key

Follow this guide to generate a GPG key using Keybase.

Again, you need to add this key to your GitHub account.

##Creating your server instance using Linode's StackScripts

  • Open the StackScripts page and click Create StackScript.
  • Copy the contents of web.sh. This will only work on Debian 10.
  • Click Deploy New Linode.
  • Fill out the fields and then click Create Linode.
  • Wait for your instance to be provisioned.
  • If all goes well, the status will change to Running and you can then connect to your instance.

This should install the following on your instance:

##Connecting via SSH

Start the ssh-agent in the background:

for linux/osx:

$ eval `ssh-agent -s`
> Agent pid 59566

for windows:

Start-Service ssh-agent

Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file.

ssh-add ~/.ssh/id_ed25519

Then connect via SSH:

ssh <NON_ROOT_USERNAME>@<LINODE_IPV4_ADDRESS> -p <SSH_PORT>

Alternatively, you can create a config file to make it easier to connect to your remote host.

~/.ssh/config

1Host <ALIAS>
2 User <NON_ROOT_USERNAME>
3 HostName <LINODE_IPV4_ADDRESS>
4 Port <SSH_PORT>
5 IdentityFile <PRIVATE_KEY_FILE_LOCATION>
ssh <ALIAS>

Congratulations! You can now connect to your remote server instance.

##Additional setup

The essentials are already installed in your instance. However, we need to configure a few applications we will use.

###Configuring your zsh theme

If you enabled UPGRADE_SHELL_EXPERIENCE, zsh, oh-my-zsh, and the powerlevel10k zsh theme will be installed.

On your first login via SSH, it will ask you to configure your theme. To run the wizard again, you can run:

p10k configure

###Fixing your SSH Private Key

Due to StackScripts not yet having a multiple-line UDF, the line breaks for our private key was removed.

Update the .ssh/$HOSTNAME with the correct version.

###Configure Keybase

# login
keybase login
# check if you have more than one key saved
keybase pgp export
# if yes, specify the id in the commands below
# keybase pgp export -q 31DBBB1F6949DA68 | gpg --import
# import public key
keybase pgp export | gpg --import
# import private key
keybase pgp export --secret | gpg --allow-secret-key-import --import
# check imported key
gpg --list-secret-keys --keyid-format LONG
# /Users/pstadler/.gnupg/secring.gpg
# ----------------------------------
# pub 2048R/DEADBEEF 2012-08-16
# uid Name (Comment) <[email protected]>
# sub 2048R/86D2FAC6 2012-08-16

Notice the hash DEADBEEF. We will use this in the next section.

###Configure Git

# add your basic information
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
# sign all commits using your GPG key
git config --global user.signingkey DEADBEEF
git config --global commit.gpgsign true

##Repository

You can check the napjoseph/remote repository for the updated code.

© 2021 Nap Joseph Calub. All rights reserved.

Light Mode
Dark Mode