English | 中文
- 🔭 Overview
- ☑ Prerequisites
- 🐧 WSL
- 👨💻 Windows Terminal
- 📝 Git Config
- GitHub CLI Installation
- GitHub CLI Configuration
- 💤 Zsh
- 📦 Node.js
- 💻 Visual Studio Code
- 🍫 Chocolatey
- 🪜 Chrome Extensions
- 🇺🇸 VetsWhoCode Web App
- 🐍 Python
- 💎 Ruby
- Docker
- 📚 References
After a lot of trial and error, I've been able to piece together a pretty respectable Windows dev environment. While there are numerous guides available, I noticed a lack of comprehensive coverage. In this guide, I've aimed to provide a holistic overview without delving too deeply into specific topics, in the hopes of ensuring a seamless developer experience for the majority of users.
- Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11 (Which version do I have?)
- A GitHub account
The first and most important part of setting up your Windows dev environment is installing the Windows Subsystem for Linux (WSL). I recommend sticking with Ubuntu but feel free to try out as many distributions as you like. There are no issues with having multiple distributions installed at once.
WSL 2 is the latest version of WSL, adding new features like a full Linux kernel and full system call compatibility. There used to be a handful of steps needed to install it, but we now only need to enter the following command into PowerShell or Command Prompt:
wsl --install
This command does the following:
- Enables the optional WSL and Virtual Machine Platform components
- Downloads and installs the latest Linux kernel
- Sets WSL 2 as the default
- Downloads and installs the Ubuntu Linux distribution (a reboot may be required)
Using the --install
command defaults to Ubuntu and only works if WSL is not installed yet. If you would like to change your default Linux distribution, follow these docs.
Once the process of installing your Linux distribution with WSL is complete, open the distribution (Ubuntu by default) using the Start menu. You will be asked to create a User Name and Password for your Linux distribution. When you enter your new password, nothing will display in the terminal. Your keyboard is still working! It is just a security feature.
-
This User Name and Password is specific to each separate Linux distribution that you install and has no bearing on your Windows user name.
-
Once you create a User Name and Password, the account will be your default user for the distribution and automatically sign in on launch.
-
This account will be considered the Linux administrator, with the ability to run sudo (Super User Do) administrative commands.
-
Each Linux distribution running on WSL has its own Linux user accounts and passwords. You will have to configure a Linux user account every time you add a distribution, reinstall, or reset.
It is recommended that you regularly update and upgrade your packages. In Ubuntu or Debian, we use the apt
package manager:
sudo apt update && sudo apt upgrade
Windows does not automatically update or upgrade your Linux distribution(s). This is a task that most Linux users prefer to control themselves.
When you open the Windows file explorer, it displays your devices and drives. We are going to add our Ubuntu virtual drive as a network location for easy access.
- Open the
\\wsl$\
location from file explorer:
- Right-click on the Ubuntu folder, and select
Map network drive
:
- Select the drive letter you would like to use, leave
Reconnect at sign-in
checked andConnect using different credentials
unchecked, and then click finish (mine will look slightly different because it's already been done):
- The result should look something like this:
If you wanted to access your Windows files from the Linux terminal, they are found in the /mnt/
directory, so your Windows user directory would be located at /mnt/c/Users/username
.
With your Ubuntu drive mapped, you can easily drag/drop or copy/paste Windows files to the Linux file system by using the file explorer.
However, it is recommended to store your project files on the Linux file system. It will be much faster than accessing files from Windows and it can also be a little buggy.
Another quick tip I have is to create a code directory inside of Ubuntu, and then pin it to the quick access menu found on the left side of the file explorer. This comes in handy when transferring files quickly between Windows and Linux.
- Open File Explorer and click on the Ubuntu network drive we created
- Select the home dir, and then your user directory
- Right-click and create a new folder, name it code, or anything else you'd like
- Drag that new folder to the left, underneath the star icon that says
Quick access
If for some reason WSL stops working, you can restart it with these two commands from PowerShell/Command Prompt:
wsl.exe --shutdown
wsl.exe
If you return to your Linux shell everything should be normal.
To launch a Linux terminal we currently need to use the Ubuntu icon from the Start menu or enter the wsl
or bash
commands into PowerShell/Command Prompt. Another option that will give us more features like tabs, split views, themes, transparency, and key bindings, is to use the Windows Terminal. There are also a few other terminals like Cmder, ConEmu, or Hyper, but in my experience, Windows Terminal works extremely well.
Windows 11 comes with Windows Terminal by default, but If you are using Windows 10, Download and install Windows Terminal through the Microsoft Store.
A few quick things I recommend setting up are the default profile and your starting home directory. These settings make it so launching Windows Terminal will open directly into WSL inside our user's home directory.
Windows Terminal will open a PowerShell or Command Prompt shell when launched by default, here is how to switch it to WSL:
- Select the
˅
icon from Windows Terminal and go to the Settings menu:
- In the Startup section you will find the Default profile dropdown, select Ubuntu. Below it, select Windows Terminal as the Default terminal application:
A default Ubuntu terminal will open to the root directory. To make finding your files a little quicker we can have it open into your home directory instead.
- Under the Profiles section in the settings menu click on Ubuntu
- At the General tab, you will find a Starting directory input
- Enter the following replacing "username" with your Ubuntu user name:
\home\username
- You can leave the
Use parent process directory
box unchecked
There are many more settings to explore, and there is also a JSON file you can edit for more advanced customizations.
Check out this guide for some popular Windows Terminal themes and how to install them.
Git should come pre-installed on most, if not all of the WSL Linux distributions. To ensure you have the latest version, use the following command in an Ubuntu or Debian-based distro:
sudo apt install git
To set up your Git config file, open a WSL command line and set your name with this command (replacing "Your Name" with your preferred username):
git config --global user.name "Your Name"
Set your email with this command (replacing "[email protected]" with the email you prefer):
git config --global user.email "[email protected]"
And finally, add your GitHub username to link it to git (case sensitive!):
git config --global user.username "GitHub username"
Make sure you are inputting user.username
and not user.name
otherwise, you will overwrite your name and you will not be correctly synced to your GitHub account.
You can double-check any of your settings by typing git config --global user.name
and so on. To make any changes just type the necessary command again as in the examples above.
Download binaries from the official source:
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
Once the CLI is installed, run this command to update:
sudo apt update && sudo apt install gh
Enter this command in the terminal:
gh auth login
Follow the prompts to authenticate your GitHub account.
GitHub has removed the ability to use a conventional password when working in a remote repository. You are now required to create a personal access token instead.
Personal access tokens (PATs) are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line.
Follow these docs for step-by-step instructions on creating your personal token.
Once you enter your token the first time, it can be stored via Git Credential Manager (GCM) so you won't have to authenticate yourself each time.
You can have Git installed in WSL and also in Windows at the same time. Git for Windows includes GCM.
You can also download the latest installer for Windows to install the GCM standalone version.
Once Git Credential Manager is installed you can set it up for use with WSL. Open your WSL terminal and enter this command:
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe"
Note:
If you ever receive the following error message:
/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe store: 1:
/mnt/c/Program Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe: not found
Try using this command:
git config --global credential.helper store
Z shell works almost identically to the standard BASH shell found on default Linux installs. What makes it different is its support for plugins and themes, along with some extra features like spelling correction and recursive path expansion. It's time to throw BASH in the trash!
Zsh can be installed with one command:
sudo apt install zsh
After installing, type the zsh
command. Zsh will ask you to choose some configurations. We will do this later on while installing oh-my-zsh, so choose option 0
to create the config file and prevent this message from showing again.
The most popular plugin framework by far is OhMyZsh. It comes preloaded with loads of plugins, themes, helpers, and more. It can help with productivity for sure, but more importantly, it just looks cool 😎.
First off, we need to make sure we have cURL installed. Short for "Client URL", it's a way to transfer data from the command line, and that's how we will download OhMyZsh.
sudo apt install curl
Enter the following command into your terminal to install OhMyZsh:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
That's it! You should now see a .oh-my-zsh
directory inside of your home directory. To change your plugins and themes you will need to edit your .zshrc
file, also found in your home dir.
Here is a list of all the themes and plugins that come bundled with OhMyZsh.
There are countless plugins available, but these are the two I recommend most.
Autosuggestions for zsh, It suggests commands as you type based on history and completions.
- Clone this repository into
$ZSH_CUSTOM/plugins
(by default~/.oh-my-zsh/custom/plugins
)
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- Add the plugin to the list of plugins for Oh My Zsh to load (inside
~/.zshrc
):
plugins=(git zsh-autosuggestions)
- Start a new terminal session.
This package provides syntax highlighting for the shell zsh. It enables the highlighting of commands whilst they are typed at a zsh prompt into an interactive terminal. This helps in reviewing commands before running them, particularly in catching syntax errors.
- Clone this repository in oh-my-zsh's plugins directory:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- Activate the plugin in
~/.zshrc
:
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
- Start a new terminal session.
A huge list of plugins can be found at the awesome zsh plugins repo.
Node.js is a JavaScript runtime environment that executes JavaScript code outside a web browser. It allows us to install packages, run local web servers, create APIs, and more.
You will likely need to switch between multiple versions of Node.js based on the needs of the different projects you're working on. Node Version Manager allows you to quickly install and use different versions of Node via the command line.
- Open your terminal and install NVM with
curl
orwget
:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
To verify installation, enter:
command -v nvm
This should return 'nvm', if you receive 'command not found' or no response at all, close your current terminal, reopen it, and try again.
- List which versions of Node are currently installed (should be none at this point):
nvm ls
This will show Node is not currently installed, and lists all versions available for install.
- Install both the current and stable LTS versions of Node.js.
Install the current stable LTS release of Node.js (recommended for production applications):
nvm install --lts
Install the current release of Node.js (for testing the latest Node.js features and improvements, but more likely to have issues):
nvm install node
- List what versions of Node are installed:
nvm ls
Now you should see the two versions that you just installed listed.
- Verify that Node.js is installed and the current version:
node -v
Then verify that you have NPM installed as well:
npm --version
Use the following commands to change the version of Node you would like to use for any given project:
Switch to the LTS version:
nvm use --lts
You can also use the specific number for any additional versions you've installed:
nvm use v23.1.0
To list all of the versions of Node.js available, use the command: nvm ls-remote
.
Node Package Manager is the default package manager for Node.js. It is a command-line tool used to download or publish packages and manage the dependencies of a project. There is a searchable repository of all available NPM packages at https://www.npmjs.com/.
To list your current installed version of NPM:
npm -v
When creating a new project that will utilize NPM, it must be initialized with the init
command. First, make sure you are in the root directory of your project, and then use the following command:
npm init
npm init
generates a package.json
file and will prompt you for the metadata of your project. This includes things like the name, version, description, and license. You can think of it as the blueprint of your project as it will also contain the packages it depends on. The metadata can be changed at any time by editing the package.json
file after the initialization.
If you would like to automatically populate the initialization with all the default values, you may add the --yes
flag.
npm init --yes
Modules are installed via the npm install
or npm i
command.
npm install react
The above command will install the React module as a dependency in package.json
.
We can also install NPM packages globally on our system. This is useful for utilities like command line interfaces.
Yarn is another widely used node package manager, if we wanted to use it on all our node projects we would need the --global
or -g
flag.
npm install --global yarn
You can save a module as either a dependency or a developer dependency.
A dependency would be something that your project cannot function properly without.
The --save
flag used to be needed to install modules as a dependency, but it is now done automatically with the install
command.
npm install --save gray-matter
Is the same as:
npm install gray-matter
A developer dependency would be the modules used to build the project, not run it. This would include things like linters and testing tools.
Developer dependencies are added with the --save-dev
or -D
flag. This adds the module to the devDependencies
section of package.json
npm install --save-dev husky
Apart from installing a single module, you can install all modules that are listed as dependencies
and devDependencies
:
npm install
This will install all modules listed in the package.json
of your current directory.
If we only wanted to install the dependencies needed to run our project, the --production
flag is used:
npm install --production
the --production
flag will only install the modules from the dependencies
section of package.json
and ignore the devDependencies
. The perk of this is notably reducing the size of the node_modules
folder.
Removing modules works in the same way as installing them. Flags will need to be used for any global or developer dependencies.
Dependencies:
npm uninstall react
Developer Dependencies:
npm uninstall --save-dev husky
Global Installs:
npm uninstall --global yarn
Package versions are identified with major, minor, and patch releases. 8.1.1
would be major version 8, minor version 1, and patch version 1.
You can specify an exact version number by using the @
symbol.
npm install [email protected]
Two more symbols we can use are ^
and ~
.
^
is the latest minor release.
For example, npm install ^8.1.1
specification might install version 8.3.1
if that's the latest minor version.
~
is the latest patch release.
In the same way as minor releases, npm install ~8.1.1
could install version 8.1.6
if that's the latest patch version available.
When using the npm install
or npm i
command, the latest minor version will be used.
The exact package versions will be documented in a generated package-lock.json
file.
The values found inside the dependencies
and devDependencies
objects of the package.json
file include a range of acceptable versions of each package to install.
package-lock.json
is generated by the npm install
command and contains the exact versions of the dependencies used.
package.json
also contains a scripts
property that can be defined to run command-line tools installed on the current project. This can include things like running tests, formatting your code, and launching a local server.
NPM scripts are run by using the run
command. With the above configuration, you would use the following command to have prettier format your code:
npm run format
The keys in the scripts object are the command names and the values are the actual commands.
Check out the official NPM, NVM, and Node.js docs for more in-depth guides.
There are many amazing code editors available for free, but Visual Studio Code our favorite and recommended by VetsWhoCode.
VS Code is available on Windows, macOS, and Linux. You can download the latest Windows installer here.
During installation, be sure to select the Add to PATH option, allowing you to open a folder in WSL from the Windows terminal.
Install the Remote Development Extension Pack.
This allows you to use WSL as your integrated development environment and will handle compatibility and pathing for you. Learn more.
This extension will also allow you to launch VS Code right from your WSL terminal by using the code
command.
If I were inside the root directory of my repository, I would use code .
to launch the entire directory inside VS Code.
cd my-project
code .
The WSL2 shell can be chosen as the default VS Code terminal by pressing Ctrl + Shift + P and typing/choosing Terminal: Select Default Profile, then selecting zsh:
VetsWhoCode Extension Pack - Extension Pack for new veterans learning javascript at #VetsWhoCode
HashFlag Theme - A High contrast programming theme inspired by the colors of Vets Who Code.
The number of extensions available for VS Code can be overwhelming, here are some useful extenstions:
- Auto Close Tag - Automatically add HTML/XML close tag.
- Auto Rename Tag - Automatically rename paired HTML/XML tag.
- Color Highlight - This extension styles CSS/web colors found in your document.
- Dash - Dash, Zeal, and Velocity integration in Visual Studio Code
- Docker - This makes it easy to create, manage, and debug containerized applications.
- Draw.io Integration - This unofficial extension integrates Draw.io (also known as diagrams.net) into VS Code.
- ESLint - Find and fix problems in your JavaScript code
- Git History - View git log, file history, compare branches or commits
- GitHub Markdown Preview - Adds styling, markdown checkboxes, footnotes, emoji, and YAML preamble.
- GitLens - Quickly glimpse into whom, why, and when a line or code block was changed.
- Live Server - Launch a local development server with a live reload feature for static & dynamic pages.
- Live Share - Includes everything you need to start collaboratively editing and debugging in real-time.
- Markdown All in One - Markdown keyboard shortcuts, table of contents, auto preview, and more
- markdownlint - Markdown linting and style checking for Visual Studio Code
- Postman - Streamline API development and testing with the power of Postman, directly in your favorite IDE.
- Prettier - Prettier is an opinionated code formatter.
- Wakatime - Metrics, insights, and time tracking automatically generated from your programming activity.
Note:
You will need to install any VS Code extensions for your Remote - WSL. Extensions already installed locally on VS Code will not automatically be available. Learn more.
Chocolatey is a command-line package manager like homebrew or APT, but for Windows.
Before we start the installation process, I want to cover launching an administrative shell from Windows. There are a few ways to do this:
Right-click on the Windows start menu and select Windows Terminal (Admin):
Once your terminal loads, click the ˅
icon and open a new PowerShell tab. It should say Administrator: Windows PowerShell
in the new tab:
If you have Windows Terminal on your taskbar, Shift + Right-Click on the icon select run as administrator, and then open a new PowerShell tab:
Use the search bar from the Start menu and type in powershell
. A link to Run as Administrator will display:
Windows Terminal added a new feature where you can launch a PowerShell/Command Prompt profile in an Admin terminal automatically. In the Windows Terminal settings, scroll down to your desired profile and then toggle the Run this profile as Administrator
switch. Now you can skip all the steps above, and the terminal will always launch as admin.
-
Open an administrative PowerShell terminal
-
Run the following command:
Get-ExecutionPolicy
- If it returns
Restricted
, then run one of the following commands:
Set-ExecutionPolicy AllSigned
or
Set-ExecutionPolicy Bypass -Scope Process
With PowerShell, you must ensure
Get-ExecutionPolicy
is not Restricted. We suggest usingBypass
to bypass the policy to get things installed orAllSigned
for quite a bit more security.
- Finally, run the following command:
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'))
If you don't see any errors, you are ready to use Chocolatey! Type choco
or choco -?
now, or see Getting Started for usage instructions.
We use the choco
command to run Chocolatey. (Remember, you must use an administrative shell for it to work.)
Install a new package:
choco install filename
Remove a package:
choco uninstall filename
List all of the installed packages:
choco list
Update:
choco upgrade filename
or to update everything at once:
choco upgrade all
Search for available apps on the Community Package Repository.
Here are a few of my favorite (free) apps for productivity and development on Windows:
- Wox - A full-featured launcher
- RunJs - JavaScript and TypeScript playground
- Responsively - A modified web browser that helps in responsive web development.
- Zeal - the Windows version of Dash
- Figma - A collaborative UI design tool
- draw.io - Flowchart maker and diagram software
- GitHub Desktop - A GUI for Git
- Postman - API tools
- Notion - Project management and note-taking software
- Obsidian - A note-taking app using markdown
- Microsoft PowerToys - A set of utilities for power users
You can download all these at once with the following command using Chocolatey in an admin shell:
choco install wox runjs responsively zeal figma drawio github-desktop postman notion powertoys obsidian -y
These are all available as Firefox extensions as well.
- Axe Accessibility - Accessibility Checker for Developers, Testers, and Designers in Chrome
- ColorZilla - Advanced Eyedropper, Color Picker, Gradient Generator, and other colorful goodies
- daily.dev - Get a feed of the hottest developer news personalized to you.
- JSON Formatter - Makes JSON easy to read.
- Nimbus Capture - Screen Capture full Web page or any part.
- React Dev tools - Adds React debugging tools to the Chrome Developer Tools.
- Site Pallette - Generate a color palette from any website.
- WhatFont - With this extension, you could inspect web fonts by just hovering on them.
Let's get the VWC App installed and running locally. It will be our first step toward making Open-Source contributions to the organization!
- Clone the Repo
Clone the repository from GitHub:
gh repo clone Vets-Who-Code/vets-who-code-app
This may take a few minutes.
- Change Directory
Change into the newly cloned directory:
cd vets-who-code-app
- Install Node.js
Using nvm install
will install the version of Node.js required by the VWC app:
nvm install
- Install Dependencies
npm install
is how we install React, Next, Bootstrap, and every other piece of tech that the app requires. This will also take a few minutes.
npm install
There will be a lot of warnings and other messages that display, but this is normal.
- Run the App
Finally, we can launch the app on our local server:
npm run dev
You should be able to view the website locally at http://localhost:3000/].
CTRL + Left-click on the localhost link in your terminal to launch the app in your browser.
CTRL + C to close the dev server when you are finished.
This section covers setting up a Python development environment in WSL. In the end, you will have a package manager, environment manager, some frameworks, extensions, and more.
The first step will be confirming that Python is already installed on your system:
python3 --version
A Python version number should be returned. If not, install it with:
sudo apt install python3
pip is the package manager for Python, similar to npm for JavaScript. Install it using the following:
sudo apt install python3-pip
venv allows you to create virtual environments for your Python projects, helping to prevent versioning conflicts.
sudo apt install python3-venv
Flask is a web development framework similar to Express for Node.js. It can be installed by using pip:
pip3 install flask
Another popular web development framework is Django. Just as before, install it using pip:
pip3 install django
JupyterLab is a web-based interactive development environment. It is a powerful tool used in data science, scientific computing, computational journalism, and machine learning. Install it using the following command:
pip3 install jupyterlab
JupyterLab can be launched using the jupyter-lab
command.
The next step is to install the Jupyter Notebook. It allows you to create and share documents from Jupyter.
pip3 install notebook
The notebook is run by using the jupyter notebook
command.
Voilà allows you to convert a Jupyter Notebook into an interactive dashboard that allows you to share your work with others.
pip3 install voila
Launch Voilà using the voila
command.
You will find a ton of Python extensions for VS Code, but here are a few of the more popular ones:
- Python - The official Python extension.
- Django - Syntax highlighting and snippets for Django.
- Python Indent - Correct Python indentation.
- Python Environment Manager - Manage all of your Python environments & packages.
- autoDocstring - Quickly generate docstrings for Python functions.
- Black Formatter - Code formatter for Python using Black
- AREPL - Automatically evaluates Python code in real-time as you type.
- Python Test Explorer - Run your Python tests in the Sidebar of Visual Studio Code.
Instead of using VS Code, another option is to use an IDE made specifically for Python development. JetBrains created one of the best and most widely used ones called PyCharm. There is a free community edition version that can be downloaded here.
In this section, we'll install Ruby using rbenv
. Using rbenv will also allow you to install multiple Ruby environments on your machine, using different versions.
This guide continues installation with zsh as the default shell.
- Install rbenv
sudo apt install rbenv
- Follow the instructions to load rbenv in the shell:
rbenv init
The output will prompt you with instructions for loading rbenv. In your .zshrc, add the following line:
# Loading rbenv automatically
eval "$(rbenv init -)"
-
Restart your terminal to update the shell.
-
Before installing Ruby, you'll want to ensure your build environment contains the required tools and libraries:
sudo apt-get install autoconf bison patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev
- Next, install
ruby-build
as a rbenv plugin, to make sure we don't have any problems with rbenv.
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
- Let's get Ruby installed:
Run this command to see which stable versions of Ruby are available:
rbenv install -l
Install the most recent stable version, which in this case is v3.1.2:
rbenv install --verbose 3.3.5
This can take a very long time. The --verbose
flag will show the install progress, otherwise, it will look like it's frozen.
Ruby will be installed in your ~/.rbenv
directory.
- Set the global version, so that when you open a new terminal, it will use this version of Ruby.
rbenv global 3.3.5
- Close your terminal and open a new session. Check your current version of Ruby:
ruby -v
You should see something like this:
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
Now that Ruby is installed, you can install Rails. Ruby has its built-in package manager, called RubyGems. This is what you'll use to install Rails.
Enter the following to install Rails v7.2.1.2:
The --no-document
flag speeds up the installation by skipping the gem documentation files.
gem install rails -v 7.2.1.2 --no-document
- Next you'll need to install a shim to associate the
rails
command withrbenv
:
rbenv rehash
This command should run automatically after gems are installed
- Close your terminal and open a new session. Verify Rails was successfully installed:
rails -v
You should see this in your terminal:
Rails 7.0.4
- Ruby - Official VS Code Ruby extension.
- VSCode Ruby - Syntax highlighting, snippet, and language configuration support for Ruby.
- Ruby Test Explorer - Run your Ruby tests in the Sidebar of Visual Studio Code.
- Rails - Ruby on Rails support for Visual Studio Code.
- Ruby Solargraph - A Ruby gem that provides IntelliSense features through Microsoft's language server protocol.
- Ruby LSP - Companion VS Code extension for the Ruby LSP gem.
This section covers setting docker desktop for Windows. In the end, you will have a docker-daemon, docker-cli, docker-compose, and more.
Docker provides the ability to package and run an application in a loosely isolated environment called a container.
-
Docker uses virtualization to run containers so there are two options to run Docker either via WSL (recommended) or Hyper-V. If you have wsl enabled docker currently by default runs on wsl.
-
What should you use? Difference Between Hyper-V and Wsl
-
If you don't have wsl2 you need to enable Hyper-V Guide
Again there are two ways you can install docker-desktop on your Windows machine:
Using Chocolatey CLI package manager which we installed earlier.
For installation we will need a shell with administrative privileges, we covered how to run Powershell as an administrator while installing Chocolatey. Using any of the options open up a PowerShell.
choco install docker-desktop
Direct install via executable available on docker.com
Step 1 - Download the executable for docker-desktop.
Step 2 - Install the executable, and choose the appropriate virtualization environment while installing if the option shows up.
Step 3 - Done with installation. Sign in with the docker account or skip for the time being.
Make sure you at least launch docker-desktop once, and let it run in the background.
docker -v
docker
docker info
You have successfully installed docker-desktop and all other necessary tools docker-cli, docker-compose, and more.
Let's test some of the docker functionalities using the CLI.
List all the running containers:
docker ps
List all the available images locally:
docker images ls -a
Run a container:
- p tag for specifying the port
- d tag for detaching the shell
docker run -p 8080:80 httpd
The above command will fetch a public image of httpd which is an Apache HTTP server. It then runs it as a Docker container exposing port 80, and making it available to port 8080 of our local machine. You can visit localhost and view the content served by this container.
Now if you run the ps
command again it will list out this container.
Stop the running docker container:
docker stop [container-id]
- Explore docker-hub library of all the public docker images.
- What is a Container?
- What is an Image?
- Dockerfile
- Containerizing an application
- Docker-compose
- Multi Container Application
- Image Building