Breaking
Advertisement — Leaderboard (728×90)
Digital Skills

ROS Installation Guide: From Zero to Robot Operating System

By m.ashfaq23 March 21, 2026  ·  ⏱ 14 minute read

The Robot Operating System (ROS) is the backbone of modern robotics development. Whether you’re building a simple line-following robot or a complex autonomous vehicle, ROS provides the communication infrastructure, tools, and libraries that make development faster and more maintainable.

This guide walks you through installing ROS from scratch—no prior Linux experience required. We’ll cover both ROS 1 (Noetic) and ROS 2 (Humble), help you choose the right version for your project, and have you running your first ROS program within an hour.

Before You Start: Installing ROS is straightforward but requires attention to detail. This guide assumes you’re using a computer with at least 8GB RAM, 50GB free disk space, and a stable internet connection. The entire installation takes 30-60 minutes depending on your internet speed.


Understanding ROS: Noetic vs Humble

Before installing, you need to choose between ROS 1 and ROS 2. Here’s what you need to know:

FeatureROS Noetic (ROS 1)ROS 2 Humble
Release Year20202022
Ubuntu SupportUbuntu 20.04 (Focal)Ubuntu 22.04 (Jammy)
Python SupportPython 2.7 & 3.8+Python 3.10+ only
Real-Time SupportNo (requires patches)Yes (built-in)
SecurityBasicDDS security built-in
Learning ResourcesExtensiveGrowing rapidly
Industry AdoptionLegacy systemsNew projects
Best ForAcademia, learning, legacy robotsProduction, new projects

Recommendation: For beginners learning robotics in 2026, start with ROS 2 Humble. It has modern features, active development, and will be the standard for years to come. However, if your university/research lab uses ROS 1, learn both.

Which Should You Install?

  • Install ROS 2 Humble if: Starting a new project, building production robots, learning modern practices, using Ubuntu 22.04
  • Install ROS Noetic if: Taking a university course that requires it, working with existing ROS 1 robots, following older tutorials
  • Install both if: Bridging between systems or working in mixed environments

Step 1: Install Ubuntu Linux

ROS runs natively on Ubuntu Linux. If you don’t have Ubuntu installed, you have two options:

Option A: Native Ubuntu Installation (Recommended)

What It Is: Installing Ubuntu directly on your computer, either as the only OS or dual-booting alongside Windows/macOS.

Why Choose Native:

  • Best Performance: Full access to system resources, no virtualization overhead
  • GPU Access: Direct NVIDIA CUDA support for ML/CV applications
  • Most Stable: Tested configuration with fewer compatibility issues

Download Ubuntu:

Installation Steps:

  1. Download Ubuntu ISO: Visit ubuntu.com/download/desktop and download the appropriate version (22.04 for ROS 2, 20.04 for ROS 1).
  2. Create Bootable USB: Use Balena Etcher or Rufus to flash the ISO onto a USB drive (minimum 8GB).
  3. Back Up Data: If dual-booting, back up important files before partitioning your drive.
  4. Boot from USB: Restart your computer and press the boot menu key (usually F12, F2, or Delete) to select the USB drive.
  5. Follow Installation Wizard: Choose “Install Ubuntu,” select your language, and choose installation type:
    • Erase disk and install Ubuntu: Simplest option, deletes everything
    • Something else: For manual partitioning (advanced)
  6. Create Your Account: Choose a username and password. Remember—this is your sudo password for installing software.
  7. Wait for Installation: Installation typically takes 15-30 minutes. Restart when prompted and remove the USB drive.
  8. Install Essential Updates: Open Terminal (Ctrl+Alt+T) and run:
    sudo apt update && sudo apt upgrade -y

Option B: Virtual Machine (For Windows/macOS Users)

What It Is: Running Ubuntu inside a virtual machine using software like VirtualBox or VMware.

Why Choose Virtual Machine:

  • No Reboot Required: Keep your current OS and run Ubuntu simultaneously
  • Safe Experimentation: Mess up the VM? Delete and start fresh without affecting your main system
  • Cross-Platform: Works on Windows, macOS, or Linux

Required Software:

Virtual Machine Setup:

  1. Download and Install VirtualBox: Get the latest version from virtualbox.org.
  2. Download Ubuntu ISO: From ubuntu.com (use 22.04 for ROS 2 Humble).
  3. Create New Virtual Machine:
    • Click “New” in VirtualBox
    • Name: “ROS2-Humble” (or “ROS-Noetic”)
    • Type: “Linux”
    • Version: “Ubuntu (64-bit)”
    • Memory: At least 4GB (8GB recommended)
    • Hard disk: 50GB minimum (80GB recommended)
  4. Mount Ubuntu ISO: Go to Settings > Storage > Empty > CD icon > Choose disk file. Select your Ubuntu ISO.
  5. Install Ubuntu: Start the VM and follow the Ubuntu installation wizard.
  6. Install VirtualBox Guest Additions: After Ubuntu is installed, go to Devices > Insert Guest Additions CD image. This enables better screen resolution and mouse integration.

