跳到主要内容

Linux Installation

Linux is an operating system, similar to Windows, but with many different versions due to the nature of being open source and fully customizable. To install Linux, you must choose an install method and choose a Linux distribution.

To install Linux:

  1. Choose an install method: Windows Subsystem for Linux (WSL), bare metal Linux, or create a Virtual Machine (VM) to run Linux locally.
  2. Choose a Linux distribution: Ubuntu, Debian, Kali Linux, openSUSE, ArchLinux, etc.
  3. Follow the steps for your preferred install method:
  4. After installing Linux: Get familiar with your distribution's package manager, update and upgrade the packages available, and get familiar with the other Linux resources at Microsoft, such as training courses, Linux-versions of popular tools, news, and Open Source events.

Step 1 - Choose a method to install Linux

The choice of which method to use for installing Linux depends on your needs and preferences.

  • Only want to run Linux as your primary operating system? If you are good with a slightly more complicated install process and don't need access to Windows tools (like Outlook, Teams, Word, PowerPoint, etc), you can run Linux on bare metal to access the full potential of your hardware without any overhead from virtualization or emulation.
  • New to using Linux? We recommend starting with Windows Subsystem for Linux (WSL) as it's the easiest way to get up and running.

Learn more about these options below.

Windows Subsystem for Linux (WSL)

Available to those with a Windows machine, this is the most simple way to install Linux. Just run the Linux install command: wsl --install to install the Ubuntu distribution.

This method uses virtualization to integrate the Windows operating system (OS) with the Linux OS (running on an actual Linux kernel). You can add as many different Linux distributions as you please and run your favorite Linux tools, including GUI apps, alongside your favorite Windows tools. You can also mix and match Bash and PowerShell commands in the same command line. A Linux file system hosts your project files, while a separate Windows file systems hosts any developer tools, such as VS Code, that you'd like to work on the files with. This method of running Linux is highly efficient and performant. Once you choose a Linux distribution or opt to use the default Ubuntu distro, follow the instructions to Use the install Linux command with Windows Subsystem for Linux or learn more in the WSL documentation.

Create a Virtual Machine (VM)

Available to everyone regardless if you're using a Windows or MacOS-based machine, but will require a virtualization software, if creating a VM directly on your machine (locally).

A VM is a digital version of a physical computer and is a popular option for running Linux in environments that may require you to scale the level of hardware support (Memory and processing power required) and the level of Security (antimalware, encryption, backups, policy management, etc).

Like with WSL, you can create VM instances of as many different Linux distributions as you'd like, running them in an isolated environment, free from any conflicts and great for software development testing. While running a Linux distribution on WSL has slightly faster performance, a Linux VM is easier to clone or migrate.

Creating a VM on your local machine requires virtualization using a hypervisor. Windows includes a "type 1" hypervisor called Hyper-V to run virtualization directly on your device hardware. There are also "type 2" hypervisors that run on top of the operating system, like VirtualBox or VMware Workstation Pro. If you are using a Mac, the most commonly recommended hypervisor is Parallels Desktop, though this is a paid service. VirtualBox also supports both Windows and MacOS.

You are responsible for managing the virtual machine when using a hypervisor, including allocating resources like memory and disk space, and ensuring that it is secure and up-to-date. This requires more technical expertise than some of the other options and may not be as scalable or fault-tolerant.

Once you've chosen a distribution and decided whether you want to run the VM locally, using a hypervisor, follow the instructions to Create a Linux Virtual Machine locally using a Hypervisor.

Bare metal Linux

Bare metal Linux just means that Linux is running directly on the device hardware. This install method requires you to create a bootable USB drive by downloading an iso install file from the site hosting your chosen Linux distribution. You will need to use a Windows computer (or any desktop device with an existing OS) to create this drive.

Many users choose the traditional method of installing bare metal Linux on a device that is also running Windows and using the "dual boot" method. To boot Linux and Windows, you need to partition your hard drive to create separate spaces for both the Linux and Windows OS. The performance speed between WSL, virtual machines, and bare metal Linux has become so close that few developers choose this method due to the overhead of needing to restart (reboot) your device any time you want to switch between the operating systems. If you choose the bare metal Linux install route, you may also need to deal with potential driver issues or hardware compatibility problems that may arise with Linux on some devices.

You can find a list of Popular Linux Distributions available for download on Linux.org. Once you've chosen a distro, follow the instructions to Create a bootable USB to install bare-metal Linux.

Step 2 - Choose a Linux distribution

The different versions of Linux are called "distributions" (sometimes shortened to “distros”). So there isn’t actually a way to just “install Linux”, you first need to choose which distribution that uses the Linux kernel you want to download and install. There are over 600 active Linux distributions, such as Ubuntu, Debian, Kali Linux, openSUSE, and more. There are a number of factors to consider in choosing a distribution, such as:

