Digital Team
About UsEdit in Gitbook
  • Welcome
  • Getting started
    • Life on the Digital team
      • Meetings
      • Communication
      • Software engineering working agreement
    • Contributing to Boston.gov
    • Using GitBook
  • Standards & best practices
    • Digital Team Release Notes
    • Working with Partners
    • Accessibility at COB
      • Developers
      • Content Editors
        • How to guide
      • Resources
      • Working with Iterators
    • Analytics and Metrics
    • Code of Conduct
    • General
    • Code reviews
    • Project Management
    • Git / GitHub
      • Contacts at Github
      • Git Command Tips
      • GitHub Service Accounts
    • Code quality
      • Automated tests & static analysis
      • Code comments
      • Style guides
        • Drupal/PHP
          • D8 Dependency Injection (DI)
        • React/TypeScript
    • Technical documentation
    • Hosting and monitoring
    • Deployment
  • Guides
    • Technology stack and technologies used
      • Web applications
    • Drupal - boston.gov
      • Custom Development & Configuration
        • On Demand Instances
          • Acquia Environment setup checklist
        • Continuous Deployment Process
        • Developer Onboarding
          • Step 1: Local Dev Environments
          • Step 2: Version control
          • Step 3: Introduction to Drupal
          • (to be sorted)
            • Development environment
              • PHP CodeSniffer
              • VSCode IDE Setup
              • AWS for Developers
              • Using Windows
            • Installation instructions
              • Typical build output
              • Lando 101
              • Verify Installation
                • Local Patterns installation
              • Windows install
              • PhpStorm settings configurations
          • Step 4: Site Building in Drupal 8
        • Site Development Notes
          • Git Best Practices - Drupal
          • Drupal Cache
          • Drupal Config
          • Custom Modules
            • Custom Themes
              • Front-end Theme (bos_theme)
                • Site Breadcrumbs
              • Back-end Theme (bos_admin)
            • Adding Templates to Custom Modules
            • Custom Content Types
              • D7 -> D8 Conversion
              • Content Editor UX
                • Content Moderation
              • In-page Navigation Menu
            • Custom Paragraphs
              • D7 -> D8 Conversion
            • Custom Taxonomies
            • WebApps
          • Drupal UX-specific
            • Image Styles & UX
            • Example Content Pages
          • PHPStorm IDE
        • CKEditor
      • Drupal Apps/Content Types
        • Budget Website
        • Building Housing
          • BH Drupal Entities
          • BH Map Webpage
          • BH Property Webpage
            • BH Project Timeline
          • BH Salesforce Sync
            • Salesforce Contributed Module
        • Contact Form
        • Election results
        • Google reCAPTCHA
        • My Neighborhood Lookup
        • Metrolist
        • Metrolist (Drupal)
        • Project Tracker
          • Content Types (& Paragraphs)
          • Taxonomies
          • Views
          • Developer Notes
      • Drupal Features & Components
        • Single Sign On (SSO)
          • Drupal SAML Knowledgebase
          • SamlAuth
        • Maps on boston.gov
        • Charts on boston.gov
          • Quick Overview
          • Chart Data
          • Chart Configuration
          • Advanced Concepts and Techniques
          • Charts on boston.gov (legacy)
          • Useful Resources
      • Drupal micro-services (API end-points)
        • Integrating with Boston.gov
        • Assessing Forms Endpoint
        • Bos311 API
        • Cityscore
          • Knowledge Base
        • PDF Manager Module
        • PostMark Email Services
          • Postmark Knowledgebase
        • Upaknee Email List Services
        • Public Notices
        • Site Alerts
          • CodeRed Subscription
      • Drupal - Weekly Maintenance
      • Drupal - Periodic Maintenance
    • Digital Webapps
      • Libraries and Tools
        • Emotion
        • Storybook
        • Rollbar
      • Services
        • AWS-hosted Microservices
          • SQL Proxy API (DBConnector)
            • Developer Notes
          • PDFToolkit API (DB Connector)
            • Developer Notes
      • Webapps - Maintenance
      • Webapps
        • Boston Family Days
        • Property Tax Calculator
        • Access-Boston
          • Updating IAMDIR/Group Management/LDAP certificates
          • Node Server
          • Portal App Tile Configurations
          • Ownership of Concerns
          • Updating SAML Certificates
          • Applications/Services
            • Group Management
            • Confirm ID/ID Verification
            • Preferred Name
        • Sanitation Scheduling
        • Registry-Certs
          • Marriage Intention
      • DevOps
        • New service setup
          • Non-Monorepo Service Setup
        • Service Configuration
          • Editing a project’s configuration using Cyberduck
        • Managing AWS
          • Production Overview
          • AWS Bastion Access
          • Terraform
            • Updating the ECS cluster AMI
          • Restarting an ECS service
          • Encrypting service configuration for S3
          • Mounting AWS SFTP as a Drive (Mac)
        • Webapp Deployment
          • Deploy to AWS 2021
            • Deploy Tool (cob_ecrDeploy)
    • Fleet - Pattern Library
      • Patterns Library Architecture
      • Icon Library Architecture
      • Developers
        • Local Development for Drupal Developers
      • Patterns Library Maintenance
    • Legacy Website - cityofboston.gov
      • Animal Control
        • Dog Licenses
      • No Tow
        • Street Sweeping Reminders
        • Street Occupancy Alerts
        • Towing Alerts
        • Towing Search
        • Subscription Search
        • Proposed Restructure
          • Backend
        • Reillys Notes
      • Workers' Compensation Inquiry Form
      • Streetbook
      • Legacy Website - Maintenance
        • Animal Control Maintenance
        • Assessing Online (AOL) Maintenance
          • Knowledge-base
          • Disclosure Period
          • Annual PDF Initialization
          • Database Tables
        • No-Tow Maintenance
    • AgilePoint
      • AgilePoint: Adding Users
      • Migrating AGP Applications from one platform to another
    • The Hub - hub.boston.gov
      • The Hub - Maintenance
    • Maintenance
      • Updating SSL Certificates
    • Redirects
      • Redirecting from cityofboston.gov
      • URL redirects versus URL aliases - Drupal
      • DNS Redirects
    • Decommissioned Apps or Services
      • Archived Forms Information
      • CodeRed
      • Drupal 7
        • Deployment (2019)
          • Why do we peer-review pull-requests ?
      • Rentsmart
      • SnowStats
      • Ruby
    • Weglot translation
      • What to do in Weglot
      • What to do on the website or page
        • Softr
        • Drupal Powered Pages
        • Custom Pages
  • Projects
    • Project: Patterns Library Cleanup
      • Project: Refactoring Legacy CSS
        • Strategy
        • Regression Testing
        • Maintenance
    • Project: Upaknee
    • Project: Everbridge API + UI
    • Project: 311 CRM Upgrade
      • Project: City Worker Upgrade to City Worker 5
      • Project: Lagan 311 CRM upgrade to 15r4
    • Project: Fleet (Pattern Library Design System)
    • Project: Monorepo Decoupling
    • Inactive projects
      • Project: 311 (Salesforce Upgrade)
      • Project: Access Boston
        • General/Historical Documentation
          • Edit Config and Upload Icons
        • Processes
          • Process: Adding New Icon to Access Boston Website
          • Process: Non-icon Access Boston Feature or Bug Requests
          • Self-Service
      • Project: Alexa Skill
      • Project: Assessing Online
        • 2022 Notes
      • Project: Boards and commissions
      • Project: City Hall Appointment Scheduler
      • Project: CityScore
      • Project: Mobile Apps
      • Project: Permit Finder
      • Project: Public Notice Signage
      • Project: Registry Suite
        • Birth certificates
        • Marriage Certificates
        • Marriage Intention
        • Death Certificates
      • Project: Work With U.S. Digital Response Team
      • Project: TDM Points App
      • Project: Translation on boston.gov
  • External resources
    • Learning resources
    • Reference links
    • Applications and extensions
Powered by GitBook
On this page
  • Basic WSL set up
  • Step 1: Enable WSL
  • Step 2: Install Debian
  • Step 3: Configure WSL to access the internet
  • Step 4: Custom WSL configurations
  • Step 5: install packages needed in WSL
  • Step 6: Mount local folders into WSL.
  • Step 7: Install Docker Desktop for Windows
  • Setup other developer tooling
  • Add AWS-CLI credentials
  • Add SSH keys
  • Install IDE:
  • Install Dashlane password manager
  • Knowledgebase

Was this helpful?

Export as PDF
  1. Guides
  2. Drupal - boston.gov
  3. Custom Development & Configuration
  4. Developer Onboarding
  5. (to be sorted)
  6. Installation instructions

Windows install

Basic WSL set up

Steps 1 - 7 must be completed while the computer is connected to the city network.

Step 1: Enable WSL

Using Windows POWERSHELL (as Administrator):

Launch POWERSHELL as administrator: search powershell from Windows search

Enable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")

Alternative strategy

This may work without Windows requesting a restart at the end.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Invoke-WebRequest -Uri https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi -OutFile $env:TMP\wsl_update_x64.msi -UseBasicParsing
msiexec.exe /i $env:TMP\wsl_update_x64.msi /passive

Step 2: Install Debian

