Overhauled tooling to reflect shift to pop os.
This commit is contained in:
11
readme.org
11
readme.org
@ -1,26 +1,28 @@
|
|||||||
#+TITLE: Tooling setup
|
#+TITLE: Tooling setup
|
||||||
#+AUTHOR: James Blair
|
#+AUTHOR: James Blair
|
||||||
#+EMAIL: mail@jamesblair.net
|
#+EMAIL: mail@jamesblair.net
|
||||||
#+DATE: <2021-09-27 Mon 06:16>
|
#+DATE: <2022-11-15 Tue 09:15>
|
||||||
|
|
||||||
|
|
||||||
This document captures my standard tooling for future replication and aims to make it as easy as possible to setup and use.
|
This document captures my standard tooling for future replication and aims to make it as easy as possible to setup and use.
|
||||||
|
|
||||||
The environment is based on [[https://linuxmint.com/][Linux Mint]] ~20.3~ primarily, although guides for Windows 11 with [[https://docs.microsoft.com/en-us/windows/wsl/about][Window Subsystem for Linux]] are included from a legacy perspective.
|
The environment is based on [[https://pop.system76.com/][Pop!_OS]] ~22.04~ primarily, although guides for Windows 11 with [[https://docs.microsoft.com/en-us/windows/wsl/about][Window Subsystem for Linux]] are available in git history for legacy purposes.
|
||||||
|
|
||||||
|
|
||||||
* How I get things done
|
* How I get things done
|
||||||
|
|
||||||
Before diving into the technical details, below is a brief summary of how I get things done.
|
Before diving into the technical details, below is a brief summary of how I get things done.
|
||||||
|
|
||||||
|
|
||||||
** Code editing
|
** Code editing
|
||||||
|
|
||||||
For an editor I primarily rely on [[https://www.gnu.org/software/emacs/][emacs]], specifically [[https://github.com/humacs/humacs][humacs]]. To pair and share my terminals with others I rely on [[https://tmate.io/][tmate]].
|
For an editor I primarily rely on [[https://www.gnu.org/software/emacs/][emacs]], specifically [[https://github.com/humacs/humacs][humacs]]. To pair and share my terminals with others I rely on [[https://tmate.io/][tmate]]. My current primary device is a 2021 Razer Blade 14".
|
||||||
|
|
||||||
The main feature that I rely on in emacs is [[https://orgmode.org/][org-mode]]. This allows me to do literate programming, writing my documenation with embedded code blocks that are actually executable or exportable via [[https://orgmode.org/worg/org-contrib/babel/intro.html][babel]].
|
The main feature that I rely on in emacs is [[https://orgmode.org/][org-mode]]. This allows me to do literate programming, writing my documenation with embedded code blocks that are actually executable or exportable via [[https://orgmode.org/worg/org-contrib/babel/intro.html][babel]].
|
||||||
|
|
||||||
Working with some clients I also use [[https://code.visualstudio.com/][visual studio code]].
|
Working with some clients I also use [[https://code.visualstudio.com/][visual studio code]].
|
||||||
|
|
||||||
|
|
||||||
** Browsing the web
|
** Browsing the web
|
||||||
|
|
||||||
My primary browser is [[https://www.mozilla.org/en-GB/firefox/new/][firefox]]. The addons I use are:
|
My primary browser is [[https://www.mozilla.org/en-GB/firefox/new/][firefox]]. The addons I use are:
|
||||||
@ -30,8 +32,8 @@ My primary browser is [[https://www.mozilla.org/en-GB/firefox/new/][firefox]]. T
|
|||||||
|
|
||||||
For monitoring traffic, blocking connections, enforcing secure dns and routing connections through other servers vpn style I rely on [[https://safing.io/portmaster/][Portmaster]] + [[https://safing.io/spn/][SPN]].
|
For monitoring traffic, blocking connections, enforcing secure dns and routing connections through other servers vpn style I rely on [[https://safing.io/portmaster/][Portmaster]] + [[https://safing.io/spn/][SPN]].
|
||||||
|
|
||||||
** Reading email
|
|
||||||
|
|
||||||
|
** Reading email
|
||||||
|
|
||||||
For reading email I rely on the [[http://www.mutt.org][mutt]] terminal email client. Included in this repository are the configuration dotfiles I use.
|
For reading email I rely on the [[http://www.mutt.org][mutt]] terminal email client. Included in this repository are the configuration dotfiles I use.
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ I've configured mutt to be able to display html emails via ~lynx~ and open links
|
|||||||
|
|
||||||
The thing I like most about mutt is the caching which means I can traverse or scan through my entire email history in seconds. In a browser this would be a painfully slow process.
|
The thing I like most about mutt is the caching which means I can traverse or scan through my entire email history in seconds. In a browser this would be a painfully slow process.
|
||||||
|
|
||||||
|
|
||||||
** Managing secrets
|
** Managing secrets
|
||||||
|
|
||||||
[[https://bitwarden.com/][Bitwarden]] is my secrets manager of choice. Primarily due to the emphasis they place on open source and excellent ~bw~ cli utility. Use of the bitwarden cli is incorporated into many of my workflows.
|
[[https://bitwarden.com/][Bitwarden]] is my secrets manager of choice. Primarily due to the emphasis they place on open source and excellent ~bw~ cli utility. Use of the bitwarden cli is incorporated into many of my workflows.
|
||||||
|
|||||||
@ -1,23 +1,32 @@
|
|||||||
# -*- ii: ii; -*-
|
|
||||||
#+TITLE: Linux Mint Setup
|
#+TITLE: Linux Mint Setup
|
||||||
#+AUTHOR: James Blair
|
#+AUTHOR: James Blair
|
||||||
#+EMAIL: mail@jamesblair.net
|
#+EMAIL: mail@jamesblair.net
|
||||||
#+DATE: <2022-01-16 Sun 11:00>
|
#+DATE: <2022-11-15 Tue 09:15>
|
||||||
|
|
||||||
|
|
||||||
This guide will walk through how I setup fresh installations of [[https://linuxmint.com/][Linux Mint]]. Linux Mint is an operating system for desktop and laptop computers. It is designed to work 'out of the box' and comes fully equipped with the apps most people need.
|
This guide will walk through how I setup fresh installations of [[https://pop.system76.com/][POP!_OS]]. Pop!_OS is a free and open-source Linux distribution, based upon Ubuntu, and featuring a customized GNOME desktop environment known as COSMIC. The distribution is developed by American Linux computer manufacturer System76. Pop!_OS is primarily built to be bundled with the computers built by System76, but can also be downloaded and installed on most computers.
|
||||||
|
|
||||||
I use Linux Mint as my daily driver operating system on a variety of different machines. The intent of this guide is to make it easy for me to get back up and running quickly whenver I do a fresh installation.
|
Pop!_OS provides full out-of-the-box support for both AMD and Nvidia GPUs. It is regarded as an easy distribution to set up for gaming, mainly due to its built-in GPU support. Pop!_OS provides default disk encryption, streamlined window and workspace management, keyboard shortcuts for navigation as well as built-in power management profiles.
|
||||||
|
|
||||||
|
I use POP!_OS as my daily driver operating system on a variety of different machines. The intent of this guide is to make it easy for me to get back up and running quickly whenver I do a fresh installation.
|
||||||
|
|
||||||
|
|
||||||
* Setup home directory structure
|
* Setup home directory structure
|
||||||
|
|
||||||
|
After installing the distribution I ensure the following directories are present in my home folder as they are relied on by other automated steps in this setup process:
|
||||||
|
|
||||||
|
#+NAME: Setup home folder strucuture
|
||||||
|
#+begin_src shell
|
||||||
|
# Ensure we are in our home folder and create required directories
|
||||||
|
cd ~/ && mkdir Documents Downloads
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
* Configure apt to use a local mirror
|
* Configure apt to use a local mirror
|
||||||
|
|
||||||
To speed up how quickly our system can install new or updated packages we should tell ~apt~ to use a mirror here in New Zealand.
|
To speed up how quickly our system can install new or updated packages we should tell ~apt~ to use a mirror here in New Zealand.
|
||||||
|
|
||||||
|
#+NAME: Configure local apt mirror
|
||||||
#+begin_src tmate
|
#+begin_src tmate
|
||||||
# Backup our apt sources configuration before we make changes
|
# Backup our apt sources configuration before we make changes
|
||||||
sudo cp /etc/apt/sources.list.d/official-package-repositories.list /etc/apt/sources.list.d/official-package-repositories.list.bak
|
sudo cp /etc/apt/sources.list.d/official-package-repositories.list /etc/apt/sources.list.d/official-package-repositories.list.bak
|
||||||
@ -61,7 +70,6 @@ sudo apt-get update && sudo apt install -y helm
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Finally, we should upgrade the python package manger ~pip~ that we installed, before using it to install [[https://github.com/containers/podman-compose][podman-compose]].
|
Finally, we should upgrade the python package manger ~pip~ that we installed, before using it to install [[https://github.com/containers/podman-compose][podman-compose]].
|
||||||
|
|
||||||
#+NAME: Upgrade pip
|
#+NAME: Upgrade pip
|
||||||
@ -69,6 +77,7 @@ Finally, we should upgrade the python package manger ~pip~ that we installed, be
|
|||||||
sudo pip install --upgrade pip && sudo pip3 install podman-compose
|
sudo pip install --upgrade pip && sudo pip3 install podman-compose
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
For managing secrets we use [[https://bitwarden.com/][bitwarden]] which provides a great [[https://github.com/bitwarden/cli][cli utility]]. Additionally in our [[.bashrc][bashrc]] file included in this repository there are a number of helper functions to make working with ~bw~ easier.
|
For managing secrets we use [[https://bitwarden.com/][bitwarden]] which provides a great [[https://github.com/bitwarden/cli][cli utility]]. Additionally in our [[.bashrc][bashrc]] file included in this repository there are a number of helper functions to make working with ~bw~ easier.
|
||||||
|
|
||||||
#+NAME: Install bitwarden and login
|
#+NAME: Install bitwarden and login
|
||||||
@ -94,19 +103,55 @@ pip3 install ansible
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
We use [[https://helm.sh][helm]] for packaging applications for kubernetes so let's install that now. Unfortunately we need an extra repository for this so let's separate this into a new step:
|
* Restore ssh keys and dotfiles
|
||||||
|
|
||||||
#+NAME: Install helm
|
I make extensive use of ~.dotfiles~ to further customise my environment. The script below restores my versions of key dotfiles automatically.
|
||||||
#+BEGIN_SRC tmate
|
|
||||||
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
|
|
||||||
echo "deb https://baltocdn.com/helm/stable/debidan/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
|
|
||||||
|
|
||||||
sudo apt-get update && sudo apt install -y helm
|
*** Obtain ssh key from bitwarden
|
||||||
|
|
||||||
|
In order to be able to clone the repository in the next step we need to obtain our ssh keys from bitwarden. Given we have installed the bitwarden cli we can mostly automte this process minus the initial login to bitwarden.
|
||||||
|
|
||||||
|
#+NAME: Obtain ssh keys from bitwarden
|
||||||
|
#+begin_src shell
|
||||||
|
# Ensure we have an ssh-agent running
|
||||||
|
eval `ssh-agent`
|
||||||
|
|
||||||
|
# Generate a new blank key to overwrite
|
||||||
|
ssh-keygen -t rsa -f ~/.ssh/james -q -P ""
|
||||||
|
|
||||||
|
# Ensure we have an active bitwarden session
|
||||||
|
export BW_SESSION=$(bw unlock --raw > ~/.bw_session && cat ~/.bw_session)
|
||||||
|
|
||||||
|
# Export both keys
|
||||||
|
export key=$(bw get item desktop --pretty | grep notes)
|
||||||
|
|
||||||
|
# Extract private key
|
||||||
|
export private=${key:12}
|
||||||
|
export private=${private/END RSA*/END RSA PRIVATE KEY-----}
|
||||||
|
echo $private | awk '{gsub(/\\n/,"\n")}1' > ~/.ssh/james
|
||||||
|
|
||||||
|
# Extract public key
|
||||||
|
export public=${key/*ssh-rsa/ssh-rsa} && echo ${public::-2} | awk '{gsub(/\\n/,"\n")}1' > ~/.ssh/james.pub
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
|
*** Clone and restore dotfiles
|
||||||
|
|
||||||
|
Once our keys are available to us we can clone down our dotfiles and get back to our comfortable normal terminal environment.
|
||||||
|
|
||||||
|
#+NAME: Clone and restore the dotfiles
|
||||||
|
#+BEGIN_SRC shell
|
||||||
|
# Clone down this repository
|
||||||
|
git clone https://jmhbnz@gitea.jamma.life/jmhbnz/tooling.git ~/Documents/tooling/
|
||||||
|
|
||||||
|
# Restore all dotfiles
|
||||||
|
cp ~/Documents/tooling/.* ~/
|
||||||
|
|
||||||
|
# Reload bashrc with updated version
|
||||||
|
source ~/.bashrc
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
* Restore ssh keys and dotfiles
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* Optional configuration
|
* Optional configuration
|
||||||
@ -193,7 +238,7 @@ An integral part of our pair development workflow is [[https://github.com/humacs
|
|||||||
|
|
||||||
#+NAME: Install and configure humacs
|
#+NAME: Install and configure humacs
|
||||||
#+BEGIN_SRC tmate
|
#+BEGIN_SRC tmate
|
||||||
# Clone down humacs
|
# Clone down humac[s
|
||||||
git clone --recursive https://github.com/jmhbnz/humacs /home/$USER/Downloads/
|
git clone --recursive https://github.com/jmhbnz/humacs /home/$USER/Downloads/
|
||||||
|
|
||||||
# Need to ensure environment variables are set for load path
|
# Need to ensure environment variables are set for load path
|
||||||
@ -203,6 +248,30 @@ export EMACSLOADPATH=/home/$USER/Downloads/humacs
|
|||||||
|
|
||||||
** Optional - Setup mutt mail client
|
** Optional - Setup mutt mail client
|
||||||
|
|
||||||
|
For reading email we ideally use a cli based client for fast searching and lightweight mail reading.
|
||||||
|
|
||||||
|
The [[https://gitlab.com/muttmua/mutt/][mutt]] mail client fills these roles well for imap mailboxes.
|
||||||
|
|
||||||
|
The first step to setup mutt is to ensure it is installed.
|
||||||
|
|
||||||
|
#+NAME: Install mutt
|
||||||
|
#+BEGIN_SRC tmate
|
||||||
|
sudo apt-get install -y mutt urlscan
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
After installing mutt we then need to create configuration directories and files.
|
||||||
|
|
||||||
|
#+NAME: Create mutt config files
|
||||||
|
#+BEGIN_SRC tmate
|
||||||
|
mkdir -p ~/.mutt/cache/headers
|
||||||
|
mkdir ~/.mutt/cache/bodies
|
||||||
|
touch ~/.mutt/certificates
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
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 provided in this repository utilises the ~bitwarden~ cli utility for secrets to ensure these are securely gathered at runtime and not stored in the file.
|
||||||
|
|
||||||
|
|
||||||
** Optional - Install rust
|
** Optional - Install rust
|
||||||
|
|
||||||
@ -227,7 +296,7 @@ rustc -V && cargo -V
|
|||||||
|
|
||||||
** Optional - Bluetooth manual pairing
|
** Optional - Bluetooth manual pairing
|
||||||
|
|
||||||
Using linux mint across all my devices has been pretty smooth however I have one annoyance with bluetooth on my HP Envy x360 ultrabook (model 13-ag0015AU). On that device I can't pair my Logitech k380 keyboard with the user interface, via either ~blueberry~ or ~blueman~.
|
Using linux across all my devices has been pretty smooth however I have one annoyance with bluetooth on my HP Envy x360 ultrabook (model 13-ag0015AU). On that device I can't pair my Logitech k380 keyboard with the user interface, via either ~blueberry~ or ~blueman~.
|
||||||
|
|
||||||
To work around this I found some excellent documentation on the Arch Linux wiki for [[https://wiki.archlinux.org/title/Bluetooth#Pairing][manually pairing]] with ~bluetoothctl~.
|
To work around this I found some excellent documentation on the Arch Linux wiki for [[https://wiki.archlinux.org/title/Bluetooth#Pairing][manually pairing]] with ~bluetoothctl~.
|
||||||
|
|
||||||
@ -1,238 +0,0 @@
|
|||||||
# -*- ii: ii; -*-
|
|
||||||
|
|
||||||
#+TITLE: Windows 10 Setup
|
|
||||||
#+AUTHOR: James Blair
|
|
||||||
#+EMAIL: mail@jamesblair.net
|
|
||||||
#+DATE: <2020-09-26 Sat 06:45>
|
|
||||||
|
|
||||||
|
|
||||||
This org file will guide you through the process of setting a development environment in Windows 10 using Windows Subsystem for Linux.
|
|
||||||
|
|
||||||
The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.
|
|
||||||
|
|
||||||
|
|
||||||
* Install windows subsystem for linux
|
|
||||||
|
|
||||||
To get underway we need to enable [[https://docs.microsoft.com/en-us/windows/wsl/install-win10][WSL2]]. This requires a 64bit installation of Windows 10 professional, build 18362 or higher.
|
|
||||||
|
|
||||||
#+NAME: Enable the wsl features
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# The vritual machine platform optional feature is required for wsl2
|
|
||||||
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
|
|
||||||
|
|
||||||
# Once the virtual machine platform is enabled we can enable wsl2
|
|
||||||
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
Once the wsl feature is enabled it is recommended to update the linux kernel package for wsl2.
|
|
||||||
|
|
||||||
*Note:* Before proceeding with the installation of WSL 2, you will need to have CPU virtualisation enabled on your machine. Depending on your CPU architecture this may involve updating your bios settings:
|
|
||||||
|
|
||||||
- For AMD CPUs, you will look for a feature called: "AMD (AMD Secure Virtual Machine, AMD SVM)"
|
|
||||||
|
|
||||||
- For Intel CPUs, you will look for a feature called: "Intel (Intel Virtualization Technology, Intel VT-x)"
|
|
||||||
|
|
||||||
Finally, for AMD CPUs you may need to update [[https://www.reddit.com/r/AMDHelp/comments/d4l462/enabling_svm_on_laptop_leads_to_black_boot_screen/][UMA Framebuffer size]] to auto.
|
|
||||||
|
|
||||||
#+NAME: Update the linux kernel
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Download the update
|
|
||||||
powershell.exe curl.exe -L -o $env:TEMP\wsl_update_x64.msi https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
|
|
||||||
|
|
||||||
# Install the update automatically
|
|
||||||
Start-Process msiexec.exe -Wait -ArgumentList '/I $env:TEMP\wsl_update_x64.msi /quiet'
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
Before we install a specific distribution of wsl we need to set the default version of wsl to version 2.
|
|
||||||
|
|
||||||
*Note:* you may need to reboot your machine before this command will complete successfully.
|
|
||||||
|
|
||||||
#+NAME: Set default wsl version
|
|
||||||
#+BEGIN_SRC
|
|
||||||
powershell.exe wsl --set-default-version 2
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
After enabling the wsl feature we need to download the distribution installer and open it.
|
|
||||||
|
|
||||||
For my tooling setup I currently use the Ubuntu distribution after historically preferring Debian. The reason for the shift is the native apt installation for an up to date ~emacs~ installation available in Ubuntu.
|
|
||||||
|
|
||||||
#+NAME: Download and run the ubuntu installer
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Download the appx package for ubuntu distribution.
|
|
||||||
powershell.exe curl.exe -L -o $env:TEMP\ubuntu.appx https://aka.ms/wslubuntu2004
|
|
||||||
|
|
||||||
# Install the appx package
|
|
||||||
powershell.exe Add-AppxPackage $env:TEMP\ubuntu.appx
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
*Note:* If you encounter an error while adding the package, I have needed to use the ~wsreset~ command in the past to first reset the windows store application.
|
|
||||||
|
|
||||||
After the installer runs we need to manually enter a username and password for the unix account that wsl will use.
|
|
||||||
|
|
||||||
You can use the following command to verify the distribution and version you now have installed ~powershell.exe wsl --list --verbose~.
|
|
||||||
|
|
||||||
|
|
||||||
* Install an x server for wsl
|
|
||||||
|
|
||||||
One of the ways we extend standard wsl functionality is installing an x server on windows to allow graphical applications to be run.
|
|
||||||
|
|
||||||
This has the added benefit of allowing command line clipboard tools like [[https://github.com/astrand/xclip][xclip]] to be used within wsl.
|
|
||||||
|
|
||||||
The x server I've found to be rock solid for this purpose is [[https://sourceforge.net/projects/vcxsrv/][VcXsrv]]. Which is also open source.
|
|
||||||
|
|
||||||
#+NAME: Download and install VcXsrv
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Download the vcxsrv installer
|
|
||||||
powershell.exe curl.exe -L -o $env:TEMP\installer.exe https://sourceforge.net/projects/vcxsrv/files/latest/download
|
|
||||||
|
|
||||||
# Install vcxsrv
|
|
||||||
powershell.exe $env:TEMP\installer.exe
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
After following through the installer we want to ensure VcXsrv launches at startup with our desired configuration.
|
|
||||||
|
|
||||||
To achieve this we can add an xlaunch configuration which is just xml with a fancy extension to our machines startup folder.
|
|
||||||
|
|
||||||
#+NAME: Apply our VcXsrv configuration
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
cd /mnt/c/ProgramData/Microsoft/Windows/Start\ Menu/Programs/Startup
|
|
||||||
cat > VcXsrv.xlaunch << EOF
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<XLaunch WindowMode="MultiWindow" ClientMode="NoClient" LocalClient="False" Display="-1" LocalProgram="xcalc" RemoteProgram="xterm" RemotePassword="" PrivateKey="" RemoteHost="" RemoteUser="" XDMCPHost="" XDMCPBroadcast="False" XDMCPIndirect="False" Clipboard="True" ClipboardPrimary="True" ExtraParams="" Wgl="True" DisableAC="True" XDMCPTerminate="False"/>
|
|
||||||
EOF
|
|
||||||
cmd.exe /c VcXsrv.xlaunch
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
* Configure windows ten
|
|
||||||
|
|
||||||
Enable all tray icons to be visible and restart explorer
|
|
||||||
|
|
||||||
#+NAME: Configure tray icons
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Ensure all tray icons are visible
|
|
||||||
powershell.exe Set-ItemProperty HKLM:\SOFTWARE\Micorosoft\Windows\CurrentVersion\Explorer EnableAutoTray 0
|
|
||||||
|
|
||||||
# Restart explorer
|
|
||||||
powershell.exe ps explorer | kill
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
Additionally I normally take the following actions:
|
|
||||||
|
|
||||||
** Update taskbar layout
|
|
||||||
|
|
||||||
I normally take the following steps immediately for a new installtion, I have not found an easy way of automating this as yet:
|
|
||||||
|
|
||||||
- Hide the search box.
|
|
||||||
- Hide the task view button.
|
|
||||||
- Unpin all but explorer.
|
|
||||||
|
|
||||||
|
|
||||||
** Update start menu layout
|
|
||||||
|
|
||||||
I prefer to have no pinned "tiles" in my start menu. The script below will unpin all applications from start.
|
|
||||||
|
|
||||||
*Note:* In subsequent versions of Windows 10 this script seems to fail so I am back to doing this manually for now...
|
|
||||||
|
|
||||||
#+begin_src shell
|
|
||||||
powershell.exe -NoLogo
|
|
||||||
(New-Object -Com Shell.Application).
|
|
||||||
NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').
|
|
||||||
Items() |
|
|
||||||
%{ $_.Verbs() } |
|
|
||||||
?{$_.Name -match 'Un.*pin from Start'} |
|
|
||||||
%{$_.DoIt()}
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
|
|
||||||
** Lock screen configuration
|
|
||||||
|
|
||||||
I prefer a simple lock screen with no clutter so normally take the following steps:
|
|
||||||
|
|
||||||
- Untick show tips
|
|
||||||
- Set background to be picture and use in folder
|
|
||||||
- Remove status detailed or otherwise for apps on lock screen
|
|
||||||
|
|
||||||
|
|
||||||
** Fix inactive window title colors
|
|
||||||
|
|
||||||
One of the annoyances I have in windows ten is after setting a title bar color for windows as part of standard theming any inactive windows have an awful white glare instead of retaining that color. Thankfully there is a [[ https://winaero.com/blog/change-color-of-inactive-title-bars-in-windows-10][registry tweak]] we can do to fix this.
|
|
||||||
|
|
||||||
#+NAME: Configure inactive window title color
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
powershell.exe Set-ItemProperty HKCU:\SOFTWARE\Micorosoft\Windows\DWM AccentColorInactive ff484a4c
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
* Configure a web browser
|
|
||||||
|
|
||||||
My current browser of choice is [[https://www.mozilla.org/en-US/firefox/new/][Firefox]]. This is primarily due to their respect for open source, user privacy and security and customisation.
|
|
||||||
|
|
||||||
#+NAME: Download and run firefox installer
|
|
||||||
#+begin_src shell
|
|
||||||
# Download the firefox installer
|
|
||||||
powershell.exe curl.exe -L -o $env:TEMP\firefox.exe https://download.mozilla.org/?product=firefox
|
|
||||||
|
|
||||||
# Launch the installer
|
|
||||||
#env:TEMP\firefox.exe
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
|
|
||||||
One of the customisations we apply is to update the color of the newtab page in firefox to match the rest of the theme we use and prevent white glare. To achieve this we use [[https://superuser.com/questions/1235975/change-firefox-new-tab-background#][usercss]].
|
|
||||||
|
|
||||||
Note there is an about:config setting that needs to be set to enable these stylesheets to be used ~toolkit.legacyUserProfileCustomizations.stylesheets~
|
|
||||||
|
|
||||||
#+NAME: Configure usercss
|
|
||||||
#+begin_src shell
|
|
||||||
cd /c/Users/$USER/AppData/Roaming/Mozilla/Firefox/Profiles/[Default Profile]/chrome/
|
|
||||||
cat > userContent.css << EOF
|
|
||||||
/* https://userstyles.org/styles/90565/firefox-adjust-white-flash-when-opening-new-tab */
|
|
||||||
/* https://userstyles.org/styles/142191/remove-new-tab-flash */
|
|
||||||
@-moz-document url-prefix(about:preferences), url-prefix(about:blank), url-prefix(about:newtab) {
|
|
||||||
html, body, #newtab-customize-overlay {
|
|
||||||
background: #323232 !important;
|
|
||||||
color: #b2b2b2 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-document url(chrome://browser/content/browser.xul)
|
|
||||||
{
|
|
||||||
|
|
||||||
browser[type="content-primary"]
|
|
||||||
{
|
|
||||||
background: #323232 !important;
|
|
||||||
color: #b2b2b2 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-document url(chrome://browser/content/browser.xul)
|
|
||||||
{
|
|
||||||
|
|
||||||
browser[type="content-primary"], tabbrowser tabpanels, #appcontent > #content
|
|
||||||
{
|
|
||||||
background: #1B1B1B url("chrome://global/skin/media/imagedoc-darknoise.png") repeat fixed !important;
|
|
||||||
color: #b2b2b2 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-document url(about:blank),
|
|
||||||
url(about:preferences),
|
|
||||||
url(about:config),
|
|
||||||
url(about:newtab)
|
|
||||||
{
|
|
||||||
#newtab-window,
|
|
||||||
html,
|
|
||||||
body,
|
|
||||||
#newtab-customize-overlay
|
|
||||||
{
|
|
||||||
background: #1B1B1B url("chrome://global/skin/media/imagedoc-darknoise.png") repeat fixed;
|
|
||||||
color: #b2b2b2 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EOF
|
|
||||||
#+end_src
|
|
||||||
275
wsl-setup.org
275
wsl-setup.org
@ -1,275 +0,0 @@
|
|||||||
# -*- ii: ii; -*-
|
|
||||||
#+TITLE: Windows Subsystem for Linux Setup
|
|
||||||
#+AUTHOR: James Blair
|
|
||||||
#+EMAIL: mail@jamesblair.net
|
|
||||||
#+DATE: <2020-09-26 Sat 08:20>
|
|
||||||
|
|
||||||
|
|
||||||
This guide will walk through setting up [[https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux][Windows Subsystem for Linux]] on Windows 10. This particular setup contains my opinionated view of a good foundation and layers on some pairing and development orientated tooling over top.
|
|
||||||
|
|
||||||
*Caveats:* Please note this guide is written for the [[https://www.microsoft.com/store/productId/9NBLGGH4MSV6][Ubuntu WSL distribution]].
|
|
||||||
|
|
||||||
*Acknowledgements:* Large elements of this wsl setup came about through collaboration with the great people at [[https://ii.coop][ii.coop]]. I encourage you to explore and contribute to their work on [[https://gitlab.ii.coop][gitlab]] as many elements form a core part of this setup and workflow.
|
|
||||||
|
|
||||||
|
|
||||||
** Step 1 - Setup home folder structure
|
|
||||||
|
|
||||||
After installing the Ubuntu WSL distribution no folders are present in your home folder.
|
|
||||||
|
|
||||||
In this section we create some quick standard folders to keep our home folder somewhat organised.
|
|
||||||
|
|
||||||
#+NAME: Setup home folder strucuture
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Ensure we are in our home folder
|
|
||||||
cd ~/
|
|
||||||
|
|
||||||
# Create a documents folder for our git repositories
|
|
||||||
mkdir Documents
|
|
||||||
|
|
||||||
# Create a downloads folder for temporary objects
|
|
||||||
mkdir Downloads
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
** Step 2 - Update and install packages
|
|
||||||
|
|
||||||
To get started we ensure the package manager is up to date.
|
|
||||||
|
|
||||||
#+NAME: Update system packages
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
sudo apt-get update && sudo apt-get upgrade
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
Next we install a series of standard packages that form part of our workflow or are dependencies for other tools in our environment.
|
|
||||||
|
|
||||||
#+NAME: Install standard packages
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
sudo apt-get install -y git locales curl wget xclip xsel tmux tmate net-tools less wget htop screenfetch zip openssh-client dictd knockd python3-pip emacs apt-transport-https software-properties-common ca-certificates dirmngr xterm xtermcontrol jq
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
We use [[https://docker.io][docker]] to run containers or kind (kubernetes in docker) locally.
|
|
||||||
|
|
||||||
#+NAME: Install docker
|
|
||||||
#+begin_src shell
|
|
||||||
# Download and add Docker's official public PGP key.
|
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
|
||||||
|
|
||||||
# Add the `stable` channel's Docker upstream repository.
|
|
||||||
sudo add-apt-repository \
|
|
||||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
|
||||||
$(lsb_release -cs) \
|
|
||||||
stable"
|
|
||||||
|
|
||||||
# Update the apt package list and install docker packages.
|
|
||||||
sudo apt-get update -y && sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
|
||||||
|
|
||||||
# Allow your user to access the Docker CLI without needing root access.
|
|
||||||
sudo usermod -aG docker $USER
|
|
||||||
|
|
||||||
# Ensure the docker service is started
|
|
||||||
sudo service docker start
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
|
|
||||||
For additional package management namely ~bitwarden~ we use [[https://www.npmjs.com/][node package manager]]. The code below installs node ~16.x~, which is the latest stable release as of <2021-10-02 Sat>.
|
|
||||||
|
|
||||||
#+NAME: Install node
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Curl down the shell script for adding version 12 of nodejs to apt
|
|
||||||
sudo curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
|
|
||||||
|
|
||||||
# Install the nodejs package via apt
|
|
||||||
sudo apt-get install -y nodejs
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
For managing secrets we use [[https://bitwarden.com/][bitwarden]] which provides a great [[https://github.com/bitwarden/cli][cli utility]].
|
|
||||||
|
|
||||||
This section should be expanded in future to cover setting alias for common bitwarden tasks.
|
|
||||||
|
|
||||||
#+NAME: Install bitwarden and login
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Install the bitwarden cli via node package manager
|
|
||||||
sudo npm install -g @bitwarden/cli
|
|
||||||
|
|
||||||
# Test login to bitwarden
|
|
||||||
bw login mail@jamesblair.net
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
For working with google cloud platform we use the [[https://cloud.google.com/sdk/][GCP SDK]], which provides our cli tools.
|
|
||||||
|
|
||||||
#+NAME: Install google cloud sdk
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Download the sdk archive
|
|
||||||
curl -o gcpsdk.tar -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-311.0.0-linux-x86_64.tar.gz
|
|
||||||
|
|
||||||
# Extract to a folder in path
|
|
||||||
sudo tar xvf gcpsdk.tar -C /usr/local/
|
|
||||||
|
|
||||||
# Correct folder permissions
|
|
||||||
sudo chown -R $USER:$USER /usr/local/google-cloud-sdk
|
|
||||||
|
|
||||||
# Run the install script
|
|
||||||
/usr/local/google-cloud-sdk/install.sh
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
For working with [[https://azure.microsoft.com/en-us/][Microsoft Azure]] we need the [[https://docs.microsoft.com/en-us/cli/azure/][Azure CLI]].
|
|
||||||
|
|
||||||
#+NAME: Install azure cli
|
|
||||||
#+begin_src shell
|
|
||||||
# Modify your sources list so that the Microsoft repository is registered
|
|
||||||
AZ_REPO=$(lsb_release -cs)
|
|
||||||
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
|
|
||||||
sudo tee /etc/apt/sources.list.d/azure-cli.list
|
|
||||||
|
|
||||||
# Import the encryption key for the Microsoft Ubuntu repository.
|
|
||||||
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
|
|
||||||
|
|
||||||
# Install the Azure CLI.
|
|
||||||
sudo apt-get update && sudo apt-get install azure-cli
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
|
|
||||||
For working with [[https://aws.com][Amazon Web Services]] we need the [[https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html][AWS CLI]].
|
|
||||||
|
|
||||||
#+NAME: Install amazon web services cli
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Download the binary
|
|
||||||
cd ~/Downloads/
|
|
||||||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
|
||||||
|
|
||||||
# Install
|
|
||||||
unzip awscliv2.zip
|
|
||||||
sudo ./aws/install
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf ~/Downloads/aws*
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
For cloud infrastructure deployments we use [[https://www.terraform.io/][terraforms]].
|
|
||||||
|
|
||||||
#+NAME: Install hashicorp terraforms
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Download the binary
|
|
||||||
wget 'https://releases.hashicorp.com/terraform/0.12.24/terraform_0.12.24_linux_amd64.zip'
|
|
||||||
|
|
||||||
# Unzip it
|
|
||||||
unzip *.zip
|
|
||||||
|
|
||||||
# Move the binary to path
|
|
||||||
sudo mv terraform /usr/local/bin/
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm *amd64.zip
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
For ad-hoc system administration we use [[https://deb.nodesource.com/setup_12.x ][ansible]]. We install ansible via ~pip~ to ensure any modules or additional packages required at a later date can be easily managed.
|
|
||||||
|
|
||||||
For significant ansible or python projects a virtual environment for python is suggested to keep project packages separate from system python packages.
|
|
||||||
|
|
||||||
#+NAME: Install ansible via pip
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
pip3 install ansible
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
** Step 3 - Setup environment dotfiles
|
|
||||||
|
|
||||||
Within wsl we can use .dotfiles to further customise our environment. The script below restores my versions of key dotfiles automatically.
|
|
||||||
|
|
||||||
*Note:* The git clone below relies on having permission to clone the repository referenced. For me this means having an ssh key present which has been added to gitlab.
|
|
||||||
|
|
||||||
*** Obtain ssh keys from bitwarden
|
|
||||||
|
|
||||||
In order to be able to clone the repository in the next step we need to obtain our ssh keys from bitwarden. Given we have installed the bitwarden cli we can mostly automte this process minus the initial login to bitwarden.
|
|
||||||
|
|
||||||
#+NAME: Obtain ssh keys from bitwarden
|
|
||||||
#+begin_src shell
|
|
||||||
# Ensure we have an ssh-agent running
|
|
||||||
eval `ssh-agent`
|
|
||||||
|
|
||||||
# Generate a new blank key to overwrite
|
|
||||||
ssh-keygen -t rsa -f ~/.ssh/james -q -P ""
|
|
||||||
|
|
||||||
# Ensure we have an active bitwarden session
|
|
||||||
export BW_SESSION=$(bw unlock --raw > ~/.bw_session && cat ~/.bw_session)
|
|
||||||
|
|
||||||
# Export both keys
|
|
||||||
export key=$(bw get item desktop --pretty | grep notes)
|
|
||||||
|
|
||||||
# Extract private key
|
|
||||||
export private=${key:12}
|
|
||||||
export private=${private/END RSA*/END RSA PRIVATE KEY-----}
|
|
||||||
echo $private | awk '{gsub(/\\n/,"\n")}1' > ~/.ssh/james
|
|
||||||
|
|
||||||
# Extract public key
|
|
||||||
export public=${key/*ssh-rsa/ssh-rsa} && echo ${public::-2} | awk '{gsub(/\\n/,"\n")}1' > ~/.ssh/james.pub
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
|
|
||||||
*** Clone and restore dotfiles
|
|
||||||
|
|
||||||
Once our keys are available to us we can clone down our dotfiles and get back to our comfortable normal terminal environment.
|
|
||||||
|
|
||||||
#+NAME: Clone and restore the dotfiles
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Remove the interactive host prompt
|
|
||||||
ssh-keyscan -p 2224 gitlab.jamma.life >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
# Clone down this repository
|
|
||||||
git clone ssh://git@gitlab.jamma.life:2224/jmhbnz/tooling.git ~/Documents/tooling/
|
|
||||||
|
|
||||||
# Restore all dotfiles
|
|
||||||
cp ~/Documents/tooling/.* ~/
|
|
||||||
|
|
||||||
# Reload bashrc with updated version
|
|
||||||
source ~/.bashrc
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
** Step 4 - Install humacs editor
|
|
||||||
|
|
||||||
An integral part of our pair development workflow is [[https://github.com/humacs/humacs][humacs]]. Below are the instructions to install this directly in WSL, note there are other options to install in the documentation linked above.
|
|
||||||
|
|
||||||
#+NAME: Install and configure humacs
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
# Clone down humacs
|
|
||||||
git clone --recursive https://github.com/humacs/humacs /home/$USER/
|
|
||||||
|
|
||||||
|
|
||||||
# Need to ensure environment variables are set for load path
|
|
||||||
export EMACSLOADPATH=/home/$USER/humacs
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
** Step 5 - Setup mutt email client
|
|
||||||
|
|
||||||
For reading email we ideally use a cli based client for fast searching and lightweight mail reading.
|
|
||||||
|
|
||||||
The [[https://gitlab.com/muttmua/mutt/][mutt]] mail client fills these roles well for imap mailboxes.
|
|
||||||
|
|
||||||
The first step to setup mutt is to ensure it is installed.
|
|
||||||
|
|
||||||
#+NAME: Install mutt
|
|
||||||
#+BEGIN_SRC tmate
|
|
||||||
sudo apt-get install -y mutt urlscan
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
After installing mutt we then need to create configuration directories and files.
|
|
||||||
|
|
||||||
#+NAME: Create mutt config files
|
|
||||||
#+BEGIN_SRC tmate
|
|
||||||
mkdir -p ~/.mutt/cache/headers
|
|
||||||
mkdir ~/.mutt/cache/bodies
|
|
||||||
touch ~/.mutt/certificates
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
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 provided in this repository utilises the ~bitwarden~ cli utility for secrets to ensure these are securely gathered at runtime and not stored in the file.
|
|
||||||
Reference in New Issue
Block a user