Required Linux experience

If you’re new to Linux, you may want to start with Ubuntu. This is one of the most common starting places for Linux users due to the level of support and ease of use. Ubuntu offers a desktop-version and a server-version depending on how you plan to use it. The specific tasks that the operating system will be responsible for may help you determine which distribution to use. Arch Linux is a popular choice for those who want a highly customizable, do-it-yourself approach that is still stable and well-supported by a large user base. It is a much more complicated place to start, but can help you to get a better understanding of how Linux works due to the amount of custom configuration.

System requirements

A minimal, or "lightweight", distribution means a small footprint, with lower memory and processing speed requirements. Alpine Linux is a popular option where users will find most features disabled or not installed by default, but still has everything you need for a containerized app. Security needs: Some Linux users may have specific security concerns to consider. Kali Linux is an example of a distro designed for security tasks, such as Penetration Testing, Security Research, Computer Forensics and Reverse Engineering.

Community support

A large user community that consistently contributes to the distribution, fixing bugs, adding features, helping with questions, etc. is another good consideration. Ubuntu is one of the most popular distos. Many other distros rapidly grow popular as the needs and preferences of the user community change. The Linux.org site has resources to help you assess what's available, well-supported, or growing in popularity.

Step 3 - Follow install method instructions

Install Linux with Windows Subsystem for Linux

To install Linux on a Windows PC, use the install Linux command.

  1. Open PowerShell or Windows Command Prompt in administrator mode by right-clicking and selecting "Run as administrator".
  2. Enter the Linux install command: wsl --install.
  3. Restart your machine.

Install Linux command options

By default, the install command will use the Ubuntu distribution of Linux. You can see the other distributions that are available in the Microsoft Store by entering the command: wsl -l -o. If you'd like to install a distribution other than Ubuntu, just add -d to the command with the name of the distribution you'd like to install:

wsl --install -d <Distro Name>

Some distributions are not official supported, but you can find them in open source projects. For example, ArchLinux is a great distribution and can be installed using GitHub - yuk7/ArchWSL.

Create a Linux Virtual Machine locally using a hypervisor

To create a Linux VM that is hosted on your local machine using a hypervisor, you can choose a virtual machine software:

The most obvious distinction between the two is that VirtualBox is a free and open-source software programme.

Create a bootable USB drive to install bare-metal Linux

If you want bare-metal Linux, whether to run a distribution alone on a device or to dual-boot between the distribution and Windows, here are the steps:

  1. Download an image file for your chosen Linux distribution. This is usually an ISO file. As an example, you can find an image file for the most recent version of Ubuntu at Download Ubuntu Desktop. Some Linux distributions may require you to verify the image signature before downloading. Some Linux distributions also cannot be installed unless Windows Secure Boot is disabled (which is not recommended).
  2. Create a bootable USB drive. You will typically need a USB drive with at least 16gb of space. You will also need software to create the bootable drive. There are many options (such as balenaEtcher, Rufus, UNetbootin, etc.). Often the download site for your chosen Linux distribution will recommend which startup disk creater software to use.
  3. Boot your device from the USB drive. When restarting the device, you will need to enter the boot menu. This is typically done by holding down the F12 key during startup. You can then select the USB drive containing your Linux distribution ISO to install from.
  4. Select install options. Typically the installer for your Linux distribution will include a set of installation steps that will involve choosing options about whether you want to include certain features, third-party software packages, etc. You may also need to specify whether to erase the disk in the case that this Linux distro will be the only operating system, or to use a partition, if you plan to run multiple operating systems. You may also be asked about whether you'd like to enable encryption.
  5. Finally, as with any Linux installation, you will be asked to create a user name and password.

Step 4 - After installing Linux

Once you have successfully installed a Linux distribution, there are a few more important steps:

  1. Get familiar with the preferred package manager used by your chosen Linux distribution. Linux uses package manager's to download and update any software that you plan to use. For example, Ubuntu uses the Advanced Packaging Tool (apt), ArchLinux uses the Package Manager (pacman).
  2. Use your distribution's package manager to update and upgrade your distribution. Software packages in a stable release of a Linux distribution are often outdated. It is recommended to regularly run an update. You may also want to run an upgrade, which installs newer versions of any packages that you've already installed. For example, if you're using Ubuntu, run: sudo apt update && sudo apt upgrade; if you're using ArchLinux, run: sudo pacman -Syu.
  3. Learn more about the Linux tools, such as Visual Studio Code, vim, git to speed up your development and usage.