Performance Note: Virtual machines share your host’s resources. For comfortable ROS development, allocate at least 4 CPU cores and 8GB RAM to the VM. You’ll also need ChatGPT or similar AI assistants to help troubleshoot—VM setups often have unique issues.


Step 2: Install ROS 2 Humble (Recommended)

Now that Ubuntu is ready, let’s install ROS 2 Humble.

Method A: Desktop Installation (Recommended for Beginners)

This includes ROS, RViz, Gazebo simulators, and 2D/3D perception libraries.

  1. Set Locale: Ensure your locale supports UTF-8:
    locale  # Check for UTF-8
    sudo apt update && sudo apt install locales
    sudo locale-gen en_US en_US.UTF-8
    sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
    export LANG=en_US.UTF-8
    locale  # Verify settings
  2. Add ROS 2 Repository:
    sudo apt install software-properties-common
    sudo add-apt-repository universe
    sudo apt update && sudo apt install curl -y
    sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
  3. Install ROS 2 Packages:
    sudo apt update
    sudo apt upgrade -y
    sudo apt install ros-humble-desktop -y

    This installs the full desktop version including RViz, Gazebo, and tutorials. Installation takes 15-30 minutes depending on your internet speed.

  4. Install Dependencies:
    sudo apt install python3-pip
    pip install argcomplete
  5. Install colcon (Build Tool):
    sudo apt install python3-colcon-common-extensions
    sudo apt install python3-argparse
  6. Install Additional Tools:
    sudo apt install terminator  # Better terminal than default
    sudo apt install git -y      # Version control
    sudo apt install curl wget    # Download tools

Method B: ROS 2 via Docker (Alternative)

What It Is: Using Docker containers to run ROS 2 without modifying your host system.

Why Use Docker:

  • No System Modification: Doesn’t interfere with your existing setup
  • Reproducible Environments: Same environment everywhere
  • Easy Cleanup: Delete container and start fresh

Docker Installation:

  1. Install Docker:
    sudo apt update
    sudo apt install docker.io docker-compose -y
    sudo usermod -aG docker $USER
    # Log out and back in for group changes to take effect
  2. Pull ROS 2 Humble Docker Image:
    docker pull osrf/ros:humble-desktop
  3. Run ROS 2 Container:
    xhost +local:docker  # Allow GUI access
    docker run -it \
        --env="DISPLAY" \
        --env="QT_X11_NO_MITSHM=1" \
        --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
        --device="/dev/dri:/dev/dri" \
        osrf/ros:humble-desktop

Docker Limitation: Running GUI applications (RViz, Gazebo) in Docker requires additional X11 configuration and may have performance issues. For beginners, we recommend native installation over Docker.


Step 3: Install ROS 1 Noetic (Alternative)

If you need ROS 1 for university courses or legacy projects, here’s how to install Noetic on Ubuntu 20.04.

  1. Configure Ubuntu Repositories:
    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" > /etc/apt/sources.list.d/ros-latest.list'
    sudo apt install curl
    curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.key | sudo apt-key add -
  2. Install ROS Noetic:
    sudo apt update
    sudo apt install ros-noetic-desktop-full -y

    This includes the full desktop version with all tutorials, simulators, and perception libraries.

  3. Install Dependencies:
    sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator build-essential -y
  4. Initialize rosdep:
    sudo rosdep init
    rosdep update

Step 4: Configure Your ROS Environment

After installation, you need to set up your environment variables. ROS uses several environment variables to find packages and configure the system.

Understanding ROS Environment Variables

  • ROS_DISTRO: Which ROS distribution you’re using (humble or noetic)
  • ROS_PACKAGE_PATH: Where ROS looks for packages
  • AMENT_PREFIX_PATH: ROS 2 package installation paths
  • COLCON_PREFIX_PATH: Workspace package locations

Automatic Environment Setup

The easiest way to configure your environment is to add sourcing commands to your shell configuration file.

  1. Open Your Shell Configuration:
    nano ~/.bashrc

    This opens the bash configuration file in the Nano text editor.

  2. Add ROS 2 Humble Source Command (add at the end):
    # ROS 2 Humble Setup
    source /opt/ros/humble/setup.bash
  3. Add ROS 1 Noetic Source Command (alternative):
    # ROS 1 Noetic Setup
    source /opt/ros/noetic/setup.bash
  4. Save and Exit:
    • Press Ctrl+O to save
    • Press Enter to confirm
    • Press Ctrl+X to exit
  5. Apply Changes:
    source ~/.bashrc

    Or close and reopen your terminal.

  6. Verify Installation:
    echo $ROS_DISTRO
    # Should output: humble (or noetic)

