Last active
November 18, 2025 02:15
-
-
Save wsxq2/dbebdfbc0e8ae005984255b6a1c7fbcc to your computer and use it in GitHub Desktop.
在 arm64 上安装 ros2 humble
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # may need keep proxy env when use sudo | |
| # add `Defaults env_keep += "http_proxy https_proxy"` after `Defaults env_reset` when executing visudo | |
| 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 | |
| sudo apt install software-properties-common | |
| sudo add-apt-repository universe | |
| # sudo apt update && sudo apt install curl -y | |
| # export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}') | |
| # curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo $VERSION_CODENAME)_all.deb" # If using Ubuntu derivates use $UBUNTU_CODENAME | |
| # sudo dpkg -i /tmp/ros2-apt-source.deb | |
| # Update the apt sources to use Tsinghua University's mirror (with root) | |
| mv /etc/apt/sources.list /etc/apt/sources.list.bak | |
| cat > /etc/apt/sources.list <<EOF | |
| deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse | |
| deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse | |
| deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse | |
| deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse | |
| EOF | |
| # Add ROS 2 apt repository (with root) | |
| # export https_proxy=http://192.168.3.107:7890 # may need proxy to download from github | |
| apt-get install curl gnupg2 -y && 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] https://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null | |
| # 手动模拟 rosdep init (with root) | |
| mkdir -p /etc/ros/rosdep/sources.list.d/ && curl -o /etc/ros/rosdep/sources.list.d/20-default.list -L https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/sources.list.d/20-default.list | |
| sudo apt update | |
| sudo apt upgrade | |
| # install ros2 | |
| sudo apt install ros-humble-desktop | |
| # install dev tools for ros2 (such as colcon) | |
| sudo apt install ros-dev-tools | |
| # may need colcon clean | |
| # sudo apt install python3-colcon-clean | |
| # test ros2 | |
| source /opt/ros/humble/setup.bash | |
| ros2 run demo_nodes_cpp talker | |
| source /opt/ros/humble/setup.bash | |
| ros2 run demo_nodes_py listener | |
| # may need for colcon build packages | |
| # rosdep install --from-paths src --ignore-src -r -y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment