entering a password all the time sucks. This is maybe naughty but I like it :shrug
# open sudoers file in editor (nano)
sudo nano /etc/sudoers
in the edit append the following line
<your_user_name> ALL=(ALL) NOPASSWD:ALL
save and exit. Running the following commands should no longer prompt you for a password now.
# Install curl
sudo apt install curl
# Configure source list
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# Install dependencies
sudo apt -y update
sudo apt -y install autoconf bison git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev libgdbm-dev libncurses-dev
sudo apt install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
see https://github.com/ohmyzsh/ohmyzsh for more
download asdf
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.9.0
add asdf to the ohmyzsh plugins definition in zshrc (sudo nano ~/.zshrc
)
plugins=(asdf)
and append the following to bottom of zshrc
# append completions to fpath
fpath=(${ASDF_DIR}/completions $fpath)
# initialise completions with ZSH's compinit
autoload -Uz compinit && compinit
see https://asdf-vm.com/guide/getting-started.html for more
# Add asdf plugins
asdf plugin add ruby
asdf plugin add nodejs
asdf plugin add yarn
# install a version of ruby (replace latest with desired versions)
asdf install ruby latest
asdf install nodejs latest
asdf install yarn latest
# add to global
asdf global ruby latest
asdf global nodejs latest
asdf global yarn latest
# confirm installation
ruby -v
node -v
yarn -v
see https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin for more
Docker Desktop should be installed on Windows, with WSL2 Backend enabled. See https://docs.docker.com/desktop/windows/install/
Docker will be piped to your default wsl distribution, but you can select additional distributions also, see screenshot.
Once this is done (you may need to restart terminal and/or windows itself), enter docker ps
in wsl to see a (currently blank) list of docker images.
To fix an issue where docker desktop needs further config to support Elasticsearch containers, add this to your .zshrc file (or .bashrc)
wsl.exe -d docker-desktop sh -c "sysctl -w vm.max_map_count=262144"
# install postgres
sudo apt install postgresql
# set password for postgres user
sudo passwd postgres
# start the postgres service (you'll need to do this on each restart, or configure systemd or an init.d script)
sudo service postgresql start
I like to use the same SSH key for my different WSL distributions (they aren't different machines).
So, If you already have an ssh key configured on an existing distribution:
copy the existing ssh key files into your new distribution. There's probably an easier way to copy between distros, but I literally create the files with
touch ~/.ssh/id_xyz
touch ~/.ssh/id_xyz.pub
and then copy-paste the respective contents from your existing distro with good old clipboard.
If you don't already have an ssh key configured:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
# press enter to select default path
# press enter again to confirm a blank passphrase
If you don't know if you have ssh configured
ls -l ~/.ssh/id_*.pub
configure and test w github
If you generated a new key, add the public key to github (https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)
Test out your ssh auth:
ssh -T [email protected]