Files
clear-linux-documentation/tutorials/mirror-upstream-server.html
2024-11-04 18:48:51 +00:00

358 lines
21 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Mirror Upstream Clear Linux OS Update Server &#8212; Documentation for Clear Linux* project</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/bizstyle.css?v=5283bb3d" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=a56c686a"></script>
<script src="../_static/bizstyle.js"></script>
<link rel="canonical" href="https://clearlinux.github.io/clear-linux-documentation/tutorials/mirror-upstream-server.html" />
<link rel="icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="NVIDIA* Drivers" href="nvidia.html" />
<link rel="prev" title="LAMP Web Server" href="lamp-server.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!--[if lt IE 9]>
<script src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="nvidia.html" title="NVIDIA* Drivers"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="lamp-server.html" title="LAMP Web Server"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Documentation for Clear Linux* project</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Tutorials</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Mirror Upstream Clear Linux OS Update Server</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="mirror-upstream-cl-update-server">
<span id="mirror-upstream-server"></span><h1>Mirror Upstream Clear Linux OS Update Server<a class="headerlink" href="#mirror-upstream-cl-update-server" title="Link to this heading"></a></h1>
<p>For organizations that want to use the Clear Linux OS upstream updates, but want the
benefits of a local mirror, this tutorial shows how to set up one and
configure your Clear Linux OS clients to use it.</p>
<nav class="contents local" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#prerequisites" id="id3">Prerequisites</a></p></li>
<li><p><a class="reference internal" href="#install-up-cl-server-to-host-updates" id="id4">Install up Clear Linux OS server to host updates</a></p></li>
<li><p><a class="reference internal" href="#clone-the-cl-update-content" id="id5">Clone the Clear Linux OS update content</a></p></li>
<li><p><a class="reference internal" href="#setup-a-web-server-to-host-the-mirrored-content" id="id6">Setup a web server to host the mirrored content</a></p></li>
<li><p><a class="reference internal" href="#test-your-mirror" id="id7">Test your mirror</a></p></li>
<li><p><a class="reference internal" href="#keep-your-mirror-in-sync-with-upstream" id="id8">Keep your mirror in sync with upstream</a></p></li>
</ul>
</nav>
<section id="prerequisites">
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Prerequisites</a><a class="headerlink" href="#prerequisites" title="Link to this heading"></a></h2>
<ul class="simple">
<li><p>The recommended disk space for the mirror server should have at least 100GB
of disk space as each complete update content is approximately 45GB.</p></li>
</ul>
</section>
<section id="install-up-cl-server-to-host-updates">
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Install up Clear Linux OS server to host updates</a><a class="headerlink" href="#install-up-cl-server-to-host-updates" title="Link to this heading"></a></h2>
<ol class="arabic">
<li><p>Follow the <a class="reference internal" href="../get-started/bare-metal-install-server.html#bare-metal-install-server"><span class="std std-ref">Install Clear Linux* OS from the live server</span></a> guide to install Clear Linux OS server.
Add a user with <cite>Administrator</cite> privilege.</p></li>
<li><p>After installation is complete, boot it up.</p></li>
<li><p>Add the <cite>wget</cite> bundle. This will be used to clone the upstream Clear Linux OS server.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-add<span class="w"> </span>wget
</pre></div>
</div>
</li>
</ol>
</section>
<section id="clone-the-cl-update-content">
<h2><a class="toc-backref" href="#id5" role="doc-backlink">Clone the Clear Linux OS update content</a><a class="headerlink" href="#clone-the-cl-update-content" title="Link to this heading"></a></h2>
<p>Clear Linux OS periodically releases a “minversion”, which is a complete update.
Then, subsequent releases are small updates until the next minversion.</p>
<p>Download a minversion to start your mirror.</p>
<ol class="arabic">
<li><p>Determine a proper minversion by looking at a <a class="reference external" href="https://docs.01.org/clearlinux/latest/reference/manpages/swupd.1.html">Manifest.MoM</a> file
for a particular release of Clear Linux OS.</p>
<p>For example, if you look at
<a class="reference external" href="https://cdn.download.clearlinux.org/update/33010/Manifest.MoM">https://cdn.download.clearlinux.org/update/33010/Manifest.MoM</a>,
you will see that the minversion is 32900. So clone this version as the
starting point.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">MANIFEST 30</span>
<span class="go">version: 33010</span>
<span class="go">previous: 33000</span>
<span class="hll"><span class="go">minversion: 32900</span>
</span><span class="go">filecount: 1131</span>
<span class="go">timestamp: 1588358889</span>
<span class="go">contentsize: 0</span>
</pre></div>
</div>
</li>
<li><p>Make a directory to store the cache.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>mkdir<span class="w"> </span>~/mirror-download-clearlinux-org<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="nv">$_</span>
</pre></div>
</div>
</li>
<li><p>Recursively download the <code class="file docutils literal notranslate"><span class="pre">update/0</span></code> folder.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget<span class="w"> </span>--no-verbose<span class="w"> </span><span class="se">\</span>
--no-parent<span class="w"> </span>--recursive<span class="w"> </span><span class="se">\</span>
--no-host-directories<span class="w"> </span>-erobots<span class="o">=</span>off<span class="w"> </span><span class="se">\</span>
--reject<span class="w"> </span><span class="s2">&quot;index.html&quot;</span><span class="w"> </span>https://cdn.download.clearlinux.org/update/0/
</pre></div>
</div>
</li>
<li><p>Recursively download the <code class="file docutils literal notranslate"><span class="pre">update/version</span></code> folder.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget<span class="w"> </span>--no-verbose<span class="w"> </span><span class="se">\</span>
--no-parent<span class="w"> </span>--recursive<span class="w"> </span><span class="se">\</span>
--no-host-directories<span class="w"> </span>-erobots<span class="o">=</span>off<span class="w"> </span><span class="se">\</span>
--reject<span class="w"> </span><span class="s2">&quot;index.html&quot;</span><span class="w"> </span>https://cdn.download.clearlinux.org/update/version/
</pre></div>
</div>
</li>
<li><p>Now, recursively download the determined minversion, which for this example
is 32900.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget<span class="w"> </span>--no-verbose<span class="w"> </span><span class="se">\</span>
--no-parent<span class="w"> </span>--recursive<span class="w"> </span><span class="se">\</span>
--no-host-directories<span class="w"> </span>-erobots<span class="o">=</span>off<span class="w"> </span><span class="se">\</span>
--reject<span class="w"> </span><span class="s2">&quot;index.html&quot;</span><span class="w"> </span>https://cdn.download.clearlinux.org/update/32900/
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A minversion is pretty big, which is approximately 45GB. Depending on your
proximity to the upstream server and your connection speed to the Internet,
it may take up to a couple of days or more to complete the download. So
be patient.</p>
</div>
</li>
<li><p>Download later versions, up to the latest, if you like.</p></li>
</ol>
</section>
<section id="setup-a-web-server-to-host-the-mirrored-content">
<h2><a class="toc-backref" href="#id6" role="doc-backlink">Setup a web server to host the mirrored content</a><a class="headerlink" href="#setup-a-web-server-to-host-the-mirrored-content" title="Link to this heading"></a></h2>
<p>By design, the Clear Linux OS swupd client communicates with the update server using
HTTPS for security reasons. However, it can use HTTP by adding the
<strong class="command">--allow-insecure-http</strong> flag, if needed. Setting an HTTPS is a lot
more involved. For this tutorial, well just use an HTTP server for
demonstration purpose.</p>
<ol class="arabic">
<li><p>Install the <cite>nginx</cite> bundle.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-add<span class="w"> </span>nginx
</pre></div>
</div>
</li>
<li><p>Configure the web server.</p>
<ol class="loweralpha">
<li><p>Create a symbolic link to the mirrored update content directory.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>mkdir<span class="w"> </span>-p<span class="w"> </span>/var/www<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="nv">$_</span>
sudo<span class="w"> </span>ln<span class="w"> </span>-sf<span class="w"> </span><span class="nv">$HOME</span>/mirror-download-clearlinux-org<span class="w"> </span>mirror-download-clearlinux-org
</pre></div>
</div>
</li>
<li><p>Set up nginx configuration files.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>mkdir<span class="w"> </span>-p<span class="w"> </span>/etc/nginx/conf.d
sudo<span class="w"> </span>cp<span class="w"> </span>/usr/share/nginx/conf/nginx.conf.example<span class="w"> </span>/etc/nginx/nginx.conf
</pre></div>
</div>
</li>
<li><p>Grant $USER permission to run the web server.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>tee<span class="w"> </span>-a<span class="w"> </span>/etc/nginx/nginx.conf<span class="w"> </span><span class="s">&lt;&lt; EOF</span>
<span class="s">user $USER;</span>
<span class="s">EOF</span>
</pre></div>
</div>
</li>
<li><p>Configure the web server.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>tee<span class="w"> </span>-a<span class="w"> </span>/etc/nginx/conf.d/mirror-download-clearlinux-org.conf<span class="w"> </span><span class="s">&lt;&lt; EOF</span>
<span class="s">server {</span>
<span class="s"> listen 80;</span>
<span class="s"> listen [::]:80;</span>
<span class="s"> server_name localhost;</span>
<span class="s"> location / {</span>
<span class="s"> root /var/www/mirror-download-clearlinux-org;</span>
<span class="s"> autoindex on;</span>
<span class="s"> }</span>
<span class="s">}</span>
<span class="s">EOF</span>
</pre></div>
</div>
</li>
<li><p>Set nginx to start automatically on boot and then start it.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>nginx<span class="w"> </span>--now
</pre></div>
</div>
</li>
</ol>
</li>
</ol>
</section>
<section id="test-your-mirror">
<h2><a class="toc-backref" href="#id7" role="doc-backlink">Test your mirror</a><a class="headerlink" href="#test-your-mirror" title="Link to this heading"></a></h2>
<p>Now, try out your mirror by installing Clear Linux OS and adding bundles from it.</p>
<ol class="arabic">
<li><p>Download either the live desktop or live server installer ISO of the
<cite>same version</cite> as the mirrored version, which is 32900 for this tutorial.
Go to <cite>https://cdn.download.clearlinux.org/releases/&lt;release-version&gt;/clear</cite>.</p></li>
<li><p>Burn the ISO to a thumb drive. See <a class="reference internal" href="../get-started/bootable-usb.html#bootable-usb"><span class="std std-ref">Create a bootable USB drive using Etcher*</span></a>.</p></li>
<li><p>Boot it up and start the installer. Depending on which version of
Clear Linux OS you want to install, follow one of these guides:</p>
<ul class="simple">
<li><p><em>Desktop</em> version: <a class="reference internal" href="../get-started/bare-metal-install-desktop.html#bare-metal-install-desktop"><span class="std std-ref">Install Clear Linux* OS from the live desktop</span></a></p></li>
<li><p><em>Server</em> version: <a class="reference internal" href="../get-started/bare-metal-install-server.html#bare-metal-install-server"><span class="std std-ref">Install Clear Linux* OS from the live server</span></a></p></li>
</ul>
<p>In the <span class="guilabel">Advanced options</span> tab of the installer, select
<span class="guilabel">Swupd Mirror</span>. See Figure 1.</p>
<figure class="dropshadow align-default" id="id1">
<a class="reference internal image-reference" href="../_images/mirror-upstream-server-01.png"><img alt="Advanced options &gt; Swupd Mirror" src="../_images/mirror-upstream-server-01.png" style="width: 638.0px; height: 381.0px;" />
</a>
<figcaption>
<p><span class="caption-text"><cite>Figure 1: Advanced options &gt; Swupd Mirror</cite></span><a class="headerlink" href="#id1" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>In the <span class="guilabel">Mirror URL</span> field, set it to the IP address of your mirror. It should be something like this: <a class="reference external" href="http:/">http:/</a>/&lt;IP address of mirror server&gt;/update.
And check the option <span class="guilabel">Allow installation over insecure connections (http://)</span>. See Figure 2.</p>
<figure class="dropshadow align-default" id="id2">
<a class="reference internal image-reference" href="../_images/mirror-upstream-server-02.png"><img alt="Advanced options &gt; Mirror URL setting" src="../_images/mirror-upstream-server-02.png" style="width: 646.0px; height: 382.0px;" />
</a>
<figcaption>
<p><span class="caption-text"><cite>Figure 2: Advanced options &gt; Mirror URL setting</cite></span><a class="headerlink" href="#id2" title="Link to this image"></a></p>
</figcaption>
</figure>
</li>
<li><p>After installation completes, boot up, and log in.</p></li>
<li><p>Verify that the swupd client is pointing to your mirror.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>info
</pre></div>
</div>
<p>Example output:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">Warning: This is an insecure connection</span>
<span class="go">The --allow-insecure-http flag was used, be aware that this poses a threat the system</span>
<span class="go">Distribution: Clear Linux OS</span>
<span class="go">Installed version: 32900</span>
<span class="go">Version URL: https://192.168.1.100/update</span>
<span class="go">Content URL: https://192.168.1.100/update</span>
</pre></div>
</div>
</li>
<li><p>Try listing available bundles on your mirror.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-list<span class="w"> </span>-a
</pre></div>
</div>
</li>
<li><p>Add a bundle.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-add<span class="w"> </span>&lt;bundle-name&gt;
</pre></div>
</div>
</li>
</ol>
</section>
<section id="keep-your-mirror-in-sync-with-upstream">
<h2><a class="toc-backref" href="#id8" role="doc-backlink">Keep your mirror in sync with upstream</a><a class="headerlink" href="#keep-your-mirror-in-sync-with-upstream" title="Link to this heading"></a></h2>
<p>Be sure to keep your mirror in sync with upstream so that your clients have the
latest and greatest software and security updates. You can do that continuing
to clone the newer upstream releases.</p>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/clearlinux.png" alt="Logo of Clear Linux* Project Docs"/>
</a></p>
<div>
<h3><a href="../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Mirror Upstream Clear Linux OS Update Server</a><ul>
<li><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
<li><a class="reference internal" href="#install-up-cl-server-to-host-updates">Install up Clear Linux OS server to host updates</a></li>
<li><a class="reference internal" href="#clone-the-cl-update-content">Clone the Clear Linux OS update content</a></li>
<li><a class="reference internal" href="#setup-a-web-server-to-host-the-mirrored-content">Setup a web server to host the mirrored content</a></li>
<li><a class="reference internal" href="#test-your-mirror">Test your mirror</a></li>
<li><a class="reference internal" href="#keep-your-mirror-in-sync-with-upstream">Keep your mirror in sync with upstream</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="lamp-server.html"
title="previous chapter">LAMP Web Server</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="nvidia.html"
title="next chapter">NVIDIA* Drivers</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/tutorials/mirror-upstream-server.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="nvidia.html" title="NVIDIA* Drivers"
>next</a> |</li>
<li class="right" >
<a href="lamp-server.html" title="LAMP Web Server"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Documentation for Clear Linux* project</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" >Tutorials</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Mirror Upstream Clear Linux OS Update Server</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2022 Intel Corporation. All Rights Reserved..
Last updated on Nov 04, 2024.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3.
</div>
</body>
</html>