How to Run Linux Software on Windows
Last Updated :
07 Nov, 2022
Although Windows users could also wish to run Linux software, Linux users frequently desire to run Windows applications on Linux. You can use Linux applications without leaving Windows, whether you're searching for an improved development environment or strong command-line tools. There are several alternatives to purchasing a new laptop to run the OS for running Linux applications on Windows. Since anybody can set up a virtual machine with a free Linux distribution without the requirement for software licenses, it is simpler than running Windows software on Linux.
There are two popular methods for running Linux software on Windows, they are
- WSL (Windows Subsystem for Linux)
- Virtual Machine
In this article, we'll discuss how to implement both of these methods briefly.
Note: If you're using Windows 11, the below steps can be omitted since Windows 11 can run Linux GUI apps out of the box.
Method 1: Windows Subsystem for Linux (WSL)
The WSL is a feature available in Windows that'll enable one to run the Linux file system, along with Linux command-line tools and GUI applications, directly on Windows. And they can be completely integrated with Windows tools. But the only drawback of WSL is that they are mainly targeted for command-line tools and cannot be used for graphics-intensive programs.
Step 1: Enable the Windows Subsystem for Linux optional feature
Start PowerShell or Command-Prompt with administrator privileges and enter the following command to enable the WSL services on windows, this may be enabled by default in some systems.
Enable-WindowsOptionalFeature -Online -FeatureName -Microsoft-Windows-Subsystem-Linux
Alternatively, you can enable it using the 'programs and features' settings.
Step 2: Enable the Virtual Machine platform and Install WSL2
The virtual machine has to be enabled before installing WSL, this can be done using the following command.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Once it has been enabled, install WSL by entering the following command in PowerShell or Command-Prompt.
wsl --install
Set the default version of WSL to 2
wsl --set-default-version 2
Step 3: Download and Install a Linux distribution
You can download and install any distro of your choice, for the sake of convenience we'll be installing ubuntu. Navigate to Microsoft Store and search for 'ubuntu' then install the application. Once downloaded open the app and follow through with the installation wizard. Once the installation process is complete you'll be left with the following terminal. Linux Command-line tools can be executed using this terminal.
Step 4: Download and Install VcXsrv Windows X Server
The X server is a third-party display manager which is a provider of graphics resources and keyboard/mouse events. Download VcXsrv Windows X Server from the link provided - VcXsrv Windows X Server
Once the setup is complete, make sure to disable the access control option to avoid running into errors while running the GUI applications.
Step 5: Setting up the DISPLAY environment variable
Starting the bash terminal, we have to set the DISPLAY environment variable so it uses the windows host IP address since WSL2 and Windows host doesn't share the network device. Use any of the following commands to set the DISPLAY variable.
export DISPLAY=$(ip route|awk '/^default/{print $3}'):0.0
export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"
Run the below command to check whether the variable is properly set or not.
echo $DISPLAY
The variable is reset every time a session is restarted so as to avoid running the command each and every time we open the terminal. We can add the command at the end of the /etc/bash.bashrc file. Open the bashrc file using nano or vim and then add the command at the end.
sudo nano /etc/bash.bashrc
Step 6: Create a .xsession file in the user's home directory
The following command can be used to create a .xsession file in the user's home directory /home/<user>/.xsession with the content xfce4-session.
echo xfce4-session > ~/.xsession
Now Windows desktop can run Linux GUI apps.
Method 2: Using a Virtual Machine
Using a Virtual Machine is the most efficient and easy way to run Linux apps on Windows, we'll briefly discuss the installation and setting up a virtual machine with a Linux OS.
Step 1: Download and Install a Virtual Machine
Download a virtual machine of your choice (Oracle or VMware), here we'll be using a VMware workstation. Download the software from the below link and follow the installation process. Refer to this How to Install VirtualBox on Windows GeeksforGeeks article for setting up a virtual machine using oracle.
Download VMware Workstation.
Step 2: Download a Linux distribution of your choice
You can download any Linux distribution, below are some of the most popular choices along with their links.
Step 3: Installing the OS
Open VMware Workstation, and click on the 'Create new Virtual Machine'. And then select the installer disc image option and choose the downloaded Linux operating system's ISO file.
Specify the disk capacity and click on next.
Name the virtual machine and move on to the next step.
Start the virtual machine to boot up the OS and follow the installation steps. Once the installation is complete you can run any Linux GUI apps using the virtual machine.
Step 4: Starting and Running the applications
You can now run any Linux application while within the virtual machines environment, here are some examples.
$ gedit
$ sudo apt install x11-apps -y
$ xcalc
$ xclock
$ xeyes
Similar Reads
How to run Linux Commands on Windows 10?
It is a dilemma when you want to switch from one operating system to another. This is a common case when you switch from Windows to Linux. Either you store your data and then uninstall Windows to install Linux and then transfer your data or you can have a dual boot system where you encounter an opti
2 min read
How to install Ruby on Windows?
Prerequisite: Ruby Programming Language Before we start with the installation of Ruby on Windows, we must have first-hand knowledge of what Ruby is?. Ruby is a pure Object-Oriented language developed by Yukihiro Matsumoto (also known as Matz in the Ruby community) in the mid-1990s in Japan. Everythi
2 min read
How to Download and Install Proteus Software on Windows?
Proteus is Software used to draw and design and integrate electronic circuits. After designing circuits by taking various parts like Switch, Microcontrollers, LED it also provides to simulate and test designed circuit. After testing in real-time we can go to make this circuit practically in our phys
3 min read
How to Install Seaborn on Windows?
In this article, we will look into the process of installing Python Seaborn on Windows. Prerequisites:PythonPIP or conda (Depending upon user preference)For PIP Users: PIP users can open up the command prompt and run the below command to install Python Seaborn Package on Windows: pip install Seaborn
1 min read
How to Install Power ISO on Windows
Are you looking to install Power ISO on Windows? Power ISO is a popular tool used for managing, editing, and creating disk image files like ISO, BIN, and others. Whether you're trying to download Power ISO for the first time or need a quick refresher on how to set it up, this guide will take you thr
4 min read
How to Run Windows App on Linux Using Wine?
Running Windows apps on Linux using Wine is a great way to enjoy the functionality of Windows software on a Linux system without needing a virtual machine. Wine (Wine Is Not an Emulator) is a powerful tool that allows Windows applications to run on Linux by translating Windows API calls into POSIX c
4 min read
How to install Scala on Windows?
Prerequisite: Introduction to Scala Before, we start with the process of Installing Scala on our System, we must have first-hand knowledge of What the Scala Language is and what it actually does? Scala is a general-purpose, high-level, multi-paradigm programming language. It is a pure object-oriente
3 min read
How to Install SWI Prolog on Windows?
SWI Prolog: SWI Prolog is computer software that is used to run programs written in Prolog language. It is developed by Jan Wielemaker. It is free software written in C language and can be run on different platforms like Linux, Unix, windows, mac, etc. SWI stands for Social-Wetenschappelijke Informa
4 min read
How to install RubyGems in Windows?
RubyGems is a Ruby package manager that provides Ruby programs and libraries (also known as Gems) and the tools associated with installing and managing Ruby packages and servers. The Ruby package management, RubyGems, makes it simple to install, manage, and utilize tools and libraries for Ruby appli
3 min read
How to Install Keras in Windows?
Keras is a neural Network python library primarily used for image classification. In this article we will look into the process of installing Keras on a Windows machine. Pre-requisites: The only thing that you need for installing Numpy on Windows are: Python PIP or Conda (depending upon user prefere
2 min read