CentOS 8 or any other of its version is not officially available on Windows 10 App store for WSL- Windows subsystem for Linux, however, you can still install and use it.
Microsoft has continuously shown its love towards Linux and that can be seen in WSL. With the latest Windows 10 May update, the WSL 2, an upgraded version of the previous WSL 1 will be available for regular users. The benefit of that is, now we will have a full-fledged Linux kernel to operate various Linux distros such as Ubuntu, Debian Kali, SUSE, and more… Recently, Ubuntu 20.04 LTS, the latest version of this Linux is available to download and install on Windows 10 for WSL but sorry to say, we don’t have popular CentOS server Linux there. Perhaps, it is because of CentOS’s less popularity among standard Desktop Linux users. However, if you are a developer or just a Linux enthusiast and want to use CentOS 8 on Windows 10 WSL, here is the tutorial on that.
- WSL on Windows 10
- Internet connection to download the required files.
Step 1: Enable WSL on your System
If you already have Windows subsystem for Linux enabled on your system then you can move to the next step. However, those yet need to Turn it ON, simply start the Powershell as Administrator and copy-paste the below command in it. Once the process gets completed, restart your system.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Step 2: Download CentOS 8 WSL files
Well, to get the CentOS WSL Linux app, we don’t need to visit Windows 10 store because it is not there, instead of that it is available on Github as an open-source project developed by some Japanese developer, named yuk7 (profile name). Therefore go to his Github project page and under the CentOS WSL release, you will get the latest 8.1 version. But remember to use this release you should be on the latest Windows 10 May update 2004 or later. Otherwise, you can run the CentOS 7 WSL app.
Step 3: Unzip CentOS8.zip
The downloaded file will be in zipped format, thus simply right-click and unzip it somewhere you won’t delete the file accidentally.
Step 3: Install CentOS 8 on WSL
Open the extracted folder and run the CentOS8.exe file. If Windows shows some suspicion on that, just select the option “Run Anyway”.
In a few minutes, it will register this new Linux app under the WSL feature of Windows 10.
Step 4: Run the Linux app
Now, again run the same CentOS8 executable file present inside the extracted folder, but this time you will see the command line with the root user. Or Simply in the windows 10 search box type CentOS.
To test everything is working fine, we ran a system update command. You can do the same as well.
By default, the root user is without any password and if you want, you can set one.
Furthermore, those who want to run it under WSL 2, can see this tutorial: how to run a Linux app on WSL 2.
Uninstall CentOS 8 from WSL (optional)
In the future, if you want to delete this Linux app then don’t just delete the CentOS 8 unzipped folder directly otherwise it will create a problem in reinstalling the same, thus properly deregister and then delete the files.
- Open its folder and press & hold shift and right-click inside that folder.
- Select Open Powershell window here.
- Run command:
The output for the above command:
PS C:\Users\Raj\Desktop\CentOS8> ./CentOS8.exe clean This will remove this distro (CentOS8) from the filesystem. Are you sure you would like to proceed? (This cannot be undone) Type "y" to continue:Y Accepting is required to proceed.
So, this was a simple tutorial on running CentOS 8 server on Windows 10 WSL.
Note: If you get this error in the future-
RPM: error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch RPM: error: cannot open Packages index using db5 - (-30969) RPM: error: cannot open Packages database in /var/lib/rpm The downloaded packages were saved in cache until the next successful transaction. You can remove cached packages by executing 'dnf clean packages'. Error: Could not run transaction.
Then simply run-
sudo rm /var/lib/rpm/.rpm.lock
Note: If you get an error:
Failed to download metadata for repo ‘AppStream’ [CentOS]
Then follow the below-given steps:
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
sudo yum update -y
How to Enable Auto-Indent for Python Code in Notepad++
Internet Web Cookies: A Guide to Personalized Privacy Online
How to install and use the same WhatsApp account on up to 4 smartphones
How to calculate the standard deviation & mean of data in Google Sheets
10 Best Featrures of Google Docs to increase productivity
Does Windows 11 need an antivirus along with Windows Security?
5 thoughts on “How to install CentOS 8 on WSL 1 or 2 of Windows 10”
Wonderful. Very clear, easy and fast. Good service and good web site.
Hi, I have done all the necessary steps but when I inserted the dnf update, the output was the following statement, “Failed to set locale, defaulting to C.UTF-8”. I tried to find the solution for this but couldn’t find any since every solution that is available focused on other platform like ubuntu, etc and not window 10. Can you please help me out sir?
yum install glibc-common
Thank you for the article, but may I suggest that you change the phrase “Linux apps such as…” to “Linux distributions such as…” as you list distros and not applications.