---
category: help
layout: help
mirrorid: llvm-apt
---

# LLVM APT 软件仓库镜像使用帮助

<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,#content-2">
	  <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,#content-2">
	  <option data-sudo="sudo " selected>是</option>
	  <option data-sudo="">否</option>
	</select>
</div>
</form>



### 安装脚本



<form class="form-inline">
<div class="form-group">
  <label>LLVM 版本：</label>
    <select id="select-0-0" class="form-control content-select" data-target="#content-0">
      <option data-version="" selected>默认</option>
      <option data-version="15">15</option>
      <option data-version="14">14</option>
      <option data-version="13">13</option>
      <option data-version="12">12</option>
      <option data-version="11">11</option>
    </select>
</div>
</form>

{% raw %}
<script id="template-0" type="x-tmpl-markup">
# 下载脚本
wget {{http_protocol}}{{mirror}}/llvm.sh
chmod +x llvm.sh
{{sudo}}./llvm.sh {{version}} all -m {{http_protocol}}{{mirror}}
</script>
{% endraw %}

<p></p>

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


### 手动启用

首先信任来自 https://apt.llvm.org/ 的 PGP 公钥：



{% raw %}
<script id="template-1" type="x-tmpl-markup">
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | {{sudo}}apt-key add -
</script>
{% endraw %}

<p></p>

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


新增 `/etc/apt/sources.list.d/llvm-apt.list`，内容为



<form class="form-inline">
<div class="form-group">
  <label>发行版：</label>
    <select id="select-2-0" class="form-control content-select" data-target="#content-2">
      <option data-release_name="bullseye" selected>Debian 11</option>
      <option data-release_name="buster">Debian 10</option>
      <option data-release_name="jammy">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>
    </select>
</div>
</form>

<form class="form-inline">
<div class="form-group">
  <label>LLVM 版本：</label>
    <select id="select-2-1" class="form-control content-select" data-target="#content-2">
      <option data-version="" selected>默认</option>
      <option data-version="-16">16</option>
      <option data-version="-15">15</option>
      <option data-version="-14">14</option>
      <option data-version="-13">13</option>
      <option data-version="-12">12</option>
      <option data-version="-11">11</option>
    </select>
</div>
</form>

<form class="form-inline">
<div class="form-group">
  <label>启用源码镜像：</label>
    <select id="select-2-2" class="form-control content-select" data-target="#content-2">
      <option data-enable_source="# " selected>否</option>
      <option data-enable_source="">是</option>
    </select>
</div>
</form>

{% raw %}
<script id="template-2" type="x-tmpl-markup">
# 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释
deb {{http_protocol}}{{mirror}}/{{release_name}}/ llvm-toolchain-{{release_name}}{{version}} main
{{enable_source}}deb-src {{http_protocol}}{{mirror}}/{{release_name}}/ llvm-toolchain-{{release_name}}{{version}} main
</script>
{% endraw %}

<p></p>

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



