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

# ROS2 软件仓库镜像使用帮助

<form class="form-inline">
<div class="form-group">
	<label>是否使用 HTTPS</label>
	<select id="http-select" class="form-control content-select" data-target="#content-0,#content-1">
	  <option data-http_protocol="https://" selected>是</option>
	  <option data-http_protocol="http://">否</option>
	</select>
</div>
</form>


<form class="form-inline">
<div class="form-group">
	<label>是否使用 sudo</label>
	<select id="sudo-select" class="form-control content-select" data-target="#content-0,#content-1">
	  <option data-sudo="sudo " selected>是</option>
	  <option data-sudo="">否</option>
	</select>
</div>
</form>



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



{% raw %}
<script id="template-0" type="x-tmpl-markup">
{{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
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-0" data-template="#template-0" data-select="#http-select,#sudo-select">
</code>
</pre>




<form class="form-inline">
<div class="form-group">
  <label>发行版：</label>
    <select id="select-1-0" class="form-control content-select" data-target="#content-1">
      <option data-release_name="jammy" selected>Ubuntu 22.04 LTS</option>
      <option data-release_name="focal">Ubuntu 20.04 LTS</option>
      <option data-release_name="bionic">Ubuntu 18.04 LTS</option>
      <option data-release_name="bullseye">Debian 11 (bullseye)</option>
      <option data-release_name="buster">Debian 10 (buster)</option>
    </select>
</div>
</form>

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

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

<p></p>

<pre>
<code id="content-1" data-template="#template-1" data-select="#http-select,#sudo-select,#select-1-0">
</code>
</pre>


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

### rosdep

参考 [ROS Distro 帮助](/help/rosdistro)

