How to Set Up WSL 2 for Working with FastReport and FastCube

2024-10-28

Software developers have long pondered the question, "How could we run Linux applications directly in Windows, without needing to use a separate virtual machine?"

The WSL technology provides a potential answer to this question. The history of WSL began in 2016. At the time, the implementation involved running Linux binary executables using system calls within the Windows kernel. The first version also included emulation of the Linux kernel through a layer to translate system calls.

The second version of WSL, released in 2019, featured full compatibility with system calls, a fully functional Linux kernel, support for GPUs, and support for Linux applications with a graphical user interface.

In this article, we will explore how to set up WSL 2 for working with FastReport and FastCube components in Lazarus for Linux.

 


 

Installing and Setting Up Ubuntu 24.04 in WSL 2

Launch the Windows command line as an administrator. To display a list of all available Linux distributions, you need to enter the command in the Windows command line and press Enter:

wsl --list --online or wsl -l -o

To install Ubuntu 24.04, run the following command:

wsl --install -d Ubuntu-24.04

After installing the distribution, you will be prompted to create a user account and password.

Windows Command Line

To install Ubuntu 24.04, you only need to run a few commands.

The Ubuntu 24.04 terminal is available from the Windows Start menu after installing the distribution. You can also launch the Linux kernel and enter the Ubuntu 24.04 terminal using the command from the Windows command line:

wsl -d Ubuntu-24.04

After installing Ubuntu 24.04, you need to update the packages. To update the installed packages, run the following commands in the Ubuntu 24.04 terminal:

$ sudo apt update && sudo apt upgrade && sudo apt dist-upgrade

Enter the user password and press Enter. Wait for the request to agree to update the packages. Enter Y and confirm by pressing Enter.

Updating Installed Packages

To install Nautilus, run this command in the terminal, and then enter the following command to directly launch Nautilus.

$ sudo apt install nautilus -y

$ nautilus

After installation, the Nautilus file manager is available from the Windows Start menu.

Nautilus File Manager

 


 

Installing and Setting Up Linux 11 Starterkit in WSL 2

The WSL 2 subsystem allows you to use any Linux distribution by importing it from a tar file. Run the Windows command line as administrator. Run the command to download the Linux rootfs image to the root of the C\: drive:

curl -o C:\alt-p11-rootfs-systemd-x86_64.tar.xz https://ftp.altlinux.org/pub/distributions/Linux/p11/images/cloud/x86_64/alt-p11-rootfs-systemd-x86_64.tar.xz

To import the distribution into WSL 2, you need to run the command in the Windows command line:

wsl --import Linux-11 C:\Linux-11 C:\alt-p11-rootfs-systemd-x86_64.tar.xz

After importing, the Linux hard disk image file will be located in C:\Linux-11\ext4.vhdx. In the Windows command line, run the command to display a list of all registered distributions. And then run the newly imported Linux-11 distribution

wsl -l -v

wsl -d Linux-11

After starting Linux, a terminal will open. In the WSL configuration file for this distribution, you need to enable the use of systemd:

# echo -e "[boot]\nsystemd=true\n" > /etc/wsl.conf

In order for systemd to work, you need to stop and restart the distribution. To do this, use the following commands:

# exit

wsl -t Linux-11

wsl -d Linux-11

To update packages, you need to run the following command, then wait for the request to agree to update packages. Enter Y and confirm by pressing Enter.

# apt-get update && apt-get dist-upgrade

To ensure correct font display, you need to install the package:  

# apt-get install fonts-ttf-ms

To install and run Lazarus, you need to download the command-line utility make, then install the Free Pascal compiler and Lazarus IDE:  

# apt-get install make

# apt-get install fpc && apt-get install fpc-src

# apt-get install lazarus

Installation is complete. To launch Lazarus, run the command:

# startlazarus

 


 

Installation of FastReport for Application Development in Linux

Before starting the installation of FastReport and FastCube components, you need to download the installation packages. In the Linux-11 terminal, run the command to install wget, then confirm your actions by entering Y and pressing Enter.  

# apt-get install wget

Download the trial versions of the FastReport and FastCube packages:  

# wget https://www.fast-report.com/public_download/fr.vcl/fast_report-trial.rpm

# wget https://www.fast-report.com/public_download/fr.vcl/fast_cube-trial.rpm

To install FastReport, run the command in the terminal:  

# apt-get install ./fast_report*.rpm

Before installing the FastReport packages, you need to compile the packages included with Lazarus and install additional libraries:

# lazbuild --build-ide= --add-package /usr/lib64/lazarus/components/tachart/print/tachartprint.lpk

# lazbuild --build-ide= --add-package /usr/lib64/lazarus/components/tachart/tachartlazaruspkg.lpk

# apt-get install sqlite3 libsqlite3-devel

After that, sequentially run the following commands to compile the FastReport packages:  

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/fs_lazarus.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/fr_lazarus.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/frxe_lazarus.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/frCS_lazarus.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/frxchartlazarus.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/frxlazdbf.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/frxSmartMemo_Laz.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/fqb*.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/frxlazsqlite.lpk

# lazbuild --build-ide= --add-package /usr/share/FastReport*/Lpks/frxPDFlazarus.lpk

 


 

Installation of FastCube for Application Development in Linux

Now let's move on to installing FastCube. Run the following command in the terminal:

# apt-get install ./fast_cube*.rpm

Then sequentially run the following commands to compile the FastCube packages:  

# lazbuild --build-ide= --add-package /usr/share/FastCube*/Lpks/fcxScript.lpk

# lazbuild --build-ide= --add-package /usr/share/FastCube*/Lpks/fcxLazarus.lpk

# lazbuild --build-ide= --add-package /usr/share/FastCube*/Lpks/fcxCharting.lpk

# lazbuild --build-ide= --add-package /usr/share/FastCube*/Lpks/fcxprint.lpk

# lazbuild --build-ide= --add-package /usr/share/FastCube*/Lpks/fcxprintTee.lpk

# lazbuild --build-ide= --add-package /usr/share/FastCube*/Lpks/fcxexport.lpk

 


 

Compiling and Running FastReport Demo in Lazarus

At this point, the installation of FastReport and FastCube is complete. Finally, you can try to compile and run the FastReport Demo. To launch Lazarus, run the command in the terminal:  

# startlazarus --skip-last-project

In the Lazarus main menu, open the "Project" -> "Open Project..." option. In the dialog, select the project:  

/usr/share/FastReport - Trial/Demos/FPC/FastReport/FastReportDemo.lpi

After opening the project, press the F9 key to compile and run.

This concludes the detailed setup of WSL 2 for working with FastReport and FastCube components in Lazarus for Linux. For any questions, please contact our technical support at support@fast-report.com. Enjoy using it!

August 08, 2024

How to install FastReport .NET and its components on Windows

Step-by-step instructions for online and manual installation via the FastReport registration code.NET and its components in Windows.
April 09, 2024

How to work with FastReport Avalonia on .NET 8 in Visual Studio Code for Linux

In this article, we will look at how to run FastReport Avalonia on .NET 8 on the Linux operating system using Visual Studio.
October 04, 2023

How to generate a report from an ASP.NET Core application using FastReport.Core.Skia

We tell you how to generate a report on Windows and Linux using FastReport.Core.Skia and a private NuGet server.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2024 Fast Reports Inc.