|
|
---
|
|
|
title: 'Lokal Arbeiten (Linux, MacOS oder WSL)'
|
|
|
---
|
|
|
# Allgemeines
|
|
|
|
|
|
Falls Sie bereits Linux oder MacOS (oder WSL?) lokal verwenden, brauchen Sie nicht zwangsläufig die Virtuelle Maschine zu verwenden. Stattdessen müssen Sie dann die Schritte lokal nachvollziehen, die automatisiert in der Virtuellen Maschine durchgeführt werden. Wir können dabei aber dann keinen Support leisten.
|
|
|
|
|
|
Die Virtuelle Maschine wird über [Ansible](https://www.ansible.com/) konfiguriert. Die Konfiguration ist ein sogenanntes Playbook ([hier](https://gitlab.lrz.de/hm/devbox/-/blob/master/ansible/playbook.yml)), dass als Tags die einzelnen Veranstaltungen enthält ([Liste](https://gitlab.lrz.de/hm/devbox/-/blob/master/ansible/playbook.yml#L40)). Die Tags sind dann "Rollen" zugeordnet. Sie brauchen für die jeweilige Veranstaltungen also alle Rollen, die den Tags zugeordnet sind.
|
|
|
|
|
|
Die Rollen selbst sind dann die Kochrezepte ([Beispiel](https://gitlab.lrz.de/hm/devbox/-/blob/master/ansible/roles/ca/tasks/main.yml)), die Sie genauso lokal ausführen könne. Die Funktionalität der Tasks in den Rollen ist in der [Ansible Dokumentation](https://docs.ansible.com/ansible/2.8/user_guide/modules.html) beschrieben, aber weitestgehend selbsterklärend. Sie können entweder lokal Ansible verwenden oder die Schritte manuell nachvollziehen.
|
|
|
|
|
|
# Erfahrungsbericht (WSL2)
|
|
|
|
|
|
Thanks to @kerem for sharing his experience with Devbox on WSL2 in SoSe2025:
|
|
|
|
|
|
## About
|
|
|
|
|
|
This is just a quick guide to installing devbox tools within WSL (Windows Subsystem for Linux). You can find all the needed files at the [official devbox repo](https://gitlab.lrz.de/hm/devbox). This example contains instructions specifically for 'IT-Systeme' but can most certainly be applied to other subject-files.
|
|
|
|
|
|
## Requirements
|
|
|
|
|
|
Before explaining any installation I want to mention that I did all the steps below on WSL2 on **Ubuntu-22.04** and tested on **Ubuntu-20.04**, too.
|
|
|
|
|
|
The `update.sh` works with a tool called **ansible** which uses notebooks. To install ansible in Ubuntu and Ubuntu-based Distros use `sudo apt install ansible`. Additionally clone the above mentioned **devbox repo** in order to get the yml-files that you need.
|
|
|
|
|
|
The process contains of several fairly simple steps:
|
|
|
|
|
|
* modifying the main.yml of your needed subject
|
|
|
* creating a minimal notebook instructions for ansible
|
|
|
|
|
|
## Modify main.yml
|
|
|
|
|
|
So about modifying the main.yml, it really depends on the subject you need. Generally you could try executing it without any editing, but for my example (ITS) this didn't work.
|
|
|
|
|
|
After cloning the repository go into the folder /devbox/ansible with `cd devbox/ansible/roles`. From there choose the subject you need. For this example, I will use 'IT-Systeme' and its corresponding folder is called `its`. So go into _its/tasks_ with `cd /its/tasks` and edit the file _main.yml_ with `nano main.yml` or a editor of your choice. Comment out the lines 13-17 so it looks like this:
|
|
|
|
|
|
```
|
|
|
#- name: appending the group 'vboxsf' to the user's groups
|
|
|
# ansible.builtin.user:
|
|
|
# name: "{{ labuser }}"
|
|
|
# groups: vboxsf
|
|
|
# append: yes
|
|
|
```
|
|
|
|
|
|
Since you want to install everything on wsl, there is no need for appending the user to a vboxsf group. It rather caused issues so you can easily remove/comment that part. For course `ITS` this was enough and the rest should install without any issues.
|
|
|
|
|
|
## Creating playbook
|
|
|
|
|
|
After the above step go back into the folder `ansible` with the help of `cd ..`. There create a new yml file (name doesn't matter) with the .yml extension with `touch <filename>.yml` and edit it with the help of an editor of your choice.
|
|
|
|
|
|
Then copy the following into it:
|
|
|
|
|
|
```
|
|
|
- name: install ITS role
|
|
|
hosts: localhost
|
|
|
become: yes
|
|
|
vars:
|
|
|
labuser: devbox
|
|
|
roles:
|
|
|
- its
|
|
|
```
|
|
|
|
|
|
If you need a different course, then just change `its` for your course. I called the user of my WSL installation `devbox` so just change that for your username. That's it!
|
|
|
|
|
|
## Apply playbook
|
|
|
|
|
|
After you've met all requirements the installation according to the playbook is pretty easy :smile:
|
|
|
|
|
|
You can execute the modified version of the YAML file with the help of the command `ansible-playbook -i localhost, <filename>.yml --connection=local`
|
|
|
|
|
|
This should install everything accordingly to your playbook just like it would on the devbox.
|
|
|
|
|
|
The options `-i localhost` and `--connection=local` is used so ansible executes the command on your local machine rather than on a predefined host. |