---
category: help
layout: help
mirrorid: ros2
---

## ROS2 镜像使用帮助

输入如下命令，下载 ROS 的 GPG Key：

```bash
sudo apt install curl gnupg2
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg
```


再输入如下命令，添加软件仓库，并更新索引：

<form class="form-inline">
<div class="form-group">
	<label>你的Debian/Ubuntu版本: </label>
	<select class="form-control release-select" data-template="#apt-template" data-target="#apt-content">
		<option data-os="debian" data-release="buster">Debian 10 (Buster)</option>
		<option data-os="debian" data-release="bullseye">Debian 11 (Bullseye)</option>
		<option data-os="ubuntu" data-release="bionic">Ubuntu 18.04 LTS</option>
		<option data-os="ubuntu" data-release="focal">Ubuntu 20.04 LTS</option>
		<option data-os="ubuntu" data-release="jammy" selected>Ubuntu 22.04 LTS</option>
</select>
</div>
</form>

<p></p>
<pre>
<code id="apt-content">
</code>
</pre>


{% raw %}
<script id="apt-template" type="x-tmpl-markup">
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] https://{%endraw%}{{ site.hostname }}{%raw%}/ros2/ubuntu {{release_name}} main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

sudo apt update
</script>
{%endraw%}

Reference: https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html
