Web Tools Setup


The purpose of this section is to help you install command line tools that you will need to work on our Drupal websites. These tools will include:

  • Visual Studio Code: a free text editor and IDE
  • Notepad++:  another free text editor that is very useful for cleaning up content
  • Ubuntu: a Windows command line tool that is very helpful for interacting with websites.
  • WSL 2 upgrade for Ubuntu

Text in Bold indicates a command you can copy and paste into your command line. 

To copy and paste, copy text normally and then right-click inside Ubuntu to paste.


    This program can clean up unneeded/excess HTML and other code surrounding text. Additionally, it has a cool lizard icon as its logo. You can go download a free copy from their download page

    notepad++ lizard icon

    Getting Ubuntu Set-up with Tools

    Installing Ubuntu

    Run Windows PowerShell as admin

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

    Open the MS Store 

    Search for Linux 

    Install Ubuntu and Run it

    Setup your Linux account via the terminal (Ubuntu)

    Make a websites folder:

    • cd ~
    • mkdir websites

    Installing tools

    Install Git 

    Run the following command in Ubuntu to install Git:

    sudo apt-get install git

    Verify Git is now installed by running this command:

    git --version

    Verify CURL Installation 

    CURL is a command line tool to copy data from another server. You already likely have it installed. To verify its installation run this command:

    curl --version

    If the curl version command above fails you will need to install CURL. Run the following commands:

    sudo apt install curl

    curl --version

    Install PHP

    Run the following command and this will update all packages tracked.

    sudo apt-get update

    Now, to specifically install PHP and its required components run the following commands: 

    sudo apt-get update

    sudo apt -y install software-properties-common

    sudo add-apt-repository ppa:ondrej/php

    sudo apt-get update

    sudo apt-get install php7.4 php7.4-cli php7.4-mbstring unzip php7.4-gd php7.4-xml php7.4-curl

    Run the following command to verify that you have successfully installed PHP

    php --version

    If the above PHP install fails, run this: 

    sudo apt-get --fix-missing

    Install Composer 

    To install Composer run the following commands:

    curl -sS https://getcomposer.org/installer -o composer-setup.php

    sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

    To verify Composer run the following command:

    composer --version

    Install Terminus 

    curl -O https://raw.githubusercontent.com/pantheon-systems/terminus-installer/master/builds/installer.phar && php installer.phar install

    Now that you have copied the Terminus files and installed them, you need to tell Ubuntu that you have installed it. You do this by giving it an "alias" in its .bashrc file.  So, to add alias for Terminus execute the following commands in the terminal. Each must be followed by and "Enter". 

    cd ~

    vim .bashrc

    i (no need to press Enter) 

    Add the following line to the top of the file under the first lines of comments 

    Make sure to change the Linux username to your username. In this case "samh" is my linux username. Replace this with your username.

    alias terminus=/home/samh/vendor/bin/terminus

    Screenshot of bashrc setup ***check to see if your terminus is actually in this spot with file explorer... you may not have a /vendor or /bin.

    Press "Esc"


    Reload the terminal 

    Either close and reopen or enter 

    cd ~

    source .bashrc 

    Verify Terminus is working 

    terminus -v

    Show Git Branch

    When you are working with Git it is very helpful to have the branch you are working on display on the Ubuntu command line. To enable this your need to run these command in your Linux terminal (Ubuntu): 

    cd ~

    vim .bashrc

    i (no need to press Enter) 

    at the end of the file (down arrow to get there) paste: 

    # Show git branch name 



    parse_git_branch() { 

        git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' 

    if [ "$color_prompt" = yes ]; then  

    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' 


        PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ ' 


    unset color_prompt force_color_prompt 

    Press Esc 


    Ubuntu screen shot showing how to add branch and color coding

    WSL 1 to WSL 2 Upgrade Process and Website Folder Creation (by Dan)

    ***if you are already running WSL2 (you will see), skip steps 12-20.

    1. Click on the Search icon in your Windows tray
    2. Search for Turn Windows Features On or Off
    3. Click OK to run as Admin
    4. Place a check next to Hyper V 
      * if you are using Windows 11 I found these steps helpful https://beebom.com/how-enable-hyper-v-windows-11-home/ - no need to go past the section on setting up hyper v 
      for Windows 10 Home, try this https://www.itechtics.com/enable-hyper-v-windows-10-home/
    5. Ensure
    6. Click OK
    7. Open PowerShell as admin
    8. Run this:
      1. dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    9. Reboot, I'll wait for you
    10. After rebooting, open PowerShell as admin
    11. Enter wsl -l -v 
      ***if you are running wsl2 already skip to step 21***
    12. You should see Ubuntu listed as WSL 1
    13. Enter wsl --set-version Ubuntu 2 
      If you encounter "WSL 2 requires an update to its kernel component." See Step 4 here https://docs.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
      * Ubuntu might have a slightly different name on your computer 
    14. Wait
    15. Wait
    16. Wait
    17. Seriously, it could take 10-20 minutes
    18. Verify the swap was successful by entering wsl -l -v
    19. Once done, close PowerShell
    20. Reboot
    21. Open Ubuntu
    22. cd ~
    23. cd /etc/
    24. sudo vim wsl.conf
    25. i
    26. Add this to the file (not the 1. though), if generateResolvConf exists, change it to false
      1. [automount]
        enabled = true
        options = "metadata"
        mountFsTab = false
    27. esc
    28. :wq
    29. sudo rm -rf resolv.conf
    30. sudo touch resolv.conf
    31. sudo vim resolv.conf
    32. i
    33. Add this to the file (not the 1. though)
      1. nameserver
      2. Not for the file, just a note about our VPN and WSL2. I've hit blockages while on VPN and had to add other nameservers. If you are able to pull down repositories while off and on the VPN, ignore this. If not, let Dan know.
    34. esc
    35. :wq
    36. sudo chattr -f +i resolv.conf
    37. cd ~
    38. source .bashrc
    39. cd ~
    40. cd <your websites folder>
    41. clone a site
      1. See Step 33.2 if you have trouble
    42. Open bash
    43. cd ~
    44. vim .bashrc
    45. i
    46. locate the line that begins with cd
    47. Make sure it says cd <your websites folder name>
      1. Mine is just websites, so it looks like cd websites
    48. esc
    49. :wq
    50. source .bashrc
    51. Verify that it works
      1. You should have been placed in your websites folder
    Now you should check to make sure terminus still works.

    Checking Terminus

    Terminus should work just fine for you as is. We need to update our versions of Terminus, but we will come back to that later. For now, just follow these steps to verify your Terminus install still works.
    1. Open your bash
      1. Your path/command should be something like ~/websites$
    2. terminus --version
      1. Should return 2.something with a message to update
      2. If not, contact Dan and stop
    3. cd into a cloned site (D8 or D9 only)
    4. ahoy dbcc dev
      1. If it worked, fantastic
      2. If not, get in touch with Sam or Dan

    Visual Studio Code

    VS works well with WSL2 and does everything we need. Here is what Visual Studio says about itself,

    "Learning to code is intimidating, so set yourself up for success with a tool built for you. Visual Studio Code is a free coding editor that helps you start coding quickly. Use it to code in any programming language, without switching editors. Visual Studio Code has support for many languages, including Python, Java, C++, JavaScript, and more. Ready to get started? Check out these introductory videos or check out our coding packs for Java, Python, and .NET."

    Install it from here, https://code.visualstudio.com/

    Once you have downloaded and installed VS please add these extensions.

    1. Extensions
      1. Easy Less
      2. Symfony Code Snippets (could not find)
      3. Drupal Smart Snippets
      4. drupal-check
      5. Beautify css/sass/scss/less
      6. Remote WSL
      7. PHP Extension Pack
      8. phpfmt
    2. File mappings (I don't understand)
      1. .theme to PHP
      2. .module to PHP

    We can still create workspaces for each set of folders so you can group your projects together. That's done like so:

    1. Open VS Code
    2. Select File
    3. Select Open Folder
    4. Navigate to your folder
      1. WSL 2 would be \\wsl$\Ubuntu\home\<user name>\<websites folder name>
    5. Click OK
    6. Voila
    7. Now Select File
    8. Save Workspace As
    9. Enter a name
    10. Click Save
    11. Once the workplace is set up, close VS Code
    12. Open bash
    13. CD into your website folder, the one that you navigated to in step 4
    14. code .
    15. VS code will open and make the connection to WSL
      1. From then on, the quickest way to open the workspace is either
        1. opening VS Code through Windows and selecting a recent location
        2. or opening the parent folder in bash and typing code .
      2. Any valid WSL enabled folder will look like this in File >Open  ecent
        1. /home/<user name>/<folder name> [WSL: Ubuntu]
    16. In VS Code, click on Extensions
    17. Scroll through your enabled list and look for any that have an Enable in WSL button
    18. Click on Enable in WSL for each
    19. You may need to restart VS Code

    Starting Ubuntu in your Web Development Folder

    To set Ubuntu so it starts up in your web development folder follow these steps. Once you have created these two folders run the following commands:

    cd ~

    source .bashrc  

    To choose the start folder, add this line to the top of the .bashrc file as shown below

    cd websites

    Screenshot of bashrc setup

    Press Esc 


    Close/reopen your Linux terminal 

    Verify you started in the new location. When you open Ubuntu and type ls you should see the "websites" folder 

    Installing Ahoy

    In Ubuntu enter the following commands:

    sudo wget -q https://github.com/ahoy-cli/ahoy/releases/download/2.0.0/ahoy-bin-`uname -s`-amd64 -O /usr/local/bin/ahoy && sudo chown $USER /usr/local/bin/ahoy && chmod +x /usr/local/bin/ahoy

    ahoy --version

    When all has gone well you will see version 2.0.0

    Connecting to Pantheon with Ubuntu

    This section of the set up enables you to connect to Pantheon hosted sites using Ubuntu. If you do not yet have a Pantheon account skip this set-up. Without that account you cannot connect with Pantheon. We will give you the account when it is time.

    The first step in connecting with Pantheon is to generate a key for Terminus auth. Go to https://dashboard.pantheon.io/users/#account/tokens/ 

    Login if necessary 

    Create your token 

    Enter a token name 

    Copy the Terminus command and run it in your terminal 

    terminus auth:login --email=<email> --machine-token=<machine_token>

    Test out a Terminus command like cc all on a site. In an open Linux terminal (Ubuntu) enter: 

    terminus drush <site name>.<env> -- cache:rebuild

    You should see a success message and Exit: 0 

    You are now connected to Pantheon via Terminus. Well done.

    Build Trust Between your Computer and Pantheon

    Now that you are set up with Ubuntu talking with Pantheon, let us take the steps so you can build trust between your machine and Pantheon so you will not longer have to enter your Pantheon password to keep giving commands to Pantheon. So, open your terminal (Ubuntu) and enter these commands:

    cd ~


    • Keep the default name and location (hit enter)
    • No passphrase

    cat ~/.ssh/id_rsa.pub

    Copy all the content of the file 


    eval 'ssh-agent'

    Go to your Pantheon dashboard, https://dashboard.pantheon.io 

    Select "Account" 

    Select "SSH Keys" 

    Paste the text copied from above into Add an SSH key 

    Click "Add Key" 

    Close/reopen your Linux terminal 

    Run a terminus command on a Drupal 8 site terminus drush <site name>.<env> -- cr  

    screen shot of adding an ssh key on Pantheon


    Connecting to GitLab

    Go to gitlab.com and make an account. Tell Sam your username and he will get someone to send you an invite to the WaTech Web group. Look out for an email! Follow the instruction on the email to get access to the WaTech repositories.

    If you haven't done so already follow these instructions for the ssh key.

    Open your bash

    • cd ~
    • cat ~/.ssh/id_rsa.pub
    • If, and only if it does not exist:
      • ssh-keygen
      • press Enter a bunch of times
      • Then, cat ~/.ssh/id_rsa.pub
    • Copy the code printed out, all the way from ssh to your ID at the end
    • Open https://gitlab.com/-/profile/keys
    • Paste in the RSA data
    • Enter a name for the key (doesn't matter what really)
    • Leave the date empty
    • Click Add key

    To connect to GitLab:

    1. Open https://gitlab.com/-/profile/personal_access_tokens
    2. Create a new token, name it what you want
    3. Give it read_api access
    4. Click Create personal access token
    5. Copy the token at the top
    6. In the terminal run: composer config --global --auth gitlab-token.gitlab.com [your_token]