DEV Community

Justin Poehnelt
Justin Poehnelt

Posted on • Originally published at justin.poehnelt.com on

My Debian development environment setup

I recently need to set up a development environment on Debian for a project. As someone who works in DevRel, I’m often trying to replicate tools and environments that developers use. Additionally, I’m not allowed to use Docker on my work machine!

Lucky for me, I have a home lab server running Proxmox and I can spin up a VM for this purpose. I decided to use Debian 11 (Bullseye) for this project. Here’s how I set up my development environment after installing Debian.

Set up SSH keys

I want to use SSH keys and VSCode’s Remote - SSH extension to connect to the VM.

ssh-copy-id jpoehnelt@192.168.0.121 # replace
Enter fullscreen mode Exit fullscreen mode

I then added an entry to my ~/.ssh/config file to make it easier to connect to the VM.

Host dev
  HostName 192.168.0.121
  User jpoehnelt
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519
Enter fullscreen mode Exit fullscreen mode

I then tested in the terminal and VSCode to make sure I could connect to the VM.

ssh dev
Enter fullscreen mode Exit fullscreen mode

Now I can connect to the VM with a single command! You may want to consider turning off password based ssh.

Install the basics

I installed the basics that I need for development. This includes git, curl, wget, and build-essential.

sudo apt update
sudo apt upgrade -y
sudo apt install -y make curl build-essential openssl libssl-dev unzip
Enter fullscreen mode Exit fullscreen mode

And configured git with my name and email.

git config --global user.name "Justin Poehnelt"
git config --global user.email "justin@example.com"
git config --list # to show the config
Enter fullscreen mode Exit fullscreen mode

I also used the GitHub CLI to authenticate with GitHub, see instructions at cli.github.com.

gh auth login
Enter fullscreen mode Exit fullscreen mode

Now I’m ready to start writing code!

Install Docker

I’m not allowed to use Docker on my work machine, but I can use it on my homelab server. I installed Docker using the official instructions for Debian from the Docker website.

For convenience, I added my user to the docker group so I don’t have to use sudo for every command. This has security implications, so be sure to understand them before doing this.

sudo usermod -aG docker $USER
Enter fullscreen mode Exit fullscreen mode

If you’re running Linux in a virtual machine, it may be necessary to restart the virtual machine for changes to take effect.

I then tested Docker to make sure it was working.

docker run hello-world
Enter fullscreen mode Exit fullscreen mode

Install Node.js

I install Node.js using NVM so I can easily switch between versions.

Always verify anything you pipe into your shell. This is the command from the NVM website.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

I then installed the latest LTS version of Node.js.

nvm install --lts
nvm use --lts
Enter fullscreen mode Exit fullscreen mode

I prefer using pnpm as my package manager, so I installed that as well.

npm install -g pnpm
Enter fullscreen mode Exit fullscreen mode

I typically don’t alias pnpm to npm because I often need to work with npm for some set of open source projects.

Install VSCode

I don’t install on the VM, but I use the remote tooling on my local machine. This allows me to connect to the VM and use VSCode as if it were running locally. Latency isn’t an issue as it is on my local network.

Conclusion

This is a basic setup for a development environment on Debian. Saving this for myself more than anyone else! I hope it helps you too.

Top comments (0)