In this guide, we will create our own remote web development environment using Linode.
##Pre-requisities
- A terminal with Bash or something similar. For Windows, you can use Windows Terminal or Git Bash. You can check my current settings for Windows Terminal.
- Your local SSH key pair. See GitHub's guide for more details.
- A GitHub account.
- A Keybase account for storing your GPG keys.
- A Linode account. You can go to their docs to get a $100 promo code (or you can directly use my referral code).
- Visual Studio Code.
##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.
NOTE: For Windows, if you already installed the Keybase app, you should have the CLI app will be ready to use (no need to install via brew).
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:
- zsh, oh-my-zsh, powerlevel10k, zsh-autosuggestions, and zsh-syntax-highlighting
- Keybase
- Go
- Node Version Manager
- pyenv
- Docker
- byobu
- spacevim
- bat
- direnv
- stow
- Homebrew
##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.
NOTE: You can already connect via SSH even if the StackScript has not yet been completed. To check its status, you can check the logs using cat /var/log/stackscript.log
.
##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
IMPORTANT: You also need to install the recommended fonts for the theme to display properly.
IMPORTANT: If you are using Windows, you can use Windows Terminal. You can check my current settings for Windows Terminal.
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
# loginkeybase login# check if you have more than one key savedkeybase pgp export# if yes, specify the id in the commands below# keybase pgp export -q 31DBBB1F6949DA68 | gpg --import# import public keykeybase pgp export | gpg --import# import private keykeybase pgp export --secret | gpg --allow-secret-key-import --import# check imported keygpg --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 informationgit config --global user.name "Your Name"# sign all commits using your GPG keygit config --global user.signingkey DEADBEEFgit config --global commit.gpgsign true
##Repository
You can check the napjoseph/remote
repository for the updated code.