resources:windows-subsystem-for-linux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:windows-subsystem-for-linux [2021/06/07 15:01] – shortened and restructured wsl installation; corrected some mistakes in the details; added section "Why ..." arauhut | resources:windows-subsystem-for-linux [2024/06/20 13:53] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Windows Subsystem for Linux ====== | ||
+ | |||
+ | ===== Why install WSL ==== | ||
+ | |||
+ | Linux is an operating system like Windows and MacOS, and is widely used in scientific computing, and the quasi standard in software development and the server world. It is what is powering our FU Servers and INLET. It is [[https:// | ||
+ | |||
+ | In WSL2, you have easy access to text processing tools like '' | ||
+ | |||
+ | ===== Install WSL2 on Windows 10 ===== | ||
+ | |||
+ | Requirements: | ||
+ | - Activate Features | ||
+ | - Set default version to WSL2 | ||
+ | - Install a distribution | ||
+ | - Update | ||
+ | |||
+ | === 1. Activate Features === | ||
+ | You need to access the settings window //Turn Windows Features on or off//. Do this by either typing “features” into the search bar (this works with both English and German language settings) and selecting //Turn Windows Features on or off// or by bringing it up via the control panel/ Systemsteuerung (//Control Panel// > // | ||
+ | |||
+ | You should see a list of available features with boxes that you can tick. Tick the boxes next to //Windows Subsystem for Linux//. If you see //Virtual Machine Platform// in the list, activate it as well. Submit the changes by clicking //OK// below. You will have to reboot your computer. | ||
+ | |||
+ | === 2. Set default version to WSL2 === | ||
+ | |||
+ | Currently, there are two versions of WSL, and we recommend the 2nd. Open //Windows PowerShell// | ||
+ | |||
+ | < | ||
+ | wsl --set-default-version 2 | ||
+ | </ | ||
+ | |||
+ | You may be asked to download the latest version of the kernel. Copy and paste the link in the response into your browser (it may look like this: https:// | ||
+ | |||
+ | === 3. Install a distribution === | ||
+ | Open the //Microsoft Store// on your computer. Type “linux” into the search bar, and it should pull up a list of the available distributions. We recommend installing //Debian//, which is the Linux distribution used on the university server. | ||
+ | |||
+ | Complete the download process and launch the app. It will open a terminal and start an installation process. At the end, you will be asked to create a default UNIX account which requires a username and a password. **Note that this account does not affect your Windows settings and is solely confined to this Linux distribution, | ||
+ | |||
+ | === 4. Update === | ||
+ | Once the set-up is complete, it is advised to update by running the following command, i.e. typing or copying them into the command line and pressing enter to run it: | ||
+ | |||
+ | < | ||
+ | sudo apt update && sudo apt dist-upgrade | ||
+ | </ | ||
+ | |||
+ | This might take a few minutes. Once the commands have finished, the installation process is complete. | ||
+ | |||
+ | ===== Using WSL2: First steps ===== | ||
+ | |||
+ | There are two main ways to run WSL. The first option is to open Debian via the Start Menu, which will open the same terminal seen during installation. It will put you inside Linux and in your Linux home folder '' | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | </ | ||
+ | |||
+ | You can use the list command '' | ||
+ | |||
+ | < | ||
+ | ls | ||
+ | </ | ||
+ | |||
+ | Alternatively, | ||
+ | |||
+ | Once you are in WSL you will be in a Shell, which is an environment that executes the commands you enter. The default linux shell is called [[http:// | ||
+ | What you see in your terminal is a prompt which ends in '' | ||
+ | |||
+ | ===== Using SSH in WSL ===== | ||
+ | |||
+ | To access another server with the command '' | ||
+ | |||
+ | < | ||
+ | sudo apt install openssh-server | ||
+ | </ | ||
+ | |||
+ | Once the installation is finished, you should be able to connect to other servers via ssh the same way you may have done in //Windows PowerShell// | ||
+ | |||
+ | ===== Setting up the IMS Open Corpus Workbench on WSL ===== | ||
+ | |||
+ | Once you have WSL up and running, you can install CWB and use CQP in a few steps. | ||
+ | This allows you to install, compile, store and search corpora locally on your own computer. | ||
+ | - Download the [[http:// | ||
+ | - Run the installation script | ||
+ | - Add to the $PATH | ||
+ | - Create the registry folder | ||
+ | - Alias '' | ||
+ | |||
+ | === 1. Download and unpack === | ||
+ | |||
+ | At the time of writing, the Corpus Workbench (CWB) can only be compiled from source code which is available [[http:// | ||
+ | |||
+ | The CWB main package comes as a tarball (.tar.gz). You need to figure out the directory where the file is located. The commands below assume that it is in the // | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | </ | ||
+ | |||
+ | Confirm with '' | ||
+ | |||
+ | < | ||
+ | tar xvzf cwb-3.4.22.tar.gz | ||
+ | </ | ||
+ | |||
+ | === 2. Run the installation script === | ||
+ | |||
+ | You can now list the files in the new directory with '' | ||
+ | |||
+ | < | ||
+ | sudo ./ | ||
+ | </ | ||
+ | |||
+ | You will have to enter the WSL password that you have set during installation. The installation might take a few minutes to complete. | ||
+ | |||
+ | In theory, CWB and CQP should be ready to use. However, there may be a few adjustments to be made. To test if your shell finds the newly installed commands like '' | ||
+ | |||
+ | < | ||
+ | cqp | ||
+ | </ | ||
+ | |||
+ | If cqp launches as you know from the university server, you can skip the next section. Note that the command '' | ||
+ | |||
+ | < | ||
+ | cqp -e | ||
+ | </ | ||
+ | |||
+ | === 3. Add to the $PATH === | ||
+ | |||
+ | If cqp does not start, i.e., if the shell returns the message that the command cannot be found, you need to manually set the shell to look in the location of the installated files. To do that, you have to permanently add the path to the installed files to the PATH variable in the Linux system. The PATH variable is a list of directories that your Linux system automatically searches for commands. The CWB files are installed in this location: ''/ | ||
+ | |||
+ | You can check by listing the contents of the folder. If it exists and contains files like '' | ||
+ | |||
+ | < | ||
+ | ls / | ||
+ | </ | ||
+ | |||
+ | In order to add the the cqp tools to the path, you need to edit the configuration file '' | ||
+ | |||
+ | < | ||
+ | nano ~/.bashrc | ||
+ | </ | ||
+ | |||
+ | You navigate the file by using the arrow keys. Move to the bottom of the file and copy and paste the following line there:((If your binary files are located in a different place, use that path following this schema: '' | ||
+ | |||
+ | < | ||
+ | export PATH=$PATH:/ | ||
+ | </ | ||
+ | |||
+ | Save your changes pressing Ctrl+s (Strg+s) and exit with Ctrl+x (Strg+x). Now the file needs to be read again for the changes to take effect. You do this with the '' | ||
+ | |||
+ | < | ||
+ | source ~/.bashrc | ||
+ | </ | ||
+ | |||
+ | If you now try to launch cqp (or better '' | ||
+ | |||
+ | === 4. Create the Registry Folder === | ||
+ | |||
+ | If you want to add an already existing corpus to be used on your own computer with your CWB installation, | ||
+ | |||
+ | You can create it with the '' | ||
+ | |||
+ | < | ||
+ | sudo mkdir -p / | ||
+ | </ | ||
+ | |||
+ | Now if you start cqp, the warning message should be gone. | ||
+ | |||
+ | === 5. Alias '' | ||
+ | |||
+ | In order to execute '' | ||
+ | |||
+ | This can also be done in the '' | ||
+ | |||
+ | < | ||
+ | sudo nano ~/.bashrc | ||
+ | </ | ||
+ | |||
+ | And add the following to the end. | ||
+ | |||
+ | < | ||
+ | alias cqp=' | ||
+ | </ | ||
+ | |||
+ | Now the file needs to be read again with '' | ||
+ | |||
+ | Now if you start cqp using the command '' | ||
+ | |||
+ | ===== Adding an Existing Corpus ===== | ||
+ | |||
+ | As said before, to add an existing corpus, you need the corpus files and a registry file. Place the registry file, bearing the name of the corpus, in the registry folder you have created in a previous step. | ||
+ | |||
+ | Here, we will it do it using the command '' | ||
+ | |||
+ | < | ||
+ | sudo cp registryfile / | ||
+ | </ | ||
+ | |||
+ | The registry file requires you to specify the path to your corpus files. For example, if the corpus files were located in a folder called // | ||
+ | Remember the path to the corpus files and open the registry file: | ||
+ | |||
+ | < | ||
+ | sudo nano / | ||
+ | </ | ||
+ | |||
+ | In the registry file, you should see the comment ''# | ||
+ | |||
+ | '' | ||
+ | |||
+ | Now that the registry file is in the right place, and it contains the correct path to your corpus files, you can try to access the corpus with '' | ||
+ | If one of the available corpora is the one you just added and you can query it, it worked! | ||
+ | |||