These are the dependencies you need to install beforehand in the operating system:
or
First, you need to setup a ROS workspace. To do that, create a new folder with a src directory inside. This can be for example mkdir -p /home/myusername/ros2_ws/src.
src subdirectory:
Install workspace dependencies running rosdep install -i -y --from-path src from the ros2_ws directory.
Build the workspace running colcon build --symlink-install.
Source the installation script source install/setup.bash.