There are different ways to use a Linux application on windows. The popular methods are:
- Using Cygwin Environment
- Using MinGW/MinGW-64 Environment
- Using MSYS2 Environment
- Using Virtual Machines such as VirtualBox
- Using Windows Subsystem for Linux (wsl)
Windows Subsystem for Linux is the best and most efficient way of running a Linux-based application under Windows. WSL2 can be installed on Windows 11 without much effort. Even we can readily run GUI Linux applications under WSL since Windows 11 has a built-in X-server component.
The following article[3] explains WSL2 installation under Windows 11.
Installing WSL2 Under Windows 11 and Running GUI Linux Apps.
But running GUI applications under WSL of Windows 10 may sometime fail because of the wrong configuration of the third-party X-server software. This article explains the way of using WSL2 under Windows 10 and running X11 based GUI application under Windows 10.
The Windows Subsystem for Linux (WSL)
The Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup[1]. Particularly, by using the latest version of WSL2 under Windows 10 one can effortlessly run any Linux-based application including GUI applications under Windows 10.
Using WSL2, can install
(1) ns-2 and nam under Windows 10
(2) ns-3, NetAnim and NetSimulyzer under Windows 10
(3) OMNet++ with IDE under Windows 10
(4) SUMO with sumo-gui under Windows 10
There are countless possibilities for using WSL2 for a Linux-based research
Installing WSL2 Under Windows 10
One may find a detailed installation procedure for installing WSL2 under Windows 11 and using GUI based Linux application in[2]
Step 1: Install WSL2 using windows Powershell
Run Windows Powershell with Administrator privilege and issue the following command:
c:\Users\UserName\wsl --install
Restart your computer to finish the WSL installation on Windows 10.
Step 2: Install the choice of your Linux from Microsoft Store
In this example, after running Microsoft Store, we searched for Ubuntu and started to install it by pressing the get button
If we click the “get” button, it will start downloading ubuntu and then installing it.
Step 3: Running the Ubuntu Shell
Start the newly installed Ubuntu from the start menu.
Step 4: Updating Ubuntu Package Repository and Installing some basic X Applications
# apt-get update
if x11 applications are not found in your particular version of Linux, then you can install them as follows:
# apt-get install x11-apps
Step 5: Installing VcXsrv Windows X Server
Download a free version of X Server software called “VcXsrv” from the following link :
https://sourceforge.net/projects/vcxsrv/
After the successful install of VcXsrv you can start us using the shortcut “Xlaunch” from the start menu.
Now it will ask for some information to configure it. You may select the options as follows:
Select “Multiple Windows” option
Select “Start no client” option
Check the “Disable access control” option
Save the configuration and press “Finish” button.
Now we can see the X-server icon at the right side of the taskbar. It signifies the running status of X Server.
Step 6: Running an example X11 GUI application
Note: Before running anyX11 GUI application from the Linux terminal, we have to export the display environment variable.
In the following example, we are running a Linux GUI application called “xcalc”. If you notice that, the new Linux GUI application which is running under WSL2 Linux environment is getting displaying its “window” on the host (Windows 11) desktop itself
The Common Mistakes
If we do some mistake during the installation, commonly, it will end up with “Error: Can’t open display:” at the Linux terminal window.
There are two common mistakes that we make while setting Xserver to run Linux GUI applications. The following section explains those two mistakes and the solutions to overcome them.
Conclusion
With Windows 10 and WSL2 support, we can run any GUI-based Linux applications under windows. The future version of WSL may even have excellent support for applications that may use 3D graphics subsystem.
Now we can install any text-based as well as GUI-based Linux application under this Ubuntu which is running under WSL2. So, now it is possible to install ns-3 with ‘NetAnim‘ (GUI) or ns-2 with the ‘nam‘ (GUI) OMNet++ with its ‘IDE’ (GUI), SUMO (GUI).
Note : But, you can not get good performance in terms of speed if you are comparing it with a native Linux installation on the same hardware. Even WSL may perform poor than some other virtualization solutions such as Virtual box (where it is possible to use a minimal, stripped version of Linux for better performance). So, if you are going to do some serious research work, I will advice using a simulator such as ns-3, only under a native Linux operating system and on native hardware.
The following Procedure explains the installation of ns-3 and NetAnim Under Windows 11 with WSL2 :
The following Procedure explains the installation of OMNet++ IDE Under Windows 11 with WSL2 :
Installing OMNet++ IDE Under new Windows11 Version Using WSL
Meantime, one may try the following installation procedures under WSL2.
https://www.projectguideline.com/installing-aquasim-aqua3d-on-an-old-linux-under-virtualbox/
Installing Aquasim & Aqua3D on an old Linux under VirtualBox