Using CMD (console):

To open a CMD console search for cmd in the Windows search

wsl --set-default-version 2
wsl --install -d Debian

Alternative strategy:

This may provide a more fault tolerant WSL environment when we are switching from City network to external network (because we are controlling where the distro is installed, and its not on the user's profile).

mkdir %USERPROFILE%\WSLDistros
# Download the cobdistro.tar file into the users home folder (c:\Users\xxxx\)
wsl --set-default-version 2
wsl --import CoB-Debian %USERPROFILE%\WSLDistros %USERPROFILE%\cobdistro.tar
wsl --set-default CoB-Debian

# to create an image
# wsl --export CoB-Debian %USERPROFILE%\WSLDistros

Step 3: Configure WSL to access the internet

Using LINUX (WSL) console:

To get the Linux console, open a CMD console, type: wsl

sudo -s
rm -rf /etc/resolv.conf
bash -c 'echo "nameserver 10.241.241.70" > /etc/resolv.conf'
bash -c 'echo "[network]" > /etc/wsl.conf'
bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
chattr +i /etc/resolv.conf
exit

Step 4: Custom WSL configurations

These configuration files tweak the WSL environments to enable a better developer experience based on a standard CoB laptop configuration (i.e. minimum i7 chip, 32GB RAM and SSD harddisk).

Using a POWERSHELL console from the windows host:

echo '[wsl2]' > $env:USERPROFILE/.wslconfig
echo 'memory=16GB' >> $env:USERPROFILE/.wslconfig

Using a LINUX console (WSL):

cat << EOF > /etc/wsl.conf
[automount]
# Stops the entire hard disk(s) from being mounted into WSL
enabled = false
# Causes the /etc/fstab file to be processed as WSL starts
mountFsTab = true
options = "metadata,uid=1000,gid=1000
# Set whether WSL supports interop process like launching Windows apps and adding path variables. Setting these to false will block the launch of Windows processes and block adding $PATH environment variables.
[interop]
enabled = false
appendWindowsPath = false
# Network host settings that enable the DNS server used by WSL 2. This example changes the hostname, sets generateHosts to false, preventing WSL from the default behavior of auto-generating /etc/hosts, and sets generateResolvConf to false, preventing WSL from auto-generating /etc/resolv.conf, so that you can create your own (ie. nameserver 1.1.1.1).
[network]
hostname = DoITWSL
generateHosts = false
generateResolvConf = false
EOF

wsl --shutdown
[Wait 30 seconds]
wsl

Step 5: install packages needed in WSL

Using LINUX console

sudo apt-get update
sudo apt-get install -y gzip unzip vim git curl groff

# optional for network diagnostics
sudo apt-get install -y net-tools dnsutils

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
sudo rm -f awscliv2.zip

Troubleshooting:

  • If you have accessing the internet from WSL first try RESTARTING the computer.

  • If that does not work, using a LINUX console try:

netsh winsock reset 
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns

=> then restart the computer.

Step 6: Mount local folders into WSL.

Mount your development folders into WSL using the LINUX console:

sudo -s
rm -rf /etc/fstab
echo "c:/Users/xxxx/sources /home/yyyy/sources drvfs default,metadata,uid=1000,gid=1000 0 0" > /etc/fstab
mkdir /home/yyyy/sources
mount -a
exit
  1. Replace c:/Users/xxxx/sources with the location in the windows host where you plan to keep all development source files. This is the folder where you will be cloning the CoB repos. If in doubt, create a sources folder in your windows home folder, and for the command above just replace xxxx with your CoB supplied EmployeeID/User Account.

  2. Replace yyyy with the accountname you used when you installed WSL (you can find this in the LINUX console by running cd ~ && pwd - the path displayed be in the format /home/accountname

Step 7: Install Docker Desktop for Windows

  1. Double click the installer to launch: + Click OK to accept non-windows app, + Select WSL2 as the backend (rather than Hyper-V)

  2. Docker desktop does not automatically start after the install, you need to start it the first time from the Start menu.

Restart your computer after this step.

If you do not, and subsequently restart the computer while off the city network, your installation will be broken, and you will have to remove Docker and WSL, and start over.

(see "Docker Fails to Restart" notes below to fix broken/non-functional WSL installs)

Setup other developer tooling

Add AWS-CLI credentials

Verify AWS is installed using LINUX console:

/usr/local/bin/aws --version

You should see an output something like:

aws-cli/2.7.4 Python/3.9.11 Linux/5.10.102.1 .....

Obtain your secret access keys for AWS from the AWS administrator, and then create the AWS credentials file using the LINUX console:

echo "[cityofboston]" > ~/.aws/credentials
echo "aws_access_key_id = xxxxxx" >> ~/.aws/credentials
echo "aws_secret_access_key = xxxxx" >> ~/.aws/credentials

Alternatively. you could also create and edit the credentials file using vim which is installed in the WSL instance (from step 5 above).

Add SSH keys

Add your ssh keys to into your windows account (typically into a windows folder on you home drive) and then from a LINUX console:

mkdir ~/.ssh
cp -r /mnt/c/Users/xxxx/.ssh  ~/.ssh
sudo chmod -R 600 ~/.ssh/*
sudo chmod -R 644 ~/.ssh/*.pub
sudo chmod 700 ~/.ssh

Replace xxxx with your EmployeeID/User Account from CoB.

Install IDE:

  • Microsoft Visual Studio Code (VSC)

  • PHP Storm

Install Dashlane password manager

Knowledgebase

Restart the WSL service on Windows host

Using POWERSHELL:

Get-Service LxssManager | Restart-Service

Ensure windows has profile/policies loaded properly

Using POWERSHELL:

dmesg | grep 9p

Mount the sources folder manually

Using LINUX console:

sudo mount -t drvfs c:/Users/xxxx/sources /home/yyyy/sources -o metadata,uid=1000,gid=1000

Replace xxxx with your CoB supplied EmployeeID/User Account.

Replace yyyy with the accountname you used when you installed WSL.

Un-mount the sources folder

Using LINUX console:

sudo umount /home/yyyy/sources/

Replace yyyy with the accountname you used when you installed WSL.

Remount the sources folder

Using LINUX console:

sudo umount -a

Uninstall WSL:

Using Powershell (as Administrator):

wsl --disconnect
wsl --terminate -s debian
dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Moving Home=>Office or Office=>Home

From Powershell console reinitialize WSL:

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

From LINUX (WSL) console reset the nameserver so you can access the internet:

bash -c 'echo "nameserver X.X.X.X" > /etc/resolv.conf'

Where X.X.X.X is the IPAddress: 8.8.8.8 (confirm if there should be a different address) when in the office and 10.241.241.70 when not on the city network but using a VPN.

Docker Fails to start

If, when restarting the computer, Docker fails to start and/or you get the following error when starting WSL:

The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

To fix this, perform the following steps.

Step 1: Using Powershell (ps) as Admin:

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

Step 2: Then using a CMD shell (as Admin)

sc config LxssManager start=auto
wsl --set-default-version 2

Step 3: Restart Docker for Windows from the start menu.

PreviousLocal Patterns installationNextPhpStorm settings configurations

Last updated 2 years ago

Was this helpful?

@see

Download installer from h

https://docs.microsoft.com/en-us/windows/wsl/wsl-config
ttps://docs.docker.com/desktop/windows/install/