« Previous 1 2 3 4
Linux apps on Windows 10 and Chrome OS
Penguin Travel
Integrating Server Daemons
If you need to expand the development environment, the Synaptic graphical package manager will help, as an alternative to the shell. You can install and start it with the commands:
sudo apt-get install -y synaptic xhost +si:localuser:root sudo synaptic
In this case, the xhost
command ensures that the root user is allowed to use the system's X client, which you are not allowed to do by default. After starting the desired application, you can revoke the user's permissions again with:
xhost -si:localuser:root
Now, install Nginx and the web server and other components such as PHP or MySQL. Unlike WSL, the Debian container comes with the systemd startup environment, so you can configure daemons to start automatically:
sudo systemctl enable nginx sudo systemctl start nginx
Bear in mind that the Linux container with the server daemons in it will not restart by itself after a reboot of the Chromebook. This will only happen once you manually start the terminal or any other Linux application. Also keep in mind that you need to configure port forwarding to access the daemons in the development environment from Chrome OS and other devices on the network. However, Chrome OS only supports TCP or UDP ports from 1024 upward for this purpose. In this example, you would need to change the Nginx configuration as follows:
sudo vi /etc/nginx/sites-enabled/default
In the configuration, change the TCP port of the web server from 80 to 1080 and save the file:
(...) listen 1080 default_server; listen [::]:1080 default_server; (...)
Now restart the web server by typing
sudo systemctl start nginx
Finally, navigate to Advanced | Developers | Linux | Port forwarding in the Chrome OS settings and add TCP port 1080 there. You can then reach the start page of the web server on Chrome OS from http://localhost:1080 .
Besides software from the official Debian package repository, you can easily add more software. On Chrome OS, download the Debian package for Microsoft Visual Studio Code and launch the file in the Chrome OS file manager. The system automatically detects that it is a Linux application and opens the dialog named Install app with Linux , so you can initiate the setup directly from Chrome OS. Chrome OS informs you about the installation progress, and the application automatically appears in the system launcher. Unlike WSL, in this case your complete development environment, including daemons and source code editor, is inside the Linux container (Figure 3).
Conclusions
Linux subsystems come in various flavors. The approaches on Microsoft Windows and Google Chrome OS differ significantly in parts. Windows impresses with the multitude of distributions available in the store. Chrome OS has a more mature integration of graphical applications. What both have in common is that their users can, in many cases, remove the overhead entailed by a full-fledged Linux VM for applications and development tasks on Linux. Additionally, the exchange of data between the two worlds works without complications. Linux therefore significantly expands the functional range of the respective host systems.
Infos
- "Use Linux Containers with WSL2 on Windows" by Thomas Joos, ADMIN , issue 66, 2021, pp. 52-56
- Update package for the WSL2 Linux kernel: https://docs.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
- "WSLg Architecture" by Steve Pronovost. April 19, 2021: https://devblogs.microsoft.com/commandline/wslg-architecture/
- Win-KeX: https://www.kali.org/docs/wsl/win-kex/
- Use X410 with WSL2: https://x410.dev/cookbook/wsl/using-x410-with-wsl2/
- Using Visual Studio Code with WSL: https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-vscode
- Running containers under Chrome OS: https://chromium.googlesource.com/chromiumos/docs/+/HEAD/containers_and_vms.md
« Previous 1 2 3 4
Buy this article as PDF
(incl. VAT)