- How to Remove Linux and Install Windows on Your Computer
- Summary
- More Information
- Examples of Linux Partition Tables
- Single SCSI drive
- Multiple SCSI drives
- Single IDE drive
- Multiple IDE drives
- What is the Windows Subsystem for Linux?
- What is WSL 2?
- Install WSL
- Prerequisites
- Install
- Change the default Linux distribution installed
- Set up your Linux user info
- Set up and best practices
- Want to try the latest WSL preview features?
- Manual installation steps for older versions of WSL
- Step 1 — Enable the Windows Subsystem for Linux
- Step 2 — Check requirements for running WSL 2
- Step 3 — Enable Virtual Machine feature
- Step 4 — Download the Linux kernel update package
- Step 5 — Set WSL 2 as your default version
- Step 6 — Install your Linux distribution of choice
- Troubleshooting installation
- Downloading distributions
- Install Windows Terminal (optional)
How to Remove Linux and Install Windows on Your Computer
For a Microsoft Windows XP version of this article, see 314458.
Summary
This article describes how you can remove the Linux operating system from your computer, and install a Windows operating system. This article also assumes that Linux is already installed on the hard disk using Linux native and Linux swap partitions, which are incompatible with the Windows operating system, and that there is no free space left on the drive.
Windows and Linux can coexist on the same computer. For additional information, refer to your Linux documentation.
More Information
To install Windows on a system that has Linux installed when you want to remove Linux, you must manually delete the partitions used by the Linux operating system. The Windows-compatible partition can be created automatically during the installation of the Windows operating system.
IMPORTANT: Before you follow the steps in this article, verify that you have a bootable disk or bootable CD-ROM for the Linux operating system, because this process completely removes the Linux operating system installed on your computer. If you intend to restore the Linux operating system at a later date, verify that you also have a good backup of all the information stored on your computer. Also, you must have a full release version of the Windows operating system you want to install.
Linux file systems use a «superblock» at the beginning of a disk partition to identify the basic size, shape, and condition of the file system.
The Linux operating system is generally installed on partition type 83 (Linux native) or 82 (Linux swap). The Linux boot manager (LILO) can be configured to start from:
The hard disk Master Boot Record (MBR).
The root folder of the Linux partition.
The Fdisk tool included with Linux can be used to delete the partitions. (There are other utilities that work just as well, such as Fdisk from MS-DOS 5.0 and later, or you can delete the partitions during the installation process.) To remove Linux from your computer and install Windows:
Remove native, swap, and boot partitions used by Linux:
Start your computer with the Linux setup floppy disk, type fdisk at the command prompt, and then press ENTER.
NOTE: For help using the Fdisk tool, type m at the command prompt, and then press ENTER.
Type p at the command prompt, and then press ENTER to display partition information. The first item listed is hard disk 1, partition 1 information, and the second item listed is hard disk 1, partition 2 information.
Type d at the command prompt, and then press ENTER. You are then prompted for the partition number you want to delete. Type 1, and then press ENTER to delete partition number 1. Repeat this step until all the partitions have been deleted.
Type w, and then press ENTER to write this information to the partition table. Some error messages may be generated as information is written to the partition table, but they should not be significant at this point because the next step is to restart the computer and then install the new operating system.
Type q at the command prompt, and then press ENTER to quit the Fdisk tool.
Insert either a bootable floppy disk or a bootable CD-ROM for the Windows operating system on your computer, and then press CTRL+ALT+DELETE to restart your computer.
Install Windows. Follow the installation instructions for the Windows operating system you want to install on your computer. The installation process assists you with creating the appropriate partitions on your computer.
Examples of Linux Partition Tables
Single SCSI drive
Multiple SCSI drives
Single IDE drive
Multiple IDE drives
Also, Linux recognizes more than forty different partition types, such as:
FAT 16 > 32 M Primary (Type 06)
FAT 16 Extended (Type 05)
FAT 32 w/o LBA Primary (Type 0b)
FAT 32 w/LBA Primary (Type 0c)
FAT 16 w/LBA (Type 0e)
FAT 16 w/LBA Extended (Type 0f)
Note that there are other ways to remove the Linux operating system and install Windows than the one mentioned above. The preceding method is used in this article because the Linux operating system is already functioning and there is no more room on the hard disk. There are methods of changing partition sizes with software. Microsoft does not support Windows installed on partitions manipulated in this manner.
Another method of removing an operating system from the hard disk and installing a different operating system is to use an MS-DOS version 5.0 or later boot disk, a Windows 95 Startup disk, or a Windows 98 Startup disk that contains the Fdisk utility. Run the Fdisk utility. If you have multiple drives, there are 5 choices; use option 5 to select the hard disk that has the partition to be deleted. After that, or if you have only one hard disk, choose option 3 («Delete partition or logical DOS drive»), and then choose option 4 («Delete non-DOS partition»). You should then see the non-DOS partitions you want to delete. Typically, the Linux operating system has two non-DOS partitions, but there may be more. After you delete one partition, use the same steps to delete any other appropriate non-DOS partitions.
After the partitions are deleted, you can create partitions and install the operating system you want. You can only create one primary partition and an extended partition with multiple logical drives by using Fdisk from MS-DOS version 5.0 and later, Windows 95, and Windows 98. The maximum FAT16 primary partition size is 2 gigabytes (GB). The largest FAT16 logical drive size is 2 GB. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
105074 MS-DOS 6.2 Partitioning Questions and Answers
If you are installing Windows NT 4.0 or Windows 2000, the Linux partitions can be removed and new partitions created and formatted with the appropriate file system type during the installation process. Windows allows you to create more than one primary partition. The largest partition that Windows NT 4.0 allows you to create during installation is 4 GB because of the limitations of the FAT16 file system during installation. Also, the 4-GB partitions use 64-KB cluster sizes. MS-DOS 6.x and Windows 95 or Windows 98 do not recognize 64-KB cluster file systems, so this file system is usually converted to NTFS during installation. Windows 2000, unlike Windows NT 4.0, recognizes the FAT32 file system. During the installation of Windows 2000, you can create a very large FAT32 drive. The FAT32 drive can be converted to NTFS after the installation has completed if appropriate.
Источник
What is the Windows Subsystem for Linux?
The Windows Subsystem for Linux 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 dualboot setup.
- Choose your favorite GNU/Linux distributions from the Microsoft Store.
- Run common command-line tools such as grep , sed , awk , or other ELF-64 binaries.
- Run Bash shell scripts and GNU/Linux command-line applications including:
- Tools: vim, emacs, tmux
- Languages: NodeJS, Javascript, Python, Ruby, C/C++, C# & F#, Rust, Go, etc.
- Services: SSHD, MySQL, Apache, lighttpd, MongoDB, PostgreSQL.
- Install additional software using your own GNU/Linux distribution package manager.
- Invoke Windows applications using a Unix-like command-line shell.
- Invoke GNU/Linux applications on Windows.
What is WSL 2?
WSL 2 is a new version of the Windows Subsystem for Linux architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. Its primary goals are to increase file system performance, as well as adding full system call compatibility.
This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1 (the current widely available version).
Individual Linux distributions can be run with either the WSL 1 or WSL 2 architecture. Each distribution can be upgraded or downgraded at any time and you can run WSL 1 and WSL 2 distributions side by side. WSL 2 uses an entirely new architecture that benefits from running a real Linux kernel.
Источник
Install WSL
Prerequisites
You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.
To check your Windows version and build number, select Windows logo key + R, type winver, select OK. You can update to the latest Windows version in the Settings menu or using the Windows Update Assistant.
If you’re running an older build, or just prefer not to use the install command and would like step-by-step directions, see WSL manual installation steps for older versions.
Install
You can now install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in PowerShell or Windows Command Prompt and then restarting your machine.
This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default, see below to change this).
The first time you launch a newly installed Linux distribution, a console window will open and you’ll be asked to wait for files to de-compress and be stored on your machine. All future launches should take less than a second.
Change the default Linux distribution installed
By default, the installed Linux distribution will be Ubuntu. This can be changed using the -d flag.
- To change the distribution installed, enter: wsl —install -d . Replace with the name of the distribution you would like to install.
- To see a list of available Linux distributions available for download through the online store, enter: wsl —list —online or wsl -l -o .
- To install additional Linux distributions after the initial install, you may also use the command: wsl —install -d .
If you want to install additional distributions from inside a Linux/Bash command line (rather than from PowerShell or Command Prompt), you must use .exe in the command: wsl.exe —install -d or to list available distributions: wsl.exe -l -o .
If you run into an issue during the install process, check the installation section of the troubleshooting guide.
Set up your Linux user info
Once you have installed WSL, you will need to create a user account and password for your newly installed Linux distribution. See the Best practices for setting up a WSL development environment guide to learn more.
Set up and best practices
We recommend following our Best practices for setting up a WSL development environment guide for a step-by-step walk-through of how to set up a user name and password for your installed Linux distribution(s), using basic WSL commands, installing and customizing Windows Terminal, set up for Git version control, code editing and debugging using the VS Code remote server, good practices for file storage, setting up a database, mounting an external drive, setting up GPU acceleration, and more.
Want to try the latest WSL preview features?
Try the most recent features or updates to WSL by joining the Windows Insiders Program. Once you have joined Windows Insiders, you can choose the channel you would like to receive preview builds from inside the Windows settings menu to automatically receive any WSL updates or preview features associated with that build. You can choose from:
- Dev channel: Most recent updates, but low stability.
- Beta channel: Ideal for early adopters, more reliable builds than the Dev channel.
- Release Preview channel: Preview fixes and key features on the next version of Windows just before its available to the general public.
Источник
Manual installation steps for older versions of WSL
For simplicity, we generally recommend using the wsl —install to install Windows Subsystem for Linux, but if you’re running an older build of Windows, that may not be supported. We have included the manual installation steps below. If you run into an issue during the install process, check the installation section of the troubleshooting guide.
Step 1 — Enable the Windows Subsystem for Linux
You must first enable the «Windows Subsystem for Linux» optional feature before installing any Linux distributions on Windows.
Open PowerShell as Administrator and run:
We recommend now moving on to step #2, updating to WSL 2, but if you wish to only install WSL 1, you can now restart your machine and move on to Step 6 — Install your Linux distribution of choice. To update to WSL 2, wait to restart your machine and move on to the next step.
Step 2 — Check requirements for running WSL 2
To update to WSL 2, you must be running Windows 10.
- For x64 systems: Version 1903 or higher, with Build 18362 or higher.
- For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.
- Builds lower than 18362 do not support WSL 2. Use the Windows Update Assistant to update your version of Windows.
To check your version and build number, select Windows logo key + R, type winver, select OK. Update to the latest Windows version in the Settings menu.
If you are running Windows 10 version 1903 or 1909, open «Settings» from your Windows menu, navigate to «Update & Security» and select «Check for Updates». Your Build number must be 18362.1049+ or 18363.1049+, with the minor build # over .1049. Read more: WSL 2 Support is coming to Windows 10 Versions 1903 and 1909.
Step 3 — Enable Virtual Machine feature
Before installing WSL 2, you must enable the Virtual Machine Platform optional feature. Your machine will require virtualization capabilities to use this feature.
Open PowerShell as Administrator and run:
Restart your machine to complete the WSL install and update to WSL 2.
Step 4 — Download the Linux kernel update package
Download the latest package:
If you’re using an ARM64 machine, please download the ARM64 package instead. If you’re not sure what kind of machine you have, open Command Prompt or PowerShell and enter: systeminfo | find «System Type» . Caveat: On non-English Windows versions, you might have to modify the search text, translating the «System Type» string. You may also need to escape the quotations for the find command. For example, in German systeminfo | find ‘»Systemtyp»‘ .
Run the update package downloaded in the previous step. (Double-click to run — you will be prompted for elevated permissions, select вЂyes’ to approve this installation.)
Once the installation is complete, move on to the next step — setting WSL 2 as your default version when installing new Linux distributions. (Skip this step if you want your new Linux installs to be set to WSL 1).
Step 5 — Set WSL 2 as your default version
Open PowerShell and run this command to set WSL 2 as the default version when installing a new Linux distribution:
Step 6 — Install your Linux distribution of choice
Open the Microsoft Store and select your favorite Linux distribution.
The following links will open the Microsoft store page for each distribution:
From the distribution’s page, select «Get».
The first time you launch a newly installed Linux distribution, a console window will open and you’ll be asked to wait for a minute or two for files to de-compress and be stored on your PC. All future launches should take less than a second.
CONGRATULATIONS! You’ve successfully installed and set up a Linux distribution that is completely integrated with your Windows operating system!
Troubleshooting installation
If you run into an issue during the install process, check the installation section of the troubleshooting guide.
Downloading distributions
There are some scenarios in which you may not be able (or want) to, install WSL Linux distributions using the Microsoft Store. You may be running a Windows Server or Long-Term Servicing (LTSC) desktop OS SKU that doesn’t support Microsoft Store, or your corporate network policies and/or admins do not permit Microsoft Store usage in your environment. In these cases, while WSL itself is available, you may need to download Linux distributions directly.
If the Microsoft Store app is not available, you can download and manually install Linux distributions using these links:
This will cause the .appx packages to download to a folder of your choosing.
If you prefer, you can also download your preferred distribution(s) via the command line, you can use PowerShell with the Invoke-WebRequest cmdlet. For example, to download Ubuntu 20.04:
If the download is taking a long time, turn off the progress bar by setting $ProgressPreference = ‘SilentlyContinue’
You also have the option to use the curl command-line utility for downloading. To download Ubuntu 20.04 with curl:
In this example, curl.exe is executed (not just curl ) to ensure that, in PowerShell, the real curl executable is invoked, not the PowerShell curl alias for Invoke-WebRequest.
Once the distribution has been downloaded, navigate to the folder containing the download and run the following command in that directory, where app-name is the name of the Linux distribution .appx file.
If you are using Windows server, or run into problems running the command above you can find the alternate install instructions on the Windows Server documentation page to install the .appx file by changing it to a zip file.
Once your distribution is installed, follow the instructions to create a user account and password for your new Linux distribution.
Install Windows Terminal (optional)
Using Windows Terminal enables you to open multiple tabs or window panes to display and quickly switch between multiple Linux distributions or other command lines (PowerShell, Command Prompt, PowerShell, Azure CLI, etc). You can fully customize your terminal with unique color schemes, font styles, sizes, background images, and custom keyboard shortcuts. Learn more.
Источник