How to test your Delphi projects in Linux using WSL/2 (Windows SubSystem Linux) in Win10 no more VMs
NO MORE VirtualBox, VMWare, etc...
see on wedelphi.com my post complete with pictures... https://wedelphi.com/t/422397/
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!
IMPORTANT OBSERVATION: The FIREWALL (from MSWindows or from Antivirus) can block the connection between two system, then, pay attention! It's necessary that IP address/Port used by WSL Linux / VcXsrv be opened to talking between it and RAD Studio.
First, in your MSWindows 10, you need install the WSL: - in MSWindows configuration, go to "Add and Remove programs"; - go to "Programs and Resources"; - go to "Active and DeActive resources Windows"; - check the option "Windows SubSystem Linux" - press <<OK>> and wait the installation - restart MSWindows, if necessary!
Now, you need have your Linux image in your disk. For that, you need download from MSWindow Store by Microsoft distribution. - Then, in your MSWindows 10, go to "Microsoft Store" and search for "Ubuntu"
It's ready! Your "Linux" shortcut will be created in your "Windows Start menu", by default. Now, you can run your "new" Linux platform directly from MSWindows environment. - Next step is install the libs necessary to all works...
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!
when it's necessary a administrative privilegies, you need use the "SUDO" before each command-line: - sudo apt update # Update the package lists - sudo apt full-upgrade # Upgrade the system by removing/installing/upgrading packages - sudo apt install libcurl4-gnutls-dev build-essential - sudo apt autoremove # clean things up
you need install the X11-app type this command in your WSL Linux session - sudo apt install x11-apps -y - sudo apt autoremove # clean things up...
to VcXsrv works with your WSL Linux session you need add a new command-line your ".bashrc" file in shell prompt, type this command: - sudo vi .bashrc
add this command-line in "last line in your .bashrc file"
now, your .bashrc is open and ready for work... then type this command-line and save the file : - export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!
now, you need install the "PAServer" in your WSL Linux. (same version used in your RAD Studio!!!)
download from Embarcadero or copy from your RAD Studio folder ... \bin\PAServer http://docwiki.embarcadero.com/RADStudio/en/Installing_the_Platform_Assistant_on_Linux
- cd ~
- tar -xf LinuxPAServer22.0.tar.gz or tar -xf /mnt/c/Program Files (x86)/Embarcadero/Studio/22.0/PAServer/LinuxPAServer22.0.tar.gz
- mv PAServer-22.0/ PAServer - cd PAServer - ./paserver /// <--- to run the PAServer session
Maybe you need another "libs", then, see on Embarcadero site for more informations.... OK?
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!
Following, to run the graphical apps in your WSL Linux, you will need a "XServer" to show your GUI softwares. Exists many options "Commercial and Free" for this, and you can read the "Jim McKeeth post on Embarcadero blog for more info" Targeting Windows 10’s Windows Subsystem for Linux with Delphi for Linux
Here, we will use the VcXsrv open-source and free for use to tests. VcXsrv is a open-source/free project by "marha" (developer and admin project) on VcXsrv Windows X Server - Go to sourceforge.net and download and installthe VcXsrv - XServer No needs any guide, becasuse your need just run the setup and "next... " until the end. - After install the VcXsrv you have add just one "param": -ac as showed on screenshots. this params will be typed on 3rd screen when you run VcXsrv
Now, let's go to RAD Studio IDE to create a "new connection" between Delphi and PAServer in WSL Linux session;
Open your RAD Studio and go to "Tools -> Options" - Go to "Development -> Connection Profile Manager" and create your connection... - Create your FireMonkey (FMX) project and test your connection with WS Linux session - If necessary review your setup and Linux libs necessary to conclude the process...
to install WSL and convert it to WSL 2 see on Microsoft DocWiki - https://docs.microsoft.com/en-us/windows/wsl/install
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!
I dont know if I understood, but you can "DEBUG your app normally"
---------- Delphi can works directly Linux images using "Docker"! ---------- Then, you can "packages" your apps with all configurations necessary to deploy in your server, for example. You have a "container" in the end with all necessary to run your apps!
Think a "Container" like um "APK" in Android, where you have the minimal infra-structure for your app...
with "Docker" you dont needs "mount" your Linux environment to run your app, this will be done automatically.
As you see, using WSL, you create your environment. With "Docker", you take your environment for all place! Local or Remote! Some likes a particular "Cloud".
come soon, I'll try write a article about it.
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!