6.4 KiB
Windows Subsystem for Linux Setup
- Setup home folder structure
- Update and install packages
- Install iimacs
- Setup mutt email client
- Setup environment dotfiles
Setup home folder structure
This section sets up my preferred set of initial folders inside my home directory.
cd ~/
mkdir Documents
mkdir Downloads
Update and install packages
To get started we ensure the package manager is up to date.
sudo apt-get update && sudo apt-get upgrade
Next we install a series of standard packages that form part of our workflow or are dependencies for other tools in our environment.
# Install basic utilities
sudo apt-get install -y git locales curl wget xclip tmux net-tools less wget htop screenfetch
# Install pre-requisites for compiling emacs
sudo apt-get install -y make gcc libgnutls28-dev libtinfo-dev
# Install dpkg management tools
sudo apt-get install -y software-properties-common apt-transport-https ca-certificates
# Install terminal customisation packages
sudo apt install -y xterm xtermcontrol
We use pandoc for documentation export from spacemacs.
curl -L -O https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb
sudo dpkg -i /tmp/pandoc-2.7.3-1-amd64.deb
For additional package management we use node. The code below installs node 12.
sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
sudo apt-get install -y nodejs
For managing secrets we use bitwarden which provides a great cli utility.
export account=[BITWARDEN_ACCOUNT]
sudo npm install -g @bitwarden/cli
bw login $account
For working with google cloud platform we use the GCP SDK, which provides our cli tools.
# Add the Cloud SDK distribution URI as a package source:
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
# Import the Google Cloud public key:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
# Update then install the Google Cloud SDK & kubectl:
sudo apt-get update && sudo apt-get install google-cloud-sdk kubectl
For cloud infrastructure deployments we use terraforms.
# Download the binary
wget 'https://releases.hashicorp.com/terraform/0.12.9/terraform_0.12.9_linux_amd64.zip'
# Unzip it
unzip *.zip
# Move the binary to path
sudo mv terraform /usr/bin/
# Clean up
rm *amd64.zip
| Archive: | terraform_0.12.9_linux_amd64.zip |
| inflating: | terraform |
For ad-hoc system administration we use ansible
sudo yum install -y ansible
Install iimacs
A key component in our environment is the ii version of emacs. The section below will setup
emacs version 26.3 and then iimacs on top.
cd ~/Downloads/
wget https://mirror.ossplanet.net/gnu/emacs/emacs-26.3.tar.xz
tar xf emacs-26.3.tar.xz
cd emacs-26.3.tar.xz
./configure --without-x
sudo make -j `nproc`
sudo make install
After compiling and installing emacs we should verify that version 26.3 is
installed.
emacs --version
Once the right version of emacs is running we can then layer in iimacs on top Documentation for this is here: https://github.com/iimacs/.emacs.d
cd ~/ # do as your own user
git clone --recursive https://github.com/iimacs/.emacs.d ~/.iimacs.d
Add the following to your bashrc: export IIMACS=~/.iimacs.d export PATH=${IIMACS}/bin:${PATH} export EMACSLOADPATH=${IIMACS}:
You can now start emacs :)
Setup mutt email client
For reading email we ideally use a cli based client for fast searching and lightweight mail reading.
The mutt mail client fills these roles well for imap mailboxes.
The first step to setup mutt is to ensure it is installed.
sudo apt-get install mutt
After installing mutt we then need to create configuration directories and files.
mkdir -p ~/.mutt/cache/headers
mkdir ~/.mutt/cache/bodies
touch ~/.mutt/certificates
touch ~/.muttrc
One configuration folders and files exist we just need to populate our user mutt configuration file with a configuration for our particular mail provider.
The example below utilises the bitwarden cli utility for secrets to
ensure these are securely gathered at runtime and not stored in the file.
cat > ~/.muttrc << EOF
set ssl_starttls=yes
set ssl_force_tls=yes
set imap_user=`bw get username hosted`
set imap_pass=`bw get password hosted`
set from=`bw get username hosted`
set realname='James Blair'
set folder=imaps://mail.jamesblair.net
set header_cache="~/.mutt/cache/headers"
set message_cachedir="~/.mutt/cache/bodies"
set certificate_file="~/.mutt/certificates"
set smtp_url="smtp://`bw get username hosted`@mail.jamesblair.net:587/"
set smtp_pass=`bw get password hosted`
set move=no
set imap_keepalive=900
set postponed="=Drafts"
set record="=Sent"
set imap_passive=no
set spoolfile=imaps://mail.jamesblair.net/INBOX
EOF
Setup environment dotfiles
Within wsl we can use .dotfiles to further customise our environment. The script below restores my versions of key dotfiles automatically.
git clone ssh://git@gitlab.jamma.life:2224/jmhbnz/tooling.git
cd /tooling/
cp .* ~/