How to Use Different Linux Bash Shells in Windows 10
Install Linux Bash for Windows
First, you need to join the Insider Build program to gain access to pre-release features such as WSL. Open Update Settings and then go to ‘Advanced Windows Update option’. Follow the instructions and join the Insider Build program. It requires you to log into your Microsoft account. Once done, it will ask you to restart the system.Once you’ve rebooted, go to Advanced Windows Update option page and choose the pre-release update and select the Fast option.
Swapnil Bhartiya
Swapnil Bhartiya
You may have to reboot the system. Once rebooted, type ‘bash’ in the Windows 10 search bar, and it will open the command prompt where you will install bash -- just follow the on-screen instructions. It will also ask you to create a username and password for the account. Once done, you will have Ubuntu running on the system.
Now every time you open ‘bash’ from the Start Menu of Windows 10, it will open bash running on Ubuntu.
The switcher we are about to install basically extracts the tarball of your chosen Linux distribution into the home directory of WSL and then switches the current rootfs with the chosen one. You can download all desired, and supported, distributions and then easily switch between them. Once you switch the distro and open ‘bash’ from the start menu, instead of Ubuntu, you will be running that distro.
Let’s get started.
Install Windows Subsystem for Linux Distribution Switcher
It’s time to install a switcher that will help us in switching between distributions. First, we need to install the latest version of Python 3 in Windows. Then, download the switcher folder from GitHub. It’s a zip file, so extract the file in the Downloads folder. Now open PowerShell and change the directory to the WSL folder:cd .\Downloads\WSL-Distribution-Switcher-master\
Run ‘ls’ command to see all the scripts available. You should see this list:
Directory: C:\Users\arnie\Downloads\WSL-Distribution-Switcher-master Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2/4/2017 3:18 PM ntfsea d----- 2/4/2017 10:00 PM __pycache__ -a---- 11/2/2016 2:54 PM 3005 get-prebuilt.py -a---- 11/2/2016 2:54 PM 5018 get-source.py -a---- 11/2/2016 2:54 PM 9907 hook_postinstall_all.sample.sh -a---- 11/2/2016 2:54 PM 16237 install.py -a---- 11/2/2016 2:54 PM 1098 LICENSE.md -a---- 11/2/2016 2:54 PM 7442 ntfsea.py -a---- 11/2/2016 2:54 PM 13824 ntfsea_x64.dll -a---- 11/2/2016 2:54 PM 11264 ntfsea_x86.dll -a---- 11/2/2016 2:54 PM 1161 pyinstaller.spec -a---- 11/2/2016 2:54 PM 17547 README.md -a---- 2/5/2017 1:56 PM 1898755 rootfs_alpine_latest.tar.gz -a---- 2/5/2017 1:40 PM 42632248 rootfs_centos_latest.tar.xz -a---- 2/4/2017 9:59 PM 51361242 rootfs_debian_latest.tar.gz -a---- 2/4/2017 9:56 PM 26488540 rootfs_debian_sid.tar.xz -a---- 2/4/2017 10:00 PM 67973225 rootfs_fedora_latest.tar.gz -a---- 2/4/2017 9:58 PM 38760836 rootfs_fedora_latest.tar.xz -a---- 2/5/2017 1:08 PM 28933468 rootfs_opensuse_latest.tar.xz -a---- 2/4/2017 10:00 PM 50310388 rootfs_ubuntu_latest.tar.gz -a---- 11/2/2016 2:54 PM 4568 switch.py -a---- 11/2/2016 2:54 PM 14962 utils.py
Now we need to download the desired distribution. Let’s try Debian:py.exe .\get-source.py debian
Then, install it:py.exe .\install.py debian
Now,
open bash from Start Menu. Then, you can check whether it’s still
Ubuntu or it has switched to Debian. Run the following command: cat /etc/os-release
You should see this output:PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Debian
8 is now installed. Now, let’s start using Debian. If you want to use
Fedora, first quit the Debian bash session, by typing exit.Now go back to PowerShell and enter the WSL directory as explained above:
cd .\Downloads\WSL-Distribution-Switcher-master\
Let’s download Fedora:py.exe .\get-source.py fedora
And then install it:py.exe .\install.py fedora
When
you install a distribution, the ‘bash’ automatically switches to that
distribution, so if you open ‘bash’ from Start Menu, you will be logged
into Fedora. Try it!cat /etc/os-release NAME=Fedora VERSION="25 (Twenty Five)" ID=fedora VERSION_ID=25 PRETTY_NAME="Fedora 25 (Twenty Five)" ANSI_COLOR="0;34" CPE_NAME="cpe:/o:fedoraproject:fedora:25" HOME_URL="https://fedoraproject.org/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=25 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=25 PRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy
Ok! Now how do we switch between installed distributions? First, you need to quit the existing ‘bash’ and go back to PowerShell, cd to the WSL Switcher directory, and then use ‘switcher’ script to switch to the desired distribution.
py.exe .\switch.py NAME_OF_INSTALLED_DISTRO
So, let’s say we want to switch to Debianpy.exe .\switch.py debian
Open
‘bash’ from Start and you will be running Debian. Now you can easily
switch between any of these distributions. Just bear in mind that WSL
itself is a beta software; it’s not ready for production so you will
come across problems. On top of that, WSL Distribution Switcher is also
an “under development” software so don’t expect everything to work
flawlessly.
No comments:
Post a Comment