Install ROS 2 from its sources

Want to avoid this process? Get our brain with ROS 2 preinstalled here

Add ROS 2 repositories:

sudo sh -c 'echo "deb `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116

Also get the osrf (gazebo) debian repository:

sudo sh -c 'echo "deb `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-latest.list'
sudo apt-key adv --keyserver --recv-keys D2486D2DD83DB69272AFE98867170598AF249743

Install GCC, G++ CMake, Python3 EmPy package (custom packages which don't collide) and setuptools:

sudo apt-get update
sudo apt-get install git wget
sudo apt-get install build-essential cppcheck cmake libopencv-dev python-empy python3-dev python3-empy python3-nose python3-pip python3-setuptools python3-vcstool

sudo apt-get install clang-format-3.4 pyflakes python3-coverage python3-mock python3-pep8 uncrustify

sudo apt-get install libboost-chrono-dev libboost-date-time-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-thread-dev

The setuptools version shipped with Ubuntu Trusty is not recent enough - we require at least version 8.2 (see

sudo pip3 install -U setuptools

mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
vcs import ~/ros2_ws/src < ros2.repos

which should generate something like:

=== /home/parallels/ros2_ws_sources/src/ament/ament_cmake (git) ===
Clonar en «.»...
Note: checking out 'release-alpha6'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD se encuentra en 6b3f5b7... run nosetests with the python executable (#70)

................  trace continues ...................

PrismTech OpenSplice Debian Packages built by OSRF

sudo apt-get update
sudo apt-get install libopensplice64  # from

cd ~/ros2_ws/
src/ament/ament_tools/scripts/ build --build-tests --symlink-install

which will start building the code:

# Topological order
 - ament_cppcheck
 - ament_package
 - ament_cmake_core
 - ament_cmake_export_definitions
 - ament_cmake_export_dependencies
 - ament_cmake
 - ament_cmake_export_include_directories
 - ament_cmake_export_interfaces
 - ament_cmake_export_libraries
 - ament_cmake_gmock
 - ament_cmake_gtest
 - ament_cmake_include_directories
 - ament_cmake_libraries
 - ament_cmake_nose
 - ament_cmake_python
 - ament_cmake_target_dependencies
 - ament_cmake_test
 - ament_cmake_auto
 - ament_lint_auto
 - ament_lint_common
 - ament_pep8
 - ament_pep257
 - ament_pyflakes
 - ament_copyright
 - ament_index_python
 - ament_lint_cmake
 - ament_cmake_lint_cmake
 - ament_cmake_copyright
 - ament_cmake_cppcheck
 - ament_cmake_pep257
 - ament_cmake_pep8
 - ament_cmake_pyflakes
 - ament_clang_format
 - ament_cmake_uncrustify
 - ament_cpplint
 - ament_uncrustify
 - gmock_vendor
 - gtest_vendor
 - launch
 - osrf_pycommon
 - ament_tools
 - uncrustify
 - ament_index_cpp
 - connext_cmake_module
 - opensplice_cmake_module
 - rmw
 - rmw_implementation
 - rosidl_cmake
 - rosidl_default_generators
 - rosidl_generator_c
 - rosidl_generator_dds_idl
 - rosidl_parser
 - rcl
 - rclc
 - rmw_connext_shared_cpp
 - rosidl_generator_cpp

.............. trace continues ...............

Now you should load the workspace into your bash

cd ~/ros2_ws
. ./install/setup.bash

ROS is a complex system composed of a set of software pieces distributed in different packages. In order to mitigate this complexity the OSRF develops tools to automate and simplify the build process. The output of these efforts is ament.

Do you need more computing capacity in your robots? Stay tuned


NOTE: These examples has been created under alpha 2 version. With new ROS 2 version these examples may not work properly. Be aware with this.