Setup WSL
Warning This guide is under construction! The respective TL (Team Lead) will let you know as soon as it can be used in full.
For questions regarding the setup on Windows, contact Tobias Hopp or Hasan Dogan.
Preliminary Notes
- The PC must be restarted several times during the installation. Therefore, close and save all other tasks.
- You can also Copy & Paste from Windows into WSL. In the WSL console, this often only works using the right mouse button.
- This also works from WSL to Windows by selecting the desired string and pressing
[Ctrl+c].
Update WSL
To update WSL, use the following commands in the respective shell:
sudo apt update
and
sudo apt upgrade
Make
In the WSL, execute the command
make
once to see if it is already installed (it will complain about a missing Makefile if it is already installed).
Installation
In the WSL
sudo apt install make
Or directly
sudo apt install build-essential
At the same time, also run:
sudo apt install ca-certificates
SSH Key Setup in WSL
Existing Key
Create files with the same name as the local key (without extension and .pub) in the WSL (under ~/.ssh) and copy the contents into them.
Then, restrict the permissions of the private key (file without extension).
chmod 0600 <filename>
New Key:
In the WSL
ssh-keygen -t rsa -b 2048 -C "<comment>"
comment is the part integrated at the end of the key, so something like [initials]-docker or similar makes sense here.
Assign a filename (default is id_rsa) and a password.
If a "command not found" appears, install the corresponding keygen package with the following command and then run the ssh-keygen command again; otherwise, skip this step:
sudo apt-get -y install openssh-client
Then, in the WSL, read the content of the .pub file and put it into the clipboard.
cat ~/.ssh/<filename>.pub | clip
And then add it to your GitLab account under "Preferences" -> SSH Keys
GIT Installation and Settings
Installation
Check if GIT is already installed with the following command in the WSL
git --version
If GIT is not installed
sudo apt install git
Set Credentials
In the WSL
git config --global user.name <username>
and
git config --global user.email <email>
Registry Login
docker login -u yourGitlabEMail registry.econsor.net
And
docker login -u yourGitlabEMail git.econsor.net
If asked for the password, enter the GitLab password.
Adjust Resources
By default, Windows allocates about 80% of resources to WSL. Since the goal is to run PhpStorm in Windows, it is necessary to adjust the resources.
If the resource distribution is incorrect/unfavorable, indexing in PhpStorm or parallel work with multiple instances may be hindered.
Open the Windows user folder (in my case c:\Users\[user name]\.wslconfig) and create a file named
.wslconfig
And write the following into it
[wsl2]
memory=6GB
localhostForwarding=true
processors=8
The laptop must be restarted afterwards!
Further information: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#wslconfig
Notes on resource allocation (exceptions are possible depending on the use case)
A rough guideline would be to leave 1/4 of the resources for WSL.
The RAM for WSL should, if possible, not be less than 4GB - > 6 GB would be good. However, always leave the larger share for Windows.