shinyay / win-setup

0 stars 0 forks source link

Windows 11 Enterprise - 23H2 (T14s)


1. Initial Setup

App Installer

image

If winget does not work, you should upgrade App Installer

winget source

If you cannot search the target item with winget search, confirm winget source list

winget source list
Name    Argument                                      Explicit
--------------------------------------------------------------
msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0 false

If you cannot find the source target, winget, then you should add it.

Run Terminal as Administrator and add the target to source:

winget source add -n winget -a https://winget.azureedge.net/cache
winget source list
Name    Argument                                      Explicit
--------------------------------------------------------------
winget  https://winget.azureedge.net/cache            false
msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0 false

Microsoft Terminal Preview

winget search 'Windows Terminal'
winget install Microsoft.WindowsTerminal.Preview

ULE4JIS / alt-ime-ahk

If your keyaboard layout is Japanese, you can try the following tools when you use the US Keyboad layout.

I extracted to C:<USER_DIR>\Tools\MyToolsForStartup

It is useful that you create shortcuts and deploy the Startup folder.

shell:startup

Google Japanese IME

winget install Google.JapaneseIME

Keymap Configuration

  1. Properties > Keymap Stype > Customize > Convert Hankaku/Zenkaku to Ctrl + Space
  2. Remove the followings:
    • Composition / Insert half-width space
    • Coversion / Insert half-width space
  3. You can use new keymaps after opening a new application

PowerShell

Check your PowerShell Version

$PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

If your PowerShell version is not latest, you should upgrade

winget search Microsoft.PowerShell
winget search Microsoft.PowerShell
Name               Id                           Version Source
---------------------------------------------------------------
PowerShell         Microsoft.PowerShell         7.4.2.0 winget
PowerShell Preview Microsoft.PowerShell.Preview 7.5.0.2 winget
winget install --id Microsoft.Powershell
winget install --id Microsoft.Powershell.Preview

WSL

WSL2 is a Windows Subsystem for Linux that allows access to Linux tools and applications directly from the Windows environment12. It offers the best of both worlds by allowing you to run Windows apps, like Visual Studio, alongside a Linux shell for easier command line access2. WSL2 uses a virtual machine, and uses a full Linux kernel built and shipped with Windows23. With WSL2, you can build docker images that paravirtualize your GPU4.

Turn Windows features on or off Turn Windows features on or off

Prepare for installation

It is also possible to activate WSL from the command line below without activating it from the GUI.

Run as Administrator PowerShell and enable the following features:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:HypervisorPlatform /all /norestart

And restart

Restart-Computer -Force

WSL Installation

Update WSL

wsl --update

Check the available distributions

wsl --list --online
NAME                                   FRIENDLY NAME
Ubuntu                                 Ubuntu
Debian                                 Debian GNU/Linux
kali-linux                             Kali Linux Rolling
Ubuntu-18.04                           Ubuntu 18.04 LTS
Ubuntu-20.04                           Ubuntu 20.04 LTS
Ubuntu-22.04                           Ubuntu 22.04 LTS
Ubuntu-24.04                           Ubuntu 24.04 LTS
OracleLinux_7_9                        Oracle Linux 7.9
OracleLinux_8_7                        Oracle Linux 8.7
OracleLinux_9_1                        Oracle Linux 9.1
openSUSE-Leap-15.5                     openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4    SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5           SUSE Linux Enterprise

Install the latest Ubuntu.

wsl --install Ubuntu-24.04
Installing: Ubuntu 24.04 LTS
Ubuntu 24.04 LTS has been installed.
Launching Ubuntu 24.04 LTS...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: shinyay
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 24.04 LTS (GNU/Linux 5.15.146.1-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Sun Apr 28 13:57:02 JST 2024

  System load:  0.66                Processes:             28
  Usage of /:   0.1% of 1006.85GB   Users logged in:       0
  Memory usage: 2%                  IPv4 address for eth0: 172.18.224.114
  Swap usage:   0%

This message is shown once a day. To disable it please create the
/home/shinyay/.hushlogin file.

Upgrade packages

sudo apt update && sudo apt upgrade

WSL Setup

Hostname

sudo vim /etc/wsl.conf

Add the followings:

[network]
hostname=wsl

Then you should shutdown WSL with PowerShell.

wsl --shutdown

Run your WSL again, now your configuration is enabled.

Other WSL Settings

SECTION ITEM SETTING NOTE
boot systemd true Enable systemd support
network hostname <YOUR_HOSTNAME> Hostname for your WSL Instance
interop appendWindowsPath false / true Apped your Windows PATH or not
user default <YOUR_USERNAME> WSL Login Username

Terminal

Terminal settings:

Startup

image

Homebrew

image

Homebrew is an open-source software package manager that makes it easier to install software on macOS (Apple's operating system) and Linux. Basically, a package manager's job is to find and install the right software packages that will allow you to compile and run various apps/software on your specific operating system.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
==> This script will install:
/home/linuxbrew/.linuxbrew/bin/brew
/home/linuxbrew/.linuxbrew/share/doc/homebrew
/home/linuxbrew/.linuxbrew/share/man/man1/brew.1
/home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew
/home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew
/home/linuxbrew/.linuxbrew/Homebrew
==> The following new directories will be created:
/home/linuxbrew/.linuxbrew/bin
/home/linuxbrew/.linuxbrew/etc
/home/linuxbrew/.linuxbrew/include
/home/linuxbrew/.linuxbrew/lib
/home/linuxbrew/.linuxbrew/sbin
/home/linuxbrew/.linuxbrew/share
/home/linuxbrew/.linuxbrew/var
/home/linuxbrew/.linuxbrew/opt
/home/linuxbrew/.linuxbrew/share/zsh
/home/linuxbrew/.linuxbrew/share/zsh/site-functions
/home/linuxbrew/.linuxbrew/var/homebrew
/home/linuxbrew/.linuxbrew/var/homebrew/linked
/home/linuxbrew/.linuxbrew/Cellar
/home/linuxbrew/.linuxbrew/Caskroom
/home/linuxbrew/.linuxbrew/Frameworks
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/shinyay/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
sudo apt-get install build-essential
brew install gcc
brew doctor

Update and Upgrade

brew update
brew outdated
brew upgrade

Git

image

Check pre-installed Git

which git

/usr/bin/git
git -v

git version 2.43.0
brew install git
which git

/home/linuxbrew/.linuxbrew/bin/git
git --version

git version 2.47.0

Git Global Configuration

git config --global user.name "shinyay" && \
git config --global user.email "<YOUR_MAILADDRESS>" && \
git config --global core.quotepath false && \
git config --global core.safecrlf true && \
git config --global core.autocrlf false && \
git config --global core.editor 'vim -c "set fenc=utf-8"' && \
git config --global color.diff auto && \
git config --global color.status auto && \
git config --global color.branch auto && \
git config --global fetch.prune true && \
git config --global init.defaultBranch main && \
git config pull.ff only

SSH Key for GitHub

Fine-grained personal access tokens

ssh-keygen

ssh-keygen -t ed25519 -C 'mail address for github'
cat $HOME/.ssh/id_ed25519.pub | clip.exe

SSH Keys on GitHub

GPG Key for GitHub

Generate GPG Key

gpg --gen-key
gpg (GnuPG) 2.4.4; Copyright (C) 2024 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: <GITHUB_USER_NAME>
Email address: <GITHUB_EMAIL_ADDRESS>
You selected this USER-ID:
    "YOUR_NAME <YOUR_EMAIL_ADDRESS>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? O

Confirm your GPG Key

gpg --list-secret-keys --keyid-format LONG
-----------------------------------------
sec   rsa4096 2022-03-21 [SC] [expires: 2024-03-20]
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
uid           [ ultimate ] <user@example.com>
ssb   rsa4096 2022-03-21 [E] [expires: 2024-03-20]

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX is your GPG Key

Configure GPG Key to Git

git config --global gpg.program gpg
git config --global user.signingkey <GPG Key>
git config --global commit.gpgsign true

Add new GPG key

Add new GPG Key

gpg --export --armor <YOUR_EMAI_ADDRESS_FOR_GPGKEY> | clip.exe

GPG Key on GitHub

Commit with GPG Signature

git commit -S -m 'YOUR_COMMIT_MESSAGE'

Confirmation of your Commits with GPG Signature

You can find verified on your commit.

Image

2. WSL Customization

WSL

Update and Upgrade packages.

sudo apt update && sudo apt upgrade
brew update && brew upgrade

Requred Packages Installation

Basic Packages

brew install zip unzip

Fontconfig

Fontconfig is a library designed to provide system-wide font configuration, customization and application access.

sudo apt-get install fontconfig

wslu

This is a collection of utilities for the Windows Subsystem for Linux (WSL), such as converting Linux paths to Windows paths or creating Linux application shortcuts on the Windows Desktop.

sudo apt-get install wslu

Commands list:

dpkg -L wslu | grep bin/

Git

Git Alias

List aliases:

git config --get-regexp ^alias\.

Alias for Alias list

git config --global alias.alias 'config --get-regexp ^alias\.'

git status

git config --global alias.st 'status --verbose --short --branch --untracked-files'

git log

git config --global alias.plog "log --pretty='format:%C(yellow)%h %C(green)%cd %C(reset)%s %C(red)%d %C(cyan)[%an]' --date=iso"
git config --global alias.glog "log --pretty='format:%C(yellow)%h %C(green)%cd %C(reset)%s %C(red)%d %C(cyan)[%an]' --date=format:'%c' --all --graph"

Commit Count

git config --global alias.count 'shortlog -e -s -n'

GitHub CLI

GitHub CLI, or gh, is a command-line interface to GitHub for use in your terminal or your scripts.

brew install gh
gh --version

gh version 2.48.0 (2024-04-17)
https://github.com/cli/cli/releases/tag/v2.48.0

GitHub Authentication

gh auth login

? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations on this host? SSH
? Upload your SSH public key to your GitHub account? $HOME/.ssh/id_ed25519.pub
? Title for your SSH key: GitHub CLI
? How would you like to authenticate GitHub CLI? Login with a web browser

Text editor program to use for authoring text

gh config set editor vim

GitHub Copilot in the CLI

GitHub Copilot in the CLI is an extension for GitHub CLI which provides a chat-like interface in the terminal that allows you to ask questions about commands you run from the command line.

If you are have not authenticated with your GitHub account, login.

gh auth login

Install the Copilot in the CLI extension

gh extension install github/gh-copilot

Update Copilot in the CLI

gh extension upgrade gh-copilot
[copilot]: upgraded from v1.0.1 to v1.0.2
✓ Successfully upgraded extension

Explain a command

You can ask Copilot in the CLI to explain a command

gh copilot explain

? Which command would you like to explain?
> apt-get

Explanation:

  • apt-get is the package management command-line tool for Debian-based systems.
    • It is used to install, upgrade, and remove software packages.
    • Commonly used flags include:
      • install is used to install packages.
      • remove is used to remove packages.
      • update is used to update package lists from repositories.
      • upgrade is used to upgrade installed packages to their latest versions.
      • search is used to search for packages based on keywords.
      • show is used to display detailed information about a specific package.
      • upgrade is used to upgrade installed packages to their latest versions.
      • dist-upgrade is used to perform a distribution upgrade, including installing and removing packages as
      necessary.
      • autoremove is used to remove automatically installed packages that are no longer needed.
      • clean is used to remove downloaded package files from the package cache.
      • purge is used to remove packages and their configuration files.
    • For more information and usage examples, refer to the apt-get manual page by running man apt-get.

Alternatively, you can add the command you want explained directly to the prompt:

gh copilot explain 'apt-get'

Suggest a command

gh copilot suggest "Upgrade apt-get itself"
? What kind of command can I help you with?
> generic shell command

Suggestion:

  sudo apt-get update && sudo apt-get upgrade -y

? Select an option  [Use arrows to move, type to filter]
> Copy command to clipboard
  Explain command
  Execute command
  Revise command
  Rate response
  Exit

Fish

Fish, or the "Friendly Interactive SHell", is a Unix shell designed with an emphasis on user-friendliness and interactive use. It was introduced in 2005 and has since gained a following due to its unique features, helpful defaults, and focus on a pleasant user experience.

image

Fish Install

brew install fish
fish --version

fish, version 3.7.1

Check the PATH for fish.

which fish

/home/linuxbrew/.linuxbrew/bin/fish

Write the PATH for fish to define the valid shell.

sudo sh -c "echo /home/linuxbrew/.linuxbrew/bin/fish >> /etc/shells"

Define fish as a Default Shell.

chsh -s /home/linuxbrew/.linuxbrew/bin/fish

Reboot WSL and check fish.

echo $SHELL

Define the PATH of brew on fish.

echo 'eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> $HOME/.config/fish/config.fish

Restart Terminal

Check brew doctor.

brew doctor

Fisher

Fisher is a plugin manager for the Fish shell. It lets you install, update, and remove plugins like a boss. You can take control of functions, completions, bindings, and snippets from the command line. Fisher's zero impact on shell startup keeps your shell zippy and responsive1. Fisher is 100% pure-Fish, making it easy to contribute or modify.

curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
fisher -v
fisher, version 4.4.4

Fish Prompt - Tide

tide

The ultimate Fish prompt.

fisher install IlanCosman/tide@v6
tide configure --auto --style=Rainbow --prompt_colors='True color' --show_time='12-hour format' --rainbow_prompt_separators=Round --powerline_prompt_heads=Round --powerline_prompt_tails=Round --powerline_prompt_style='Two lines, character and frame' --prompt_connection=Disconnected --powerline_right_prompt_frame=Yes --prompt_connection_andor_frame_color=Darkest --prompt_spacing=Sparse --icons='Many icons' --transient=Yes

Fish Theme - bobthefish

If you install tide, you can't install bobthefish

fisher install oh-my-fish/theme-bobthefish

bobthefish Configuration

vim $HOME/.config/fish/config.fish

set -g theme_display_git_master_branch yes
set -g theme_display_git yes
set -g theme_display_git_dirty yes
set -g theme_display_git_untracked yes
set -g theme_display_git_ahead_verbose yes
set -g theme_display_git_dirty_verbose yes
set -g theme_display_git_stashed_verbose yes
set -g theme_git_worktree_support no
set -g theme_use_abbreviated_branch_name no

set -g theme_display_vagrant no
set -g theme_display_docker_machine no
set -g theme_display_k8s_context no
set -g theme_display_hg no
set -g theme_display_virtualenv no
set -g theme_display_nix no
set -g theme_display_ruby no
set -g theme_display_nvm no
set -g theme_display_user ssh
set -g theme_display_hostname ssh
set -g theme_display_vi no
set -g theme_display_date yes
set -g theme_display_cmd_duration yes

set -g theme_title_display_process no
set -g theme_title_display_path yes
set -g theme_title_display_user no
set -g theme_title_use_abbreviated_path no

set -g theme_date_format "+%F %H:%M"
set -g theme_date_timezone Asia/Tokyo
set -g theme_avoid_ambiguous_glyphs yes
set -g theme_powerline_fonts yes
set -g theme_nerd_fonts no
set -g theme_show_exit_status yes
set -g theme_display_jobs_verbose yes
set -g default_user your_normal_user
set -g theme_color_scheme loght
set -g fish_prompt_pwd_dir_length 0
set -g theme_project_dir_length 1
set -g theme_newline_cursor yes
set -g theme_newline_prompt ''

Moralerspace font

image
mkdir download && cd download
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceHWJPDOC_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceHWNF_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceHW_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceJPDOC_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/MoralerspaceNF_v1.0.0.zip
curl -L -O https://github.com/yuru7/moralerspace/releases/download/v1.0.0/Moralerspace_v1.0.0.zip
unzip MoralerspaceHWJPDOC_v1.0.0.zip
unzip MoralerspaceHWNF_v1.0.0.zip
unzip MoralerspaceHW_v1.0.0.zip
unzip MoralerspaceJPDOC_v1.0.0.zip
unzip MoralerspaceNF_v1.0.0.zip
unzip Moralerspace_v1.0.0.zip
sudo mkdir  /usr/share/fonts/truetype/moralerspace
sudo cp MoralerspaceHWJPDOC_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp MoralerspaceHWNF_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp MoralerspaceHW_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp MoralerspaceJPDOC_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp MoralerspaceNF_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo cp Moralerspace_v1.0.0/*.ttf /usr/share/fonts/truetype/moralerspace/
sudo fc-cache -vf
fc-list | grep -i moralerspace
explorer.exe .

Then install *ttf.

Then delete downloaded fonts.

cd ..
rm -fr download

Setting font for Terminal

  1. Open settings: ctrl + ,
  2. Select Ubuntu 24.04 LTS
  3. Select Aditional settings > Appearance
  4. Choose Moralerspace Radon NF from Font face

Cica font

Custome Functions for Fish

Clear Cahaces

Clear Caches and turn off and on Swap aria

function clearCaches
    sudo sh -c "echo 3 > '/proc/sys/vm/drop_caches' && swapoff -a && swapon -a"
end
funcsave clearCaches

Confirl a persisntent file

ls -l ~/.config/fish/functions/clearCaches.fish

Fish Plugin

Peco

Simplistic interactive filtering tool

By pushing ctrl + r, you can search shell history

brew install peco
fisher install oh-my-fish/plugin-peco
abbr -a history peco_select_history

fzf

fzf

fzf is a general-purpose command-line fuzzy finder.

brew install fzf

bat

A cat(1) clone with syntax highlighting and Git integration.

brew install bat

fd

fd is a program to find entries in your filesystem. It is a simple, fast and user-friendly alternative to find.

brew install fd

fzf for Fish

Augment your Fish command line with mnemonic key bindings to efficiently find what you need using fzf. Use fzf.fish to interactively find and insert file paths, git commit hashes, and other entities into your command line. Tab to select multiple entries. If you trigger a search while your cursor is on a word, that word will be used to seed the fzf query and will be replaced by your selection. All searches include a preview of the entity hovered over to help you find what you're looking for.

fisher install PatrickF1/fzf.fish

echo "### fzf.fish" | tee -a $HOME/.config/fish/config.fish
echo "fzf_configure_bindings --directory=\cf --git_log=\cl --git_status=\cs" | tee -a $HOME/.config/fish/config.fish
echo "" | tee -a $HOME/.config/fish/config.fish
Key bind Description
Ctrl+r Command history
Ctrl+Alt+v Environment variables
Ctrl+Alt+f Recursive listing
Ctrl+Alt+s git status
Ctrl+Alt+l git log

z

By z, it tracks the directory you have visited

fisher install jethrokuan/z

fish-bd

By bd, you can quickly go back to a parent directory in your current working directory tree

fisher install 0rax/fish-bd

fish_logo

This plugin adds a function to print out the fish-shell ASCII-art logo.

fishlogo

fisher install laughedelic/fish_logo

The description in fish_greeting.fish is executed when you log in to fish.

vim $HOME/.config/fish/functions/fish_greeting.fish

Add the followings:

# fish_logo
echo "Hello $(whoami) at $(date)"
fish -v
fisher -v
fish_logo blue cyan green

SDKMAN! for fish

sdkman

SDKMAN with Homebrew

brew tap SDKMAN/tap
brew install SDKMAN-cli

SDKMAN for Fish extension

Makes command sdk from SDKMAN! usable from fish, including auto-completion. Also adds binaries from installed SDKs to the PATH.

fisher install reitzig/sdkman-for-fish@v2.1.0

sdk
You don't seem to have SDKMAN! installed. Install now? [y/N] y

And then open a new terminal/shell to load SDKMAN!.

sdk version

SDKMAN!
script: 5.18.2
native: 0.4.6

Fish Completion

abbr

abbr - manage fish abbreviations

curl https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/abbr.fish > $HOME/.config/fish/completions/abbr.fish

apt-get

apt-get - APT package handling utility -- command-line interface

curl https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/apt-get.fish > $HOME/.config/fish/completions/apt-get.fish

bd

bd - Quickly go back to a parent directory up in your current working directory tree

curl https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/bd.fish > $HOME/.config/fish/completions/bd.fish

code

code - Visual Studio Code

curl https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/code.fish > $HOME/.config/fish/completions/code.fish

curl

curl - transfer a URL

curl https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/curl.fish > $HOME/.config/fish/completions/curl.fish

git

git - the stupid content tracker

curl https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/git.fish > $HOME/.config/fish/completions/git.fish

gh

gh - gh - GitHub CLI

curl https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/gh.fish > $HOME/.config/fish/completions/gh.fish

docker

After Docker installation, you can do the following:

docker completion fish > $HOME/.config/fish/completions/docker.fish

Docker

Image

Docker Desktop for Windows

winget search docker
winget install Docker.DockerDesktop

Docker Engine for Ubuntu

Uninstall old versions

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; sudo apt-get remove $pkg; end

Set up Docker's apt repository

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
set arch (dpkg --print-architecture)
set codename (awk -F= '/VERSION_CODENAME/ {print $2}' /etc/os-release | tr -d '"')
echo "deb [arch=$arch signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $codename stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Install the Docker packages

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Manage Docker as a non-root user

The Docker daemon binds to a Unix socket, not a TCP port. By default it's the root user that owns the Unix socket, and other users can only access it using sudo. The Docker daemon always runs as the root user. If you don't want to preface the docker command with sudo, create a Unix group called docker and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group.

sudo usermod -aG docker $USER

Reboot your WSL by PowerShell.

wsl --shutdown

Activate the changes to groups

newgrp docker

Check Docker Service running by Systemd

systemctl list-units --type=service --all

or

systemctl list-units --type=service --state=active

You can see like the below:

  :
  dmesg.service                                          loaded    inactive dead    Save initial kernel messages af>
  docker.service                                         loaded    active   running Docker Application Container En>
  dpkg-db-backup.service                                 loaded    inactive dead    Daily dpkg database backup serv>
  :

Shutdown Docker Service

sudo systemctl stop docker

Start Docker Service

sudo systemctl start docker

Abbreviation for Fish

abbr: manage fish abbreviations

abbr --add NAME [--position command | anywhere] [-r | --regex PATTERN]
                [--set-cursor[=MARKER]] ([-f | --function FUNCTION] | EXPANSION)
abbr --erase NAME ...
abbr --rename OLD_WORD NEW_WORD
abbr --show
abbr --list
abbr --query NAME ...

Add abbreviated commands

vim $HOME/.config/fish/config.fish
function set_abbr
    abbr --add code     code-insiders
    abbr --add history  peco_select_history
    abbr --add l        ls -lahF
    abbr --add ga       git add -v
    abbr --add gc       git commit -S -m
    abbr --add gcpast   git commit -S --date=format:relative:1.day.ago -m
    abbr --add copilot  gh copilot suggest
end

if status is-interactive
    # Commands to run in interactive sessions can go here
    set_abbr
end

3. Terminal Customization

Startup

Interaction

Appearance

Ubuntu - Appearance

4. Visual Studio Code

! vscode

Visual Studio Code, often referred to as VSCode, is a free and open-source code editor optimized for building and debugging modern web and cloud applications. It supports various programming languages and comes with features like IntelliSense for smart completions based on variable types, function definitions, and imported modules, built-in Git commands, and debugging tools. It's highly customizable and extensible with various extensions. It's available on multiple platforms including Linux, macOS, and Windows.

Visual Studioc Code on Windows

winget search VisualStudioCode
winget install Microsoft.VisualStudioCode.Insiders

Visual Studioc Code on Ubuntu with Windows Subsystem for Linux (WSL)

snap find vscode
sudo snap install code-insiders --classic

The following abbreviation is added to config.fish

abbr --add code 'code-insiders'

VSCode Extension

Remote Development

The Remote Development extension pack allows you to open any folder in a container, on a remote machine, or in the Windows Subsystem for Linux (WSL) and take advantage of VS Code's full feature set. Since this lets you set up a full-time development environment anywhere.

sudo apt-get install wget ca-certificates

The following extesions are also installed:

GitHub Copilot

GitHub Copilot provides autocomplete-style suggestions from an AI pair programmer as you code. You can receive suggestions from GitHub Copilot either by starting to write the code you want to use, or by writing a natural language comment describing what you want the code to do.

The folloing extention is installed:

Use ctrl + i to open incline chat. Type / to view all available chat commands.

Docker for Visual Studio Code

The Docker extension makes it easy to build, manage, and deploy containerized applications from Visual Studio Code. It also provides one-click debugging of Node.js, Python, and .NET inside a container.

Text Editor

Settings - Everything starts from Ctrl + ,

Mouse Wheel Zoom

Zoom the font of the editor when using mouse wheel and holding Ctrl

Reset Editor Font Size

Ctrl + Shift + p and choose Reset Editor Font Size

Render Control Characters

Controls whether the editor should render control characters.

Render Line Highlight

Controls how the editor render the current line highlight

Text Editor - Cursor

Cursor Blinking

Control the cursor animation style

Cursor Smooth Caret Animation

Control whether the sooth caret animation be enabled.

Cursor Style

Control the cursor style

Text Editor - Formatting

Format On Paste

Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.

Format On Type

Controls whether the editor should automatically format the line after typing.

Text Editor - Minimap

Enabled

Controls whether the minimap is shown.

Text Editor - Files

Insert Final Newline

When Enabled, insert a final new line at the end of the file saving it.

Trim Trailing Whitespace

When enabled, will trim trailing whitespace when saving a file.

Workbench - Appearance

Color Theme

Specifies the color theme used in the workbench when Window

Workbench - Zen Mode

Center Layout

Controls whether turning on Zen Mode also centers the layout.

Hide Line Numbers

Controls whether turning on Zen Mode also hides the editor line numbers.

Hide Status Bar

Controls whether turning on Zen Mode also hides the status bar at the bottom of the workbench.

Profile

VS Code profiles provide a way to organize and isolate customizations within the editor. A profile represents a specific set of configurations that can be easily activated or deactivated. With profiles, users can maintain separate configurations for different projects or teams, to help ensure a seamless transition between development environments.

Create Profile

create-profile

5. Microsoft Azure

azure

Azure CLI

Install on Linux(WSL2)

You can install Azure CLI by Homebrew.

brew update && brew install azure-cli
az version
{
  "azure-cli": "2.60.0",
  "azure-cli-core": "2.60.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {}
}

Install on Windows

You can install Azure CLI by winget on PowerShell.

winget install -e --id Microsoft.AzureCLI

Sign in interactively

az login

Azure CLI Help

az -h
Azure CLI Help ```shell Group az Subgroups: account : Manage Azure subscription information. acr : Manage private registries with Azure Container Registries. ad : Manage Microsoft Entra ID (formerly known as Azure Active Directory, Azure AD, AAD) entities needed for Azure role-based access control (Azure RBAC) through Microsoft Graph API. advisor : Manage Azure Advisor. afd : Manage Azure Front Door Standard/Premium. aks : Manage Azure Kubernetes Services. ams : Manage Azure Media Services resources. apim : Manage Azure API Management services. appconfig : Manage App Configurations. appservice : Manage App Service plans. aro : Manage Azure Red Hat OpenShift clusters. backup : Manage Azure Backups. batch : Manage Azure Batch. bicep : Bicep CLI command group. billing : Manage Azure Billing. bot : Manage Microsoft Azure Bot Service. cache : Commands to manage CLI objects cached using the `--defer` argument. capacity : Manage capacity. cdn : Manage Azure Content Delivery Networks (CDNs). cloud : Manage registered Azure clouds. cognitiveservices : Manage Azure Cognitive Services accounts. config [Experimental] : Manage Azure CLI configuration. connection : Commands to manage Service Connector local connections which allow local environment to connect Azure Resource. If you want to manage connection for compute service, please run 'az webapp/containerapp/spring connection'. consumption [Preview] : Manage consumption of Azure resources. container : Manage Azure Container Instances. containerapp : Manage Azure Container Apps. cosmosdb : Manage Azure Cosmos DB database accounts. databoxedge [Preview] : Manage device with databoxedge. deployment : Manage Azure Resource Manager template deployment at subscription scope. deployment-scripts : Manage deployment scripts at subscription or resource group scope. disk : Manage Azure Managed Disks. disk-access : Manage disk access resources. disk-encryption-set : Disk Encryption Set resource. dla [Preview] : Manage Data Lake Analytics accounts, jobs, and catalogs. dls [Preview] : Manage Data Lake Store accounts and filesystems. dms : Manage Azure Data Migration Service (classic) instances. eventgrid : Manage Azure Event Grid topics, domains, domain topics, system topics partner topics, event subscriptions, system topic event subscriptions and partner topic event subscriptions. eventhubs : Eventhubs. extension : Manage and update CLI extensions. feature : Manage resource provider features. functionapp : Manage function apps. To install the Azure Functions Core tools see https://github.com/Azure/azure-functions-core-tools. group : Manage resource groups and template deployments. hdinsight : Manage HDInsight resources. identity : Managed Identities. image : Manage custom virtual machine images. iot : Manage Internet of Things (IoT) assets. keyvault : Manage KeyVault keys, secrets, and certificates. kusto : Manage Azure Kusto resources. lab [Preview] : Manage Azure DevTest Labs. lock : Manage Azure locks. logicapp : Manage logic apps. managed-cassandra : Azure Managed Cassandra. managedapp : Manage template solutions provided and maintained by Independent Software Vendors (ISVs). managedservices : Manage the registration assignments and definitions in Azure. maps : Manage Azure Maps. mariadb : Manage Azure Database for MariaDB servers. monitor : Manage the Azure Monitor Service. mysql : Manage Azure Database for MySQL servers. netappfiles : Manage Azure NetApp Files (ANF) Resources. network : Manage Azure Network resources. policy : Manage resource policies. postgres : Manage Azure Database for PostgreSQL servers. ppg : Manage Proximity Placement Groups. private-link : Private-link association CLI command group. provider : Manage resource providers. redis : Manage dedicated Redis caches for your Azure applications. relay : Manage Azure Relay Service namespaces, WCF relays, hybrid connections, and rules. resource : Manage Azure resources. resourcemanagement : Resourcemanagement CLI command group. restore-point : Manage restore point with res. role : Manage Azure role-based access control (Azure RBAC). search : Manage Azure Search services, admin keys and query keys. security : Manage your security posture with Microsoft Defender for Cloud. servicebus : Servicebus. sf : Manage and administer Azure Service Fabric clusters. sig : Manage shared image gallery. signalr : Manage Azure SignalR Service. snapshot : Manage point-in-time copies of managed disks, native blobs, or other snapshots. sql : Manage Azure SQL Databases and Data Warehouses. sshkey : Manage ssh public key with vm. stack : A deployment stack is a native Azure resource type that enables you to perform operations on a resource collection as an atomic unit. staticwebapp : Manage static apps. storage : Manage Azure Cloud Storage resources. synapse : Manage and operate Synapse Workspace, Spark Pool, SQL Pool. tag : Tag Management on a resource. term [Experimental] : Manage marketplace agreement with marketplaceordering. ts : Manage template specs at subscription or resource group scope. vm : Manage Linux or Windows virtual machines. vmss : Manage groupings of virtual machines in an Azure Virtual Machine Scale Set (VMSS). webapp : Manage web apps. Commands: configure : Manage Azure CLI configuration. This command is interactive. feedback : Send feedback to the Azure CLI Team. find : I'm an AI robot, my advice is based on our Azure documentation as well as the usage patterns of Azure CLI and Azure ARM users. Using me improves Azure products and documentation. interactive [Preview] : Start interactive mode. Installs the Interactive extension if not installed already. login : Log in to Azure. logout : Log out to remove access to Azure subscriptions. rest : Invoke a custom request. survey : Take Azure CLI survey. upgrade [Preview] : Upgrade Azure CLI and extensions. version : Show the versions of Azure CLI modules and extensions in JSON format by default or format configured by --output. To search AI knowledge base for examples, use: az find "az " ```

Getting Started with Azure CLI

az login

You check your subscription at the folloing and set it to Azure CLI

az account set --subscription "<YOUR_SUBSCRIPTION_NAME>"

Microsoft Dev Box

Image

Install the Dev Center extension

az extension add --name devcenter --allow-preview true
az extension list

Azure Spring Apps

6. Development Environment on Dev containers

devcontainers

Java

This Dev Container consists of the following three files:

Dockerfile

This file is used to build the container image that will contain your development environment. It specifies the base image, installs necessary dependencies, sets up the environment, and copies any project-specific files into the container. The Dockerfile is essential for defining the environment's infrastructure and dependencies.

FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye
USER vscode
WORKDIR /workspace

If you want a base image which Microsoft pre-built, you can find it at the following:

compose.yaml

Docker Compose is a tool for defining and running multi-container Docker applications. The compose.yaml file defines services, networks, and volumes for your application's containers. While not strictly required for every Dev Container setup, it can be useful for defining more complex development environments with multiple services or containers that need to interact with each other.

services:
  playground-java:
    container_name: 'playground'
    hostname: 'java'
    build:
      context: .
      dockerfile: Dockerfile
    restart: always
    working_dir: '/workspace'
    tty: true
    volumes:
      - type: bind
        source: ../workspace
        target: /workspace

Explanation

services:
  playground-java:
    container_name: 'playground'
    hostname: 'java'
    build:
      context: .
      dockerfile: Dockerfile
    restart: always
    working_dir: '/workspace'
    tty: true
    volumes:
      - type: bind
        source: ../workspace
        target: /workspace

devcontainer.json

The devcontainer.json file configures how VS Code connects to and interacts with the Dev Container, including settings for extensions, environment variables, mount points, and more.

{
    "name": "Playground - Java",
    "dockerComposeFile": "compose.yaml",
    "service": "playground-java",
    "workspaceFolder": "/workspace",
    "remoteUser": "vscode",
    "features": {
        "ghcr.io/devcontainers/features/java:1": {
            "version": "none",
            "installMaven": "false",
            "installGradle": "true"
        }
    },
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-azuretools.vscode-docker",
                "redhat.java",
                "vscjava.vscode-java-debug",
                "vscjava.vscode-java-dependency",
                "vscjava.vscode-java-test",
                "vscjava.vscode-maven",
                "SonarSource.sonarlint-vscode",
                "vmware.vscode-boot-dev-pack",
                "MicroProfile-Community.vscode-microprofile-pack",
                "redhat.vscode-quarkus"
            ],
            "settings": {
                "editor.formatOnSave": true,
                "workbench.colorCustomizations": {
                    "titleBar.activeBackground": "#19549C",
                    "titleBar.activeForeground": "#ffffff",
                    "activityBar.background": "#02A7E3",
                    "activityBar.foreground": "#ffffff"
                }
            }
        }
    }
    // "forwardPorts": [],
    // "postCreateCommand": "java -version"
}

Explanation

{
    "name": "Playground - Java",
  "dockerComposeFile": "compose.yaml",
    "service": "playground-java",
    "workspaceFolder": "/workspace",
    "remoteUser": "vscode",
    "features": {
        "ghcr.io/devcontainers/features/java:1": {
            "version": "none",
            "installMaven": "false",
            "installGradle": "true"
        }
    },
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-azuretools.vscode-docker"
            ],
            "settings": {
                "editor.formatOnSave": true,
                "workbench.colorCustomizations": {
                    "titleBar.activeBackground": "#19549C",
                    "titleBar.activeForeground": "#ffffff",
                    "activityBar.background": "#02A7E3",
                    "activityBar.foreground": "#ffffff"
                }
            }
        }
    }
forwardPorts

The forwardPorts setting in the devcontainer.json file is used to specify port forwarding rules from the Dev Container to the local machine, allowing you to access services running inside the container from your local environment. This can be useful when you're running services or applications inside the Dev Container that need to be accessed from outside the container, such as web servers, APIs, or databases.

Here's example of the forwardPorts setting:

"forwardPorts": [3000, 8080]

This example would forward ports 3000 and 8080 from the Dev Container to the local machine. So if there's a web server running inside the Dev Container on port 3000, you could access it from your local browser at http://localhost:3000.

You would typically set the forwardPorts setting when you're developing applications or services that need to be accessible from your local environment but are running inside a container. It's especially useful for web development, where you might have a web server running inside the container serving your application, and you want to test it locally in your browser.

postCreateCommand

The postCreateCommand setting in the devcontainer.json file is used to specify a command that should be executed after the Dev Container is created. This command runs once, immediately after the container is created but before it is started.

You might use the postCreateCommand setting for various purposes, such as:

  1. Setting up the development environment: You could use this command to perform additional setup steps required for your development environment after the container is created. For example, you might install additional tools or dependencies, initialize databases, or set up configuration files.

  2. Running initialization scripts: If your project requires specific initialization scripts to be executed before development can begin, you can specify these scripts as the postCreateCommand. This could include running database migrations, setting up test data, or performing any other necessary setup tasks.

  3. Customizing the container environment: You could use the postCreateCommand to customize the container environment based on specific project requirements. This might involve configuring system settings, setting environment variables, or performing any other customizations needed for your project.

Here's an example of how you might set the postCreateCommand in the devcontainer.json file:

"postCreateCommand": "git fetch origin && git diff origin/main"

In this example, this command sequence would execute git fetch origin to fetch the latest changes from the remote repository and then run git diff origin/main to compare the local branch with the main branch on the remote repository.

Overall, the postCreateCommand setting allows you to automate additional setup steps or customization tasks that need to be performed after the Dev Container is created, helping to streamline the development environment setup process for your project.

Recommended VS Code Extensions

I recommend the following Visual Studio Code Extensions for Java Development:

redhat.java

vscjava.vscode-java-debug

vscjava.vscode-java-dependency

vscjava.vscode-java-test

vscjava.vscode-maven

SonarSource.sonarlint-vscode

vmware.vscode-boot-dev-pack

MicroProfile-Community.vscode-microprofile-pack

redhat.vscode-quarkus

Kotlin

Rust

TypeScript

Python

Dev Container CLI

Install Dev Container CLI.

  1. Open VSCode
  2. Select the Dev Containers: Install devcontainer CLI command from the Command Palette (F1).

Docker for Visual Studio Code

The Docker extension makes it easy to build, manage, and deploy containerized applications from Visual Studio Code. It also provides one-click debugging of Node.js, Python, and .NET inside a container.

Azure CLI

The Azure command-line interface (Azure CLI) is a set of commands used to create and manage Azure resources. The Azure CLI is available across Azure services and is designed to get you working quickly with Azure, with an emphasis on automation.

brew update && brew install azure-cli

etc

Python

pyenv

Simple Python Version Management: pyenv

pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.

brew install pyenv

Python

List all available versions.

pyenv install --list

Install Python latest version (as of Jan 9, 2024)

pyenv install 3.12.1

If you failed the build, you should run the following command.

brew unlink pkg-config
# brew link pkg-config
brew reinstall pkg-config

Set up the fish shell for Python

vim ~/.config/fish/config.fish
### Python
set -Ux PYENV_ROOT $HOME/.pyenv
fish_add_path $PYENV_ROOT/bin
pyenv init - | source
source $HOME/.config/fish/config.fish
pyenv global 3.12.1
python --version

Python 3.12.1

X. Virtual Machine Environment with Multipass

Multipass

Get an instant Ubuntu VM with a single command. Multipass can launch and run virtual machines and configure them with cloud-init like a public cloud.

winget search multipass
winget install Canonical.Multipass
> multipass --version
multipass   1.13.1+win
multipassd  1.13.1+win

VM for MicroK8s

2. Windows Tools

OBS Studio

obs

OBS Studio is a free and open-source software for video recording and live streaming.

winget search obs
winget install OBSProject.OBSStudio

DaVinci Resolve 19

davinci

DaVinci Resolve 19 is a professional video editing software that includes everything professional editors need to cut blockbuster films, television shows, and commercials.

ShurePlus MOTIV

shure

ShurePlus MOTIV is a free app that allows users to record high-quality audio with their MOTIV microphones and make real-time adjustments to gain, stereo width, equalization, and compression.

winget search shure
winget install Shure.ShurePlusMOTIV

Obsidian

It's a note-taking and knowledge base app that uses a local folder of plain text files to store notes and allows users to easily link notes together and build a network of knowledge.

winget search obsidian
winget install Obsidian.Obsidian

Steam

winget install Valve.Steam

Git for Windows

winget install --id Git.Git -e --source winget

Slack

Slack is a messaging app for businesses that connects people to the information they need. It allows people to work as one unified team, transforming the way organizations communicate.

winget search slack
winget install slacktechnologies.slack

JDownloader 2

JDownloader is a free, open-source download management tool with a huge community that makes downloading as easy and fast as it should be.

winget search jdownloader
winget install AppWork.JDownloader

Streamlabs Desktop

Streamlabs Desktop has everything you need to stream and create a memorable brand.

winget search streamlabs
winget install Streamlabs.Streamlabs

Spotify

Play your favorite songs, podcasts and albums free on Windows with Spotify.

winget search spotify
winget install Spotify.Spotify

Zoom

winget search zoom
winget install Zoom.Zoom

Google Chrome

winget search chrome
winget install Google.Chrome

QuickLook

One of the few features I missed from macOS is Quick Look. It allows users to peek into a file content in lightning speed by just pressing the Space key.

winget search QuickLook
winget install QL-Win.QuickLook

Rufus

Create bootable USB drives the easy way

winget install Rufus.Rufus

FastCopy

winget search fastcopy
winget install FastCopy.FastCopy

Anki

Anki is a program which makes remembering things easy.

winget search anki
winget install Anki.Anki

ShurePlus MOTIV

Adjust mic gain, monitor mix, EQ, limiter, compressor and more. MV7 users have the additional option of enabling Auto Level Mode; a ‘set it and forget it’ application for consistent recordings every time.

winget search ankimotiv
winget install Shure.ShurePlusMOTIV

PowerToys

Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity.

winget install --id Microsoft.PowerToys --source winget