Pro Tip: Add an alias to easily switch between ROS versions if you have both installed:

# Add to ~/.bashrc
alias source_humble='source /opt/ros/humble/setup.bash'
alias source_noetic='source /opt/ros/noetic/setup.bash'

Step 5: Create Your First ROS Workspace

A ROS workspace is where you develop your own packages. The standard structure uses src, build, install, and log directories.

Understanding the ROS 2 Workspace Structure

  • src/ (Source): Where your source code and packages live
  • build/ (Build): Where build artifacts are stored (automatically created)
  • install/ (Install): Where installed packages are placed (automatically created)
  • log/ (Log): Build and runtime logs (automatically created)

Creating Your Workspace

  1. Create Workspace Directory:
    mkdir -p ~/ros2_ws/src
    cd ~/ros2_ws

    Replace “ros2_ws” with “ros_ws” if using ROS 1.

  2. Download Example Packages:
    cd ~/ros2_ws/src
    git clone https://github.com/ros/ros_tutorials.git -b humble-devel
    git clone https://github.com/ros/visualization_tutorials.git -b humble-devel
    git clone https://github.com/ros/robotviz_tutorials.git -b humble-devel
  3. Install Dependencies:
    cd ~/ros2_ws
    rosdep install --from-paths src --ignore-src -r -y

    This installs any system dependencies required by the packages.

  4. Build the Workspace:
    cd ~/ros2_ws
    colcon build --symlink-install

    The --symlink-install flag creates symbolic links instead of copying files, so changes to source code take effect immediately without rebuilding.

  5. Source the Workspace:
    source ~/ros2_ws/install/setup.bash
  6. Add to Your Bash Configuration:
    echo 'source ~/ros2_ws/install/setup.bash' >> ~/.bashrc

Build Time: The first build can take 10-30 minutes depending on your computer speed and the packages involved. Subsequent builds are faster because only changed files are recompiled.


Step 6: Run Your First ROS Program

Let’s verify everything works by running the ROS 2 tutorials.

Running the Talker and Listener Demo

ROS uses a publish/subscribe communication system. The “talker” publishes messages, and the “listener” receives them.

  1. Open Terminal 1 – Start the Listener:
    ros2 run demo_nodes_py listener

    You should see the listener waiting for messages.

  2. Open Terminal 2 – Start the Talker:
    ros2 run demo_nodes_py talker

    You should see the talker publishing messages and the listener receiving them.

  3. Verify Communication: If you see messages appearing in the listener terminal, your ROS installation is working correctly!

Running RViz (3D Visualization)

RViz is ROS’s primary visualization tool for robot models, sensor data, and navigation.

  1. Start RViz:
    rviz2
  2. Add a Display:
    • Click “Add” in the left panel
    • Select “RobotModel”
    • In the “Description Source” field, select “Topic”
    • Click “/robot_description”
  3. You Should See: A robot model (or error if no robot is running). This confirms your visualization tools are working.

Running Gazebo (Robot Simulation)

Gazebo is a powerful physics simulator for testing robots before deploying to real hardware.

  1. Launch Gazebo with a Sample Robot:
    gazebo
  2. Insert a Robot: Click “Insert” tab and add any model from the list.
  3. Verify Physics: Drop objects to verify gravity and physics are working.

Congratulations! If you can run the talker/listener demo, RViz, and Gazebo, your ROS installation is complete and working. You’re ready to start building robots!


Troubleshooting Common Issues

Installation issues are common. Here are solutions to the most frequent problems:

Issue 1: “Command ‘ros2’ not found”

  • Cause: ROS environment not sourced
  • Solution: Run source /opt/ros/humble/setup.bash in your terminal
  • Permanent Fix: Add the source command to ~/.bashrc (see Step 4)

Issue 2: “Unable to locate package ros-humble-desktop”

  • Cause: Repository not properly configured
  • Solution:
    sudo apt update
    sudo apt install curl
    sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list
    sudo apt update
  • Verify: Run apt search ros-humble to see available packages

Issue 3: Gazebo Freezes or Crashes

  • Cause: Graphics driver issues or insufficient GPU support
  • Solutions:
    • Update graphics drivers: sudo ubuntu-drivers autoinstall
    • Use software rendering: LIBGL_ALWAYS_SOFTWARE=1 gazebo
    • Try different Gazebo version: gazebo --version

Issue 4: Permission Denied Errors

  • Cause: USB device access or serial port permissions
  • Solution: Add user to dialout group:
    sudo usermod -aG dialout $USER
    # Log out and back in for changes to take effect

Issue 5: ROS Distribution Version Mismatch

  • Cause: Attempting to install wrong ROS version for Ubuntu version
  • Solution:
    • ROS 2 Humble requires Ubuntu 22.04
    • ROS 1 Noetic requires Ubuntu 20.04
    • Check your Ubuntu version: lsb_release -a
    • If wrong version, you need to reinstall Ubuntu with the correct version

Issue 6: Build Failures with colcon

  • Cause: Missing dependencies or incompatible packages
  • Solution:
    # Clean and rebuild
    cd ~/ros2_ws
    rm -rf build install log
    rosdep install --from-paths src --ignore-src -r -y
    colcon build --symlink-install
  • Check for Errors: Read the error messages carefully—they usually specify which dependency is missing

Need More Help? If you’re stuck, try these resources:


Essential ROS 2 Packages to Install Next

Once your base installation is working, install these essential packages to expand your capabilities:

PackageCommandPurpose
MoveIt 2sudo apt install ros-humble-moveit*Robot arm motion planning
Navigation 2sudo apt install ros-humble-navigation2*Mobile robot navigation
SLAM Toolboxsudo apt install ros-humble-slam-toolboxSimultaneous localization and mapping
Cartographersudo apt install ros-humble-cartographer*LiDAR SLAM for mapping
Realsense ROSsudo apt install ros-humble-realsense2-*Intel RealSense camera support
OpenCVsudo apt install ros-humble-cv-bridgeComputer vision bridge
PCLsudo apt install ros-humble-pcl-*Point cloud processing
TurtleBot 3sudo apt install ros-humble-turtlebot3-*Education robot with simulations
Table 5.1: Essential ROS 2 Packages for Beginners

Quick Install All: Install multiple packages at once:


Setting Up VS Code for ROS Development

A good code editor makes ROS development much easier. Visual Studio Code with ROS extensions provides syntax highlighting, IntelliSense, and integrated terminal.

  1. Install VS Code:
    sudo snap install code --classic
    # OR download from https://code.visualstudio.com
  2. Install ROS Extensions:
    • Open VS Code
    • Press Ctrl+Shift+X to open Extensions
    • Search and install:
      • “ROS” by Microsoft
      • “Python” by Microsoft
      • “C/C++” by Microsoft
  3. Configure for ROS 2:
    • Open File > Preferences > Settings
    • Search for “ROS” settings
    • Set “ROS: Distro” to “humble”
  4. Open Your Workspace:
    code ~/ros2_ws
  5. Configure Build Task:
    • Press Ctrl+Shift+P
    • Search “Tasks: Configure Default Build Task”
    • Select “Create tasks.json file”
    • Choose “ROS Build”

Next Steps: Your ROS Learning Path

Your ROS installation is complete. Here’s how to continue learning:

Official Tutorials

Online Courses

YouTube Channels

Books


Conclusion: Your ROS Journey Begins Now

You’ve successfully installed ROS 2 Humble or ROS 1 Noetic and verified your installation with working examples. The robot operating system is now ready on your machine, opening the door to robotics development.

Your Next Milestone: Complete the official ROS 2 tutorials at docs.ros.org/en/humble/Tutorials.html. These interactive tutorials will teach you nodes, topics, services, actions, and launch files—the building blocks of every ROS project.

From here, your learning path depends on your goals:

  • Interested in robot arms? Learn MoveIt and forward/inverse kinematics
  • Interested in autonomous vehicles? Master Navigation 2 and SLAM
  • Interested in perception? Deep dive into computer vision with OpenCV and depth cameras
  • Interested in simulation? Explore Gazebo worlds and physics modeling

The ROS community is one of the most helpful in robotics. When you’re stuck, don’t hesitate to ask questions on ROS Answers, ROS Discourse, or Reddit’s r/ROS. Thousands of developers have faced the same issues and are happy to help.

Your installation is complete. Your workspace is ready. Your first programs have run successfully. Now it’s time to build something amazing with ROS.

Stay Updated: ROS releases new distributions every 2 years. Subscribe to the ROS Release Announcements forum to stay informed about updates, security patches, and new features.

Related Guides: Check out our other robotics tutorials: Building Your First ROS Package, Introduction to Robot Kinematics, Simulating Robots in Gazebo, and ROS 2 vs ROS 1: Which Should You Learn?

Advertisement — In-Content (300×250)

What is your reaction?

Leave a Reply

Saved Articles