Unit 02 · lesson
Source and Inspect the ROS Environment
ROS 2 relies on shell environment setup files.
The Jazzy beginner documentation is explicit: without sourcing the setup files, the shell may not be able to access ROS 2 commands or find ROS packages.
Source Jazzy
In a Bash terminal, run:
source /opt/ros/jazzy/setup.bash
Now test:
ros2 --help
Inspect the environment
Run:
printenv | grep -i ROS
The beginner documentation tells you to look for variables including:
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_DISTRO=jazzy
Your output may include additional ROS variables.
New terminal experiment
Open another terminal.
Do not source Jazzy manually yet.
Run:
printenv | grep -i ROS
which ros2
Then source Jazzy and repeat the commands.
What changed?
That change is the shell environment becoming aware of the ROS installation.
Optional startup convenience
The official beginner documentation shows adding the setup command to Bash startup configuration:
echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc
Do this only if the course/instructor environment expects persistent sourcing. On a shared or multi-distro machine, manually sourcing may be clearer because you can deliberately choose a distribution.
Evidence checkpoint
Capture a before/after comparison:
BEFORE SOURCE
which ros2:
ROS_DISTRO:
AFTER SOURCE
which ros2:
ROS_DISTRO:
Then answer:
Did sourcing install ROS 2?
Correct answer: no. It configured the current shell to use an installation that already existed.