This file contains the Fundamental Software section of my Setup guide for a development machine on Windows. The introduction to this guide as well as its full Table of Contents can be found on the README.md file of this repository. The Table of Contents of this section is listed below.
With Lubuntu I normally choose Firefox as my default browser and on Windows I used to choose Google Chrome. At the moment, I'm also trying to use Firefox on Windows.
Firefox is a cross-platform web browser developed by Mozilla.
To install Firefox, start by downloading the latest version from official downloads page. Then, execute the downloaded file (there will be a prompt for elevated permissions that must be accepted).
Set Google Chrome preferences as desired and then install the following extensions:
- AWS Extend Switch Roles
- ColorZilla
- Firefox Multi-Account Containers
- KeePassXC-Browser
- Omnivore
- Proxy SwitchyOmega
- Raindrop.io
- Tab Session Manager
- Wapplyzer
Set the options of all the above extensions. Use the extensions settings backups/exports stored in the folder %OneDriveCommercial%\dotfiles\browser\extensions
to better customize the relevant extension.
Google Chrome is a cross-platform web browser developed by Google.
To install Google Chrome, start by downloading the latest version from official downloads page. Then, execute the downloaded file (there will be a prompt for elevated permissions that must be accepted).
Set Google Chrome preferences as desired and then install the following extensions:
- AWS Extend Switch Roles
- ColorZilla
- JSON Formatter
- KeePassXC-Browser
- Omnivore
- Proxy SwitchyOmega
- Raindrop.io
- Tab Session Manager
- Wapplyzer
Set the options of all the above extensions. Use the extensions settings backups/exports stored in the folder %OneDriveCommercial%\dotfiles\browser\extensions
to better customize the relevant extension.
Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment directly on Windows.
Follow the Official instructions to manually enable the WSL, executing the upcoming command on a PowerShell console with administrator privileges.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Before restarting the machine, execute the below command on the same PowerShell console to enable the Virtual Machine feature.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Reboot the machine to be able to proceed with the WSL installation.
After rebooting your machine, set WSL 2 as your default version. executing the below command on a standard PowerShell console.
wsl --set-default-version 2
List all available Linux distributions executing the bellow command on a standard PowerShell console.
wsl --list --online
From the output of the above command, get the latest available Ubuntu LTS version and use it to replace the label {DISTRO_NAME} in the upcoming command. Then, execute it on a standard PowerShell console to set the default distribution.
wsl --set-default {DISTRO_NAME}
Replace the label {DISTRO_NAME}, in the upcoming command, with the name of the latest available Ubuntu LTS version and then execute it on a standard PowerShell console to install the latest available Ubuntu LTS version.
wsl --install -d {DISTRO_NAME}
The execution of the above command will require elevation, and therefore, Windows will prompt you to elevate. If you choose not to elevate, the WSL installation will fail.
To update the WSL installation, execute the following command on a standard PowerShell console.
wsl --update
On a regular PowerShell console, execute the below command to list the installed Linux distributions and check if everything is correct:
wsl --list --verbose
If Ubuntu is not running with WSL 2, replace the {LABEL} in the below command as appropriate and execute it on a standard PowerShell console.
wsl --set-version {DISTRO_NAME} 2
Label Definition
- {DISTRO_NAME} : Name of the Linux distribution to be executed with WSL 2
Once the process of installing Ubuntu on WSL is complete, open the distribution using the Start Menu. You will be asked to create a User and Password for your Ubuntu installation.
Configure the settings for your Ubuntu installation by using the wsl.conf
file that is stored on /etc
folder of every WSL distribution. Open the file /etc/wsl.conf
with the nano text editor, executing the below command on a Ubuntu terminal.
nano /etc/wsl.conf
To change the default mount location of the Windows C:\
drive from the default /mnt/c
to /c
, add the upcoming code snippet to the /etc/wsl.conf
file.
[automount]
root=/
Then, to enable systemd support, add the upcoming code snippet to the same /etc/wsl.conf
file.
[boot]
systemd=true
Save the changes with the command CTRL + O
and then exit the nano text editor with the command CTRL + X
.
To enable the changes made on the wsl.conf
file, you will need to to restart your WSL instances. It can be done with the execution of the bellow command on a standard PowerShell console.
wsl --shutdown
You must wait until the subsystem running your Linux distribution completely stops running and restarts for configuration setting updates to appear. This typically takes about 8 seconds after closing ALL instances of the distribution shell. Once Ubuntu restarts, systemd should be running. You can confirm executing the below command on a Ubuntu terminal, which will show the status of your services.
systemctl list-unit-files --type=service
Further WSL configurations can be found on the Microsoft article Advanced settings configuration in WSL.
The article Set up a WSL development environment has some good optional advices to setup a development environment with WSL, but one that is almost mandatory is the installation of the Windows Terminal.
It's recommended to regularly update and upgrade your packages using Ubuntu's package manager. This is done with the following command:
sudo apt update && sudo apt full-upgrade
Additional software can be installed using Ubuntu's package manager, exactly as in any other Ubuntu installation.
To be able to install software from its source code, you need to make sure your system has a C++ compiler. The build-essentials
packages are meta-packages that include all the necessary tools for compiling software. You can install it with the following command:
sudo apt install build-essential
To verify if the build-essentials
installation was properly made, check the output of the following command:
gcc --version
The Windows Terminal is a terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL. Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and custom themes, styles, and configurations.
Open the Microsoft Store and install the Windows Terminal.
A package manager is a software that easily automates the installation, upgradation, and configuration of third-party software or dependencies. Chocolatey and winget are both package managers for Windows software. Nowadays, I prefer winget over Chocolatey because winget can be used to install software from the Microsoft Store.
Windows Package Manager winget command-line tool is available on Windows 11 and modern versions of Windows 10 as a part of the App Installer. To check if winget is available, open a PowerShell console and execute the following command:
winget --version
If winget is already available on your system, the current version of the software will be displayed and now you should make sure it is updated with the latest version.
If you need to install winget, open the Microsoft Store and install the App Installer because that's how winget is distribuited.
Upgrading applications with winget is very easy. To identify which apps are in need of an update, open a PowerShell console and execute the following command:
winget upgrade
The above command will output a list of which app (if any) have an available update. To upgrade all applications with an available update, open a PowerShell console and execute the following command:
winget upgrade --all
When running winget without administrator privileges, some applications may require elevation to install. On those cases, Windows will prompt you to elevate. If you choose not to elevate, the application will fail to install/upgrade.
Check the official documentation to know the full potential of winget.
Scoop installs programs from the command line with a minimal amount of friction as it doesn't require Admin privileges.
To Scoop, open a PowerShell console and execute the following commands:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
To check if everything was properly installed and if further actions are necessary, execute the following command:
scoop checkup
If the above command outputs a warning stating that Windows Developer Mode is not enabled, you should consider enabling it because operations relevant to symlinks may fail without proper rights.
To enable Windows Developer Mode, follow the official instructions.
The output of the command scoop checkup
, might show some recommendations to install some additional packages. If it does, install it using the recommended commands.
To check if all issues were solved with the previous actions, re-run the following command:
scoop checkup
The output of the above command, should now be No problems identified!
.
To list all apps installed with Scoop, execute the following command:
scoop list
If you are going to do your development work on the Windows Native File System
(instead of doing it exclusively on the WSL File System
) you should also install Chocolatey.
Before proceeding with the installation of Chocolatey, you must ensure Get-ExecutionPolicy is not Restricted. The upcoming command, executed on a PowerShell console with Administrator privileges. will output the current execution policy.
Get-ExecutionPolicy
If the output of the above command shows Restricted, then run the following command on the same PowerShell console:
Set-ExecutionPolicy Bypass -Scope Process
Or the preferable upcoming command, for quite a bit more security.
Set-ExecutionPolicy AllSigned
Then, on the same PowerShell console, execute the below command to install Chocolatey.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
To list the installed chocolatey packages, execute the following command on a PowerShell console:
choco list
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is included on the Ubuntu submodule of WSL, therefore, it's not necessary to install it on the WSL File System
.
Git Bash comes included as part of the Git's Windows package and is an application for Microsoft Windows environments which provides an emulation layer for a Git command line experience.
Git, as stated on the official downloads page, can be installed on the Windows Native File System
with winget. To Git, open a PowerShell console and execute the following commands:
winget install --id Git.Git -e --source winget
The above command will start the Git installation wizard that will prompt you with a few questions.
On the Select Start Menu Folder step of the installation program, insert the following text on the input box:
- Development
On the Select Components step of the installation program, make sure that you will only check the following checkboxes:
- Git LFS (Large File Support);
- Associate .git* configuration files with the default text editor;
- Associate .sh files to be run with Bash
- Add a Git Bash Profile for Windows Terminal
- Scalar (Git add-on to manage large-scale repositories)
On the Choosing the default editor used by Git step of the installation program, select the following text editor:
- Nano editor
On the Adjusting the name of the initial branch in new repositories step of the installation program, select the following option:
- Let Git decide
On the Adjusting your PATH environment step of the installation program, select the following option:
- Git from the command line and also from 3rd-party software
On the Choosing the SSH executable step of the installation program, select the following option:
- Use bundled OpenSSH
On the Choosing HTTPS transport backend step of the installation program, select the following option:
- Use the OpenSSL library
On the Configuring the line ending conversions step of the installation program, select the following option:
- Checkout Windows-style, commit Unix-style line endings
On the Configuring the terminal emulator to use with Git Bash step of the installation program, select the following option:
- Use MinTTY (the default terminal of MSYS2)
On the Choose the default behavior of 'git pull' step of the installation program, select the following option:
- Rebase
On the Choose a credential helper step of the installation program, select the following option:
- Git Credential Manager
On the Configuring extra options step of the installation program, check the following checkboxes:
- Enable file system caching
- Enable symbolic links
On the Configuring experimental options step of the installation program, keep all the checkboxes unchecked.
When the installation is complete, configure the Git Bash profile on the Windows Terminal.
The customization of the bash prompt is very personal and the files used to accomplish my personal customization on the WSL File System
are stored at the folder %OneDriveCommercial%\dotfiles\bash-wsl
. To make use of the mentioned files on the bash prompt customization, replace the {LABEL} in the upcoming command as appropriate and then execute it from an Ubuntu terminal.
mkdir -p ~/.bash_"$USER" && cp -r {ONEDRIVE_COMMERCIAL_PATH}/dotfiles/bash-wsl/* ~/.bash_"$USER"
Label Definition
- {ONEDRIVE_COMMERCIAL_PATH} : Path to the folder
%OneDriveCommercial%
Replace the {LABEL} in the upcoming snippet as appropriate and the add it to the file ~/.bashrc
.
# Source the file ~/.bash_{USER}/bash_{USER}.sh to customize the bash shell
#
if [ -f ~/.bash_{USER}/bash_{USER}.sh ]; then
. ~/.bash_{USER}/bash_{USER}.sh
fi
Label Definition
- {USER} : Output of the command
echo "$USER"
After applying the above mentioned changes, save and close the file ~/.bashrc
. To make the changes effective, execute, from the Ubuntu terminal, the following command:
source ~/.bashrc
The files used to accomplish my personal customization on the Windows Native File System
are stored at the folder %OneDriveCommercial%\dotfiles\bash-win
. If a symlink to the folder %OneDriveCommercial%\dotfiles
isn't yet created the Windows %USERPROFILE%
, create executing the below command from the Windows Command Prompt.
mklink /J %USERPROFILE%\.dotfiles "%OneDriveCommercial%\dotfiles"
To edit the file ~/.bashrc
, open it (or create it) with the Nano text editor, executing the below command on a Git Bash terminal:
nano ~/.bashrc
Then, within the file ~/.bashrc
, paste the upcoming snippet and replace the {LABEL} as appropriate.
# Source the file ~/.dotfiles/bash-win/bashrc_{USER}.sh to customize the bash shell
if [ -f ~/.dotfiles/bash-win/bashrc_{USER}.sh ]; then
source ~/.dotfiles/bash-win/bashrc_{USER}.sh
fi
Label Definition
- {USER} : Output of the command
echo "$USER"
After applying the above mentioned changes, save and close the file ~/.bashrc
. To make the changes effective, execute from a Git Bash terminal, the following command:
source ~/.bashrc
To set Git's global configuration, replace the {LABELS} in the below commands as appropriate and then execute it in an Git Bash terminal window.
git config --global core.editor nano
git config --global pull.rebase true
git config --global user.name "{USER_NAME}"
git config --global user.email {USER_EMAIL}
git config --list
Label Definition
- {USER_NAME} : The name of the user
- {USER_EMAIL} : The e-mail of the user
Instructions for a more detailed Git global configuration can be found in the Git's Official Documentation.
The SSH Protocol is very useful to connect and authenticate to remote servers and services. The creation and setup of the SSH keys described here follows the instructions at GitHub.
To check if the system already has an SSH key set, type the following command:
ls -al ~/.ssh
If the output of the above command contains a list of files (by default, the filenames of the public keys are id_dsa.pub, id_ecdsa.pub, id_ed25519.pub or id_rsa.pub), the system already has a SSH key and it can be used.
To create a new SSH key, replace the {LABEL} in the below command as appropriate and then execute it in an Git Bash terminal window.
ssh-keygen -t rsa -b 4096 -C "{EMAIL_ADDRESS}"
Label Definition
- {EMAIL_ADDRESS} : The e-mail address to be used as label for the SSH key
The above command creates a new SSH key, using the provided email as a label.
> Generating public/private rsa key pair.
When prompted to "Enter a file in which to save the key," press Enter to accept the default file location.
> Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
Type a secure passphrase when prompted. GitHub has further instructions on working with SSH key passphrases.
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
To add the new SSH key to the ssh-agent
, start it in the background with the command below.
eval "$(ssh-agent -s)"
The command below will add the private key to the ssh-agent
.
ssh-add ~/.ssh/id_rsa
To be able to copy the public SSH key to the clipboard, display it in a bash terminal window with the following command:
cat ~/.ssh/id_rsa.pub
Copy the output of the above command and then add the public SSH key to the remote servers in use (GitHub, Bitbucket, etc.).
KeePassXC is a cross-platform community-driven port of the Windows application Keepass Password Safe that I choose to use precisely because it's cross-platform and it allows me to use it on every operating system that I work with.
To install KeePassXC, execute the upcoming commands on a PowerShell console.
scoop bucket add extras
scoop install extras/keepassxc
Check if the output of the above last command shows a suggestion to install vcredist2022
. If it does, install it executing the following command on a PowerShell console:
scoop install extras/vcredist2022
Following the execution of the above command, there will be several prompts for elevated permissions which must all be be accepted to complete the installation. A restart of the machine will be necessary to complete the installation but before restarting the machine, check if the output of the installation command states that the vcredist2022
installer can be removed. If it does, after the restart of the machine, execute the following command on a PowerShell console:
scoop uninstall extras/vcredist2022
Move the KeePassXC Start Menu shortcut from the folder C:\Users\rferrcan\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps
to the folder %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Utility
(Create the Utility
folder if it doesn't exits).
Set KeePassXC preferences (Tools->Settings
) as desired but make sure to enable the Browser Integrations
. Then, setup KeePassXC-Browser extension to integrate it with the machine's installation of KeePassXC.