Install ROS on windows 10 using WSL (Full guide) - MohanadSinan/Smart-Methods GitHub Wiki
Here a full guide how to install ROS on Windows 10 using Windows Subsystem for Linux (WSL).
Note: WSL is only available in Windows 10 version 1607 (the Anniversary update) or higher.
Before installing any Linux distributions on Windows, you must enable the "Windows Subsystem for Linux" optional feature in one of the following two ways:
-
Open the Start Menu and search Turn Windows features on or off
-
Select Windows Subsystem for Linux
-
Click OK
Note: To only install WSL 1, you should now restart your machine and move on to Step2: Install Ubuntu distribution.
- Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Note: To only install WSL 1, you should now restart your machine and move on to Step2: Install Ubuntu distribution.
WSL 2 is a new version of the architecture in WSL that changes how Linux distributions interact with Windows. WSL 2 has the primary goals of increasing file system performance and adding full system call compatibility. Each Linux distribution can run as WSL 1 or as WSL 2, and can be switched between at any time. WSL 2 is a major overhaul of the underlying architecture and uses virtualization technology and a Linux kernel to enable its new features.
Note: WSL 2 is only available in Windows 10, updated to version 2004, Build 19041 or higher.
Before installing WSL 2, you must enable the "Virtual Machine Platform" optional feature.
- Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- Restart your computer when prompted
To manually update the Linux kernel inside of WSL 2 please download and install the Linux kernel update package for x64 machines.
Note: If you're using an ARM64 machine, please download the ARM64 package instead.
Once you have the kernel installed, please run the following command in PowerShell to set WSL 2 as the default version when installing a new Linux distribution:
wsl --set-default-version 2
Additional Installation Resources: WSL1 Installation Guide from Microsoft WSL2 Installation Guide from Microsoft Windows Server Installation Guide from Microsoft
The following Ubuntu releases are available as apps on the Microsoft Store:
- Ubuntu (without the release version) always follows the recommended release, switching over to the next one when it gets the first point release.
- Ubuntu 20.04 LTS (Focal) is the current LTS release, supporting both x64 and ARM64 architecture.
- Ubuntu 18.04 LTS (Bionic) is the second LTS release and the first one supporting ARM64 systems, too.
- Ubuntu 16.04 LTS (Xenial) is the first release available for WSL. It supports the x64 architecture only.
Each app creates a separate root file system in which Ubuntu shells are opened but app updates don’t change the root file system afterwards. Installing a different app in parallel creates a different root file system allowing you to have both Ubuntu LTS releases installed and running in case you need it for keeping compatibility with other external systems. You can also upgrade your Ubuntu 16.04 to 18.04 by running do-release-upgrade
and have three different systems running in parallel, separating production and sandboxes for experiments.
Ubuntu WSL distribution rootfs daily builds are available for download:
-
Ubuntu 20.04 LTS (Focal)
-
Ubuntu 19.10 (Eoan)
-
Ubuntu 18.04 LTS (Bionic)
-
Ubuntu 16.04 LTS (Xenial)
They can be installed using the wsl command:
wsl --import <DistributionName> <InstallLocation> <FileName>
Ubuntu WSL distribution .appx builds are available for download:
- Ubuntu 20.04 LTS (Focal)
- Ubuntu 20.04 LTS arm64
- Ubuntu 18.04 LTS (Bionic)
- Ubuntu 18.04 LTS arm64
- Ubuntu 16.04 LTS (Xenial)
They can be installed by enabling sideloading in Windows 10 and double-clicking the .appx and clicking Install or with PowerShell:
Add-AppxPackage .\Ubuntu_2004.2020.424.0_x64.appx
The Ubuntu on WSL terminal can be started via:
- The app tile in the Windows Start menu (or pinned to your taskbar)
- WSL - Remote extension for Visual Studio Code.
- The wsl command on the Windows command prompt or PowerShell
- By running
ubuntu2004.exe
, etc. on the Windows command prompt or PowerShell
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.
Once you have installed Ubuntu on WSL, the first step you will be asked to complete when opening your newly installed Linux distribution is to create an account, including a User Name and Password.
- This User Name and Password is specific to your Linux distribution and has no bearing on your Windows user name.
- Once you create this User Name and Password, the account will be your default user for the distribution and automatically sign-in on launch.
- This account will be considered the Linux administrator, with the ability to run
sudo
(Super User Do) administrative commands. - Each Linux distribution running on the Windows Subsystem for Linux has its own Linux user accounts and passwords. You will have to configure a Linux user account every time you add a distribution, reinstall, or reset.
Most distributions ship with an empty or minimal package catalog. We strongly recommend regularly updating your package catalog and upgrading your installed packages using your distribution's preferred package manager. For Ubuntu, use apt:
sudo apt update && sudo apt upgrade
Windows does not automatically update or upgrade your Linux distribution(s). This is a task that the most Linux users prefer to control themselves.
There is more than one ROS distribution supported at a time. Some are older releases with long term support, making them more stable, while others are newer with shorter support life times, but with binaries for more recent platforms and more recent versions of the ROS packages that make them up. See the Distributions page for more details.
We recommend one of the versions below:
ROS Kinetic Kame | ROS Melodic Morenia | ROS Noetic Ninjemys |
---|---|---|
Released May, 2016 | Released May, 2018 | Released May, 2020 |
LTS, supported until April, 2021 | LTS, supported until May, 2023 | Latest LTS ,supported until May, 2025 |
Isn't recommended for new installs |
Recommended for Ubuntu 18.04 |
Recommended for Ubuntu 20.04 |
Setup your computer to accept software from packages.ros.org.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
If you experience issues connecting to the keyserver, you can try substituting
hkp://pgp.mit.edu:80
orhkp://keyserver.ubuntu.com:80
in the previous command.
Alternatively, you can use curl instead of the apt-key command, which can be helpful if you are behind a proxy server:
curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -
First, make sure your Debian package index is up-to-date:
sudo apt update
Now pick how much of ROS you would like to install.
-
Desktop-Full Install:
(Recommended)
: Everything in Desktop plus 2D/3D simulators and 2D/3D perception packagessudo apt install ros-noetic-desktop-full
-
Desktop Install: Everything in ROS-Base plus tools like rqt and rviz
sudo apt install ros-noetic-desktop
-
ROS-Base: (Bare Bones) ROS packaging, build, and communication libraries. No GUI tools.
sudo apt install ros-noetic-ros-base
There are even more packages available in ROS. You can always install a specific package directly.
sudo apt install ros-noetic-PACKAGEe.g.
sudo apt install ros-noetic-slam-gmapping
To find available packages, see ROS Index or use:
apt search ros-noetic
You must source this script in every bash terminal you use ROS in.
source /opt/ros/noetic/setup.bash
It can be convenient to automatically source this script every time a new shell is launched. These commands will do that for you.
Bash
Note: If you have more than one ROS distribution installed,
~/.bashrc
must only source thesetup.bash
for the version you are currently using.
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
zsh
echo "source /opt/ros/noetic/setup.zsh" >> ~/.zshrc
source ~/.zshrc
Now, to test your installation, A good way to check is to ensure that environment variables like ROS_ROOT and ROS_PACKAGE_PATH are set:
printenv | grep ROS
If they are not then you might need to 'source' some setup.