Your IP : 216.73.216.52


Current Path : /snap/lxd/current/share/lxd-documentation/tutorial/first_steps/
Upload File :
Current File : //snap/lxd/current/share/lxd-documentation/tutorial/first_steps/index.html

<!doctype html>
<html class="no-js" lang="en" data-content_root="../../">
  <head><meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="First steps with LXD" />
<meta property="og:type" content="website" />
<meta property="og:url" content="/tutorial/first_steps/" />
<meta property="og:site_name" content="LXD documentation" />
<meta property="og:description" content="This tutorial guides you through your first steps with LXD. You’ll begin by installing and initializing LXD. Then you’ll use its CLI or graphical web UI to work with instances, including both conta..." />
<meta property="og:image" content="https://documentation.ubuntu.com/lxd/latest/_static/lxd_tag.png" />
<meta property="og:image:alt" content="LXD documentation" />
<meta name="description" content="This tutorial guides you through your first steps with LXD. You’ll begin by installing and initializing LXD. Then you’ll use its CLI or graphical web UI to work with instances, including both conta..." />

    <meta property="article:modified_time" content="2026-02-26T08:54:05+00:00" /><link rel="index" title="Index" href="../../genindex/"><link rel="search" title="Search" href="../../search/"><link rel="next" title="How-to guides" href="../../howto/"><link rel="prev" title="LXD" href="../../">
        <link rel="canonical" href="/tutorial/first_steps/">

    <link rel="shortcut icon" href="../../_static/favicon.ico"><!-- Generated with Sphinx 7.4.7 and Furo 2025.12.19 -->
        <title>First steps with LXD - LXD documentation</title>
      <link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=d111a655" />
    <link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=7bdb33bb" />
    <link rel="stylesheet" type="text/css" href="../../_static/copybutton.css?v=76b2166b" />
    <link rel="stylesheet" type="text/css" href="../../_static/config-options.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/related-links.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/terminal.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/youtube.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/sphinx-design.min.css?v=95c83b7e" />
    <link rel="stylesheet" type="text/css" href="../../_static/tabs.css?v=a5c4661c" />
    <link rel="stylesheet" type="text/css" href="../../_static/styles/furo-extensions.css?v=8dab3a3b" />
    <link rel="stylesheet" type="text/css" href="../../_static/lxd_custom.css?v=bfbf4da2" />
    <link rel="stylesheet" type="text/css" href="../../_static/cookie-banner.css?v=b74831ab" />
    <link rel="stylesheet" type="text/css" href="../../_static/custom.css?v=e189117a" />
    <link rel="stylesheet" type="text/css" href="../../_static/header.css?v=a8078839" />
    <link rel="stylesheet" type="text/css" href="../../_static/github_issue_links.css?v=3d761185" />
    <link rel="stylesheet" type="text/css" href="../../_static/furo_colors.css?v=825fec6f" />
    
</head>
  <body>
    <header id="header" class="p-navigation">
  <!-- Google Tag Manager -->
  <script>
    (function(w, d, s, l, i) {
      w[l] = w[l] || [];
      w[l].push({
        'gtm.start': new Date().getTime(),
        event: 'gtm.js'
      });
      var f = d.getElementsByTagName(s)[0];
      var j = d.createElement(s);
      var dl = '';
      if (l != 'dataLayer') {
          dl = '&l=' + l;
      }
      j.async = true;
      j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
      f.parentNode.insertBefore(j, f);
    })(window, document, 'script', 'dataLayer', 'GTM-KNX3CJC');
  </script>
  
  <div class="p-navigation__nav" role="menubar">

    <ul class="p-navigation__links" role="menu">

      <li>
        
        <a class="p-logo" href="https://canonical.com/lxd" aria-current="page">
          <img src="../../_static/lxd_tag.png" alt="Logo" class="p-logo-image">
          <div class="p-logo-text p-heading--4">LXD
          </div>
        </a>
        
      </li>

      <li class="nav-ubuntu-com">
        
        <a href="https://canonical.com/lxd" class="p-navigation__link">canonical.com/lxd</a>
        
      </li>

      <li class="nav-dropdown">
        <a href="#" class="p-navigation__link nav-more-links"
           id="more-resources-toggle"
           aria-haspopup="true"
           aria-expanded="false">
          More resources
        </a>
        <ul class="more-links-dropdown" aria-labelledby="more-resources-toggle">
          
          <li>
            <a href="https://discourse.ubuntu.com/c/lxd/" class="p-navigation__sub-link p-dropdown__link">Discourse</a>
          </li>
          
      
          
      
          
          <li>
            <a href="https://matrix.to/#/#documentation:ubuntu.com" class="p-navigation__sub-link p-dropdown__link">Matrix</a>
          </li>
          
      
          
          <li>
            <a href="https://github.com/canonical/lxd" class="p-navigation__sub-link p-dropdown__link">GitHub</a>
          </li>
          

        </ul>
      </li>

    </ul>
  </div>
</header>
   
    <script>
      document.body.dataset.theme = localStorage.getItem("theme") || "auto";
    </script>
    

<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
  <symbol id="svg-toc" viewBox="0 0 24 24">
    <title>Contents</title>
    <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
      <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
    </svg>
  </symbol>
  <symbol id="svg-menu" viewBox="0 0 24 24">
    <title>Menu</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
      <line x1="3" y1="12" x2="21" y2="12"></line>
      <line x1="3" y1="6" x2="21" y2="6"></line>
      <line x1="3" y1="18" x2="21" y2="18"></line>
    </svg>
  </symbol>
  <symbol id="svg-arrow-right" viewBox="0 0 24 24">
    <title>Expand</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
      <polyline points="9 18 15 12 9 6"></polyline>
    </svg>
  </symbol>
  <symbol id="svg-sun" viewBox="0 0 24 24">
    <title>Light mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
      <circle cx="12" cy="12" r="5"></circle>
      <line x1="12" y1="1" x2="12" y2="3"></line>
      <line x1="12" y1="21" x2="12" y2="23"></line>
      <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
      <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
      <line x1="1" y1="12" x2="3" y2="12"></line>
      <line x1="21" y1="12" x2="23" y2="12"></line>
      <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
      <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
    </svg>
  </symbol>
  <symbol id="svg-moon" viewBox="0 0 24 24">
    <title>Dark mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
      <path stroke="none" d="M0 0h24v24H0z" fill="none" />
      <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
    </svg>
  </symbol>
  <symbol id="svg-sun-with-moon" viewBox="0 0 24 24">
    <title>Auto light/dark, in light mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
      class="icon-custom-derived-from-feather-sun-and-tabler-moon">
      <path style="opacity: 50%" d="M 5.411 14.504 C 5.471 14.504 5.532 14.504 5.591 14.504 C 3.639 16.319 4.383 19.569 6.931 20.352 C 7.693 20.586 8.512 20.551 9.25 20.252 C 8.023 23.207 4.056 23.725 2.11 21.184 C 0.166 18.642 1.702 14.949 4.874 14.536 C 5.051 14.512 5.231 14.5 5.411 14.5 L 5.411 14.504 Z"/>
      <line x1="14.5" y1="3.25" x2="14.5" y2="1.25"/>
      <line x1="14.5" y1="15.85" x2="14.5" y2="17.85"/>
      <line x1="10.044" y1="5.094" x2="8.63" y2="3.68"/>
      <line x1="19" y1="14.05" x2="20.414" y2="15.464"/>
      <line x1="8.2" y1="9.55" x2="6.2" y2="9.55"/>
      <line x1="20.8" y1="9.55" x2="22.8" y2="9.55"/>
      <line x1="10.044" y1="14.006" x2="8.63" y2="15.42"/>
      <line x1="19" y1="5.05" x2="20.414" y2="3.636"/>
      <circle cx="14.5" cy="9.55" r="3.6"/>
    </svg>
  </symbol>
  <symbol id="svg-moon-with-sun" viewBox="0 0 24 24">
    <title>Auto light/dark, in dark mode</title>
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
      class="icon-custom-derived-from-feather-sun-and-tabler-moon">
      <path d="M 8.282 7.007 C 8.385 7.007 8.494 7.007 8.595 7.007 C 5.18 10.184 6.481 15.869 10.942 17.24 C 12.275 17.648 13.706 17.589 15 17.066 C 12.851 22.236 5.91 23.143 2.505 18.696 C -0.897 14.249 1.791 7.786 7.342 7.063 C 7.652 7.021 7.965 7 8.282 7 L 8.282 7.007 Z"/>
      <line style="opacity: 50%" x1="18" y1="3.705" x2="18" y2="2.5"/>
      <line style="opacity: 50%" x1="18" y1="11.295" x2="18" y2="12.5"/>
      <line style="opacity: 50%" x1="15.316" y1="4.816" x2="14.464" y2="3.964"/>
      <line style="opacity: 50%" x1="20.711" y1="10.212" x2="21.563" y2="11.063"/>
      <line style="opacity: 50%" x1="14.205" y1="7.5" x2="13.001" y2="7.5"/>
      <line style="opacity: 50%" x1="21.795" y1="7.5" x2="23" y2="7.5"/>
      <line style="opacity: 50%" x1="15.316" y1="10.184" x2="14.464" y2="11.036"/>
      <line style="opacity: 50%" x1="20.711" y1="4.789" x2="21.563" y2="3.937"/>
      <circle style="opacity: 50%" cx="18" cy="7.5" r="2.169"/>
    </svg>
  </symbol>
  <symbol id="svg-pencil" viewBox="0 0 24 24">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-pencil-code">
      <path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" />
      <path d="M13.5 6.5l4 4" />
      <path d="M20 21l2 -2l-2 -2" />
      <path d="M17 17l-2 2l2 2" />
    </svg>
  </symbol>
  <symbol id="svg-eye" viewBox="0 0 24 24">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
      stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-eye-code">
      <path stroke="none" d="M0 0h24v24H0z" fill="none" />
      <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
      <path
        d="M11.11 17.958c-3.209 -.307 -5.91 -2.293 -8.11 -5.958c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6c-.21 .352 -.427 .688 -.647 1.008" />
      <path d="M20 21l2 -2l-2 -2" />
      <path d="M17 17l-2 2l2 2" />
    </svg>
  </symbol>
</svg>

<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation" aria-label="Toggle site navigation sidebar">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc" aria-label="Toggle table of contents sidebar">
<label class="overlay sidebar-overlay" for="__navigation"></label>
<label class="overlay toc-overlay" for="__toc"></label>

<a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a>



<div class="page">
  <header class="mobile-header">
    <div class="header-left">
      <label class="nav-overlay-icon" for="__navigation">
        <span class="icon"><svg><use href="#svg-menu"></use></svg></span>
      </label>
    </div>
    <div class="header-center">
      <a href="../../"><div class="brand">LXD documentation</div></a>
    </div>
    <div class="header-right">
      <div class="theme-toggle-container theme-toggle-header">
        <button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme">
          <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
          <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
          <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
          <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
        </button>
      </div>
      <label class="toc-overlay-icon toc-header-icon" for="__toc">
        <span class="icon"><svg><use href="#svg-toc"></use></svg></span>
      </label>
    </div>
  </header>
  <aside class="sidebar-drawer">
    <div class="sidebar-container">
      
      <div class="sidebar-sticky"><a class="sidebar-brand" href="../../">
  
  <span class="sidebar-brand-text">LXD documentation</span>
  
</a><form class="sidebar-search-container" method="get" action="../../search/" role="search">
    <input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
    <input type="submit" value="Go">
    <input type="hidden" name="check_keywords" value="yes">
    <input type="hidden" name="area" value="default">
  </form>
  <div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
  <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../">LXD</a></li>
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Tutorial</a></li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../howto/">How-to guides</a><input aria-label="Toggle navigation of How-to guides" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../getting_started/">Getting started</a><input aria-label="Toggle navigation of Getting started" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../installing/">Install LXD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/initialize/">Initialize LXD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/access_ui/">Access the UI</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/access_documentation/">Access documentation locally</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../operation/">LXD server and client</a><input aria-label="Toggle navigation of LXD server and client" class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" role="switch" type="checkbox"/><label for="toctree-checkbox-3"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/server_expose/">Expose LXD to the network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/server_configure/">Configure the LXD server</a></li>
<li class="toctree-l3 has-children"><a class="reference internal" href="../../howto/oidc/">Configure single sign-on with OIDC</a><input aria-label="Toggle navigation of Configure single sign-on with OIDC" class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" role="switch" type="checkbox"/><label for="toctree-checkbox-4"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l4"><a class="reference internal" href="../../howto/oidc_auth0/">How to configure Auth0</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../howto/oidc_ory/">How to configure Ory Hydra</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../howto/oidc_keycloak/">How to configure Keycloak</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../howto/oidc_entra_id/">How to configure Entra ID</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../remotes/">Add remote servers</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/lxc_alias/">Add command aliases</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../instances/">Instances</a><input aria-label="Toggle navigation of Instances" class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" role="switch" type="checkbox"/><label for="toctree-checkbox-5"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_create/">Create instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_configure/">Configure instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_manage/">Manage instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../profiles/">Use profiles</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_troubleshoot/">Troubleshoot errors</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_ubuntu_pro_attach/">Auto attach Ubuntu Pro</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_access_files/">Access files</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_console/">Access the console</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../instance-exec/">Run commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../cloud-init/">Use cloud-init</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_routed_nic_vm/">Add a routed NIC to a VM</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_backup/">Back up instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_migrate/">Migrate instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/import_machines_to_instances/">Import existing machines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/container_gpu_passthrough_with_docker/">Pass NVIDIA GPUs</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../images/">Images</a><input aria-label="Toggle navigation of Images" class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" role="switch" type="checkbox"/><label for="toctree-checkbox-6"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/images_remote/">Use remote images</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/images_manage/">Manage images</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/images_profiles/">Associate profiles</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/images_copy/">Copy and import images</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/images_create/">Create images</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../projects/">Projects</a><input aria-label="Toggle navigation of Projects" class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" role="switch" type="checkbox"/><label for="toctree-checkbox-7"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/projects_create/">Create and configure</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/projects_work/">Work with projects</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/projects_confine/">Confine users to projects</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../storage/">Storage</a><input aria-label="Toggle navigation of Storage" class="toctree-checkbox" id="toctree-checkbox-8" name="toctree-checkbox-8" role="switch" type="checkbox"/><label for="toctree-checkbox-8"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/storage_pools/">Manage pools</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/storage_volumes/">Manage volumes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/storage_buckets/">Manage buckets</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/storage_create_instance/">Create an instance in a pool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/storage_backup_volume/">Back up a volume</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/storage_move_volume/">Move or copy a volume</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/storage_csi/">Use the LXD CSI driver with Kubernetes</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../networks/">Networking</a><input aria-label="Toggle navigation of Networking" class="toctree-checkbox" id="toctree-checkbox-9" name="toctree-checkbox-9" role="switch" type="checkbox"/><label for="toctree-checkbox-9"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_create/">Create a network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_configure/">Configure a network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_bgp/">Configure as BGP server</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_acls/">Configure network ACLs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_forwards/">Configure forwards</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_zones/">Configure network zones</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_bridge_firewalld/">Configure your firewall</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_bridge_resolved/">Integrate with resolved</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_ovn_setup/">Set up OVN</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_load_balancers/">Configure load balancers</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_ovn_peers/">Configure peer routing</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_ipam/">Display IPAM information</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../clustering/">Clustering</a><input aria-label="Toggle navigation of Clustering" class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" role="switch" type="checkbox"/><label for="toctree-checkbox-10"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_form/">Form a cluster</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_manage/">Manage a cluster</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_config_networks/">Configure networks</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_config_storage/">Configure storage</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_manage_instance/">Manage instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_groups/">Set up cluster groups</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_placement_groups/">Use placement groups</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_recover/">Recover a cluster</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/cluster_vip/">Set up a highly available virtual IP</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../production-setup/">Production setup</a><input aria-label="Toggle navigation of Production setup" class="toctree-checkbox" id="toctree-checkbox-11" name="toctree-checkbox-11" role="switch" type="checkbox"/><label for="toctree-checkbox-11"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/benchmark_performance/">Benchmark performance</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_increase_bandwidth/">Increase bandwidth</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../metrics/">Monitor metrics</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/logs_loki/">Send logs to Loki</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/grafana/">Set up Grafana</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../backup/">Back up a server</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/disaster_recovery/">Recover instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/disaster_recovery_replication/">Disaster recovery with storage replication</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../howto/snap/">Manage the snap</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../howto/security_harden/">Harden security</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../howto/troubleshoot/">Troubleshooting</a><input aria-label="Toggle navigation of Troubleshooting" class="toctree-checkbox" id="toctree-checkbox-12" name="toctree-checkbox-12" role="switch" type="checkbox"/><label for="toctree-checkbox-12"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../howto/network_bridge_firewalld/">Configure your firewall</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/instances_troubleshoot/">Troubleshoot instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../howto/dqlite_troubleshoot/">Troubleshoot Dqlite</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../debugging/">Debug LXD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../faq/">Frequently asked</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../support/">Get support</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../contributing/">Contribute to LXD</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../howto/auth_bearer/">How to authenticate to the LXD API using bearer tokens</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../howto/devlxd_authenticate/">How to authenticate to the DevLXD API</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../explanation/">Explanation</a><input aria-label="Toggle navigation of Explanation" class="toctree-checkbox" id="toctree-checkbox-13" name="toctree-checkbox-13" role="switch" type="checkbox"/><label for="toctree-checkbox-13"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/lxd_lxc/"><code class="docutils literal notranslate"><span class="pre">lxd</span></code> and <code class="docutils literal notranslate"><span class="pre">lxc</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/instances/">Containers and VMs</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../image-handling/">Local and remote images</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/storage/">Storage pools, volumes, and buckets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/networks/">Networking setups</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../database/">The LXD Dqlite database</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/lxc_show_info/"><code class="docutils literal notranslate"><span class="pre">lxc</span></code> <code class="docutils literal notranslate"><span class="pre">show</span></code> and <code class="docutils literal notranslate"><span class="pre">info</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../../authentication/">Remote API authentication</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/authorization/">Remote API authorization</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/projects/">Instances grouping with projects</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/clusters/">Clusters</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/performance_tuning/">Performance tuning</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/security/">Security</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/bpf/">Privilege delegation using BPF Token</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/csi/">The LXD CSI driver</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../reference/">Reference</a><input aria-label="Toggle navigation of Reference" class="toctree-checkbox" id="toctree-checkbox-14" name="toctree-checkbox-14" role="switch" type="checkbox"/><label for="toctree-checkbox-14"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../requirements/">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../architectures/">Architectures</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../reference/release-notes/">Release notes</a><input aria-label="Toggle navigation of Release notes" class="toctree-checkbox" id="toctree-checkbox-15" name="toctree-checkbox-15" role="switch" type="checkbox"/><label for="toctree-checkbox-15"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/release-notes/release-notes-6.7/">LXD 6.7</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/release-notes/release-notes-6.6/">LXD 6.6</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/releases-snap/">Releases and snap</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/remote_image_servers/">Remote image servers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/image_format/">Image format</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../guest-os-compatibility/">Guest OS compatibility</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../container-environment/">Container environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../config-options/">Configuration option index</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../server/">Server configuration</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../explanation/instance_config/">Instance configuration</a><input aria-label="Toggle navigation of Instance configuration" class="toctree-checkbox" id="toctree-checkbox-16" name="toctree-checkbox-16" role="switch" type="checkbox"/><label for="toctree-checkbox-16"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/instance_properties/">Instance properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/instance_options/">Instance options</a></li>
<li class="toctree-l3 has-children"><a class="reference internal" href="../../reference/devices/">Devices</a><input aria-label="Toggle navigation of Devices" class="toctree-checkbox" id="toctree-checkbox-17" name="toctree-checkbox-17" role="switch" type="checkbox"/><label for="toctree-checkbox-17"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l4"><a class="reference internal" href="../../reference/standard_devices/">Standard devices</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_none/">Type: <code class="docutils literal notranslate"><span class="pre">none</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_nic/">Type: <code class="docutils literal notranslate"><span class="pre">nic</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_disk/">Type: <code class="docutils literal notranslate"><span class="pre">disk</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_unix_char/">Type: <code class="docutils literal notranslate"><span class="pre">unix-char</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_unix_block/">Type: <code class="docutils literal notranslate"><span class="pre">unix-block</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_usb/">Type: <code class="docutils literal notranslate"><span class="pre">usb</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_gpu/">Type: <code class="docutils literal notranslate"><span class="pre">gpu</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_infiniband/">Type: <code class="docutils literal notranslate"><span class="pre">infiniband</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_proxy/">Type: <code class="docutils literal notranslate"><span class="pre">proxy</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_unix_hotplug/">Type: <code class="docutils literal notranslate"><span class="pre">unix-hotplug</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_tpm/">Type: <code class="docutils literal notranslate"><span class="pre">tpm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_pci/">Type: <code class="docutils literal notranslate"><span class="pre">pci</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/instance_units/">Units for storage and network limits</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/preseed_yaml_fields/">Preseed YAML file fields</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/projects/">Project configuration</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../reference/storage_drivers/">Storage drivers</a><input aria-label="Toggle navigation of Storage drivers" class="toctree-checkbox" id="toctree-checkbox-18" name="toctree-checkbox-18" role="switch" type="checkbox"/><label for="toctree-checkbox-18"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_dir/">Directory - <code class="docutils literal notranslate"><span class="pre">dir</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_btrfs/">Btrfs - <code class="docutils literal notranslate"><span class="pre">btrfs</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_lvm/">LVM - <code class="docutils literal notranslate"><span class="pre">lvm</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_zfs/">ZFS - <code class="docutils literal notranslate"><span class="pre">zfs</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_ceph/">Ceph RBD - <code class="docutils literal notranslate"><span class="pre">ceph</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_powerflex/">Dell PowerFlex - <code class="docutils literal notranslate"><span class="pre">powerflex</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_pure/">Pure Storage - <code class="docutils literal notranslate"><span class="pre">pure</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_alletra/">HPE Alletra - <code class="docutils literal notranslate"><span class="pre">alletra</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_cephfs/">CephFS - <code class="docutils literal notranslate"><span class="pre">cephfs</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_cephobject/">Ceph Object - <code class="docutils literal notranslate"><span class="pre">cephobject</span></code></a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../reference/networks/">Networks</a><input aria-label="Toggle navigation of Networks" class="toctree-checkbox" id="toctree-checkbox-19" name="toctree-checkbox-19" role="switch" type="checkbox"/><label for="toctree-checkbox-19"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_bridge/">Bridge network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_ovn/">OVN network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_macvlan/">Macvlan network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_physical/">Physical network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_sriov/">SR-IOV network</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/cluster_member_config/">Cluster configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/placement_groups/">Placement group configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/server_settings/">Production server settings</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/provided_metrics/">Provided metrics</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/permissions/">Permissions</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../restapi_landing/">REST API</a><input aria-label="Toggle navigation of REST API" class="toctree-checkbox" id="toctree-checkbox-20" name="toctree-checkbox-20" role="switch" type="checkbox"/><label for="toctree-checkbox-20"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../rest-api/">Main API documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api/">Main API specification</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api-extensions/">Main API extensions</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../events/">Events API documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev-lxd/">Instance API</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/driver_csi/">LXD CSI driver reference</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../reference/manpages/">Man pages</a><input aria-label="Toggle navigation of Man pages" class="toctree-checkbox" id="toctree-checkbox-21" name="toctree-checkbox-21" role="switch" type="checkbox"/><label for="toctree-checkbox-21"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/manpages/lxc/"><code class="docutils literal notranslate"><span class="pre">lxc</span></code></a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../internals/">Internals</a><input aria-label="Toggle navigation of Internals" class="toctree-checkbox" id="toctree-checkbox-22" name="toctree-checkbox-22" role="switch" type="checkbox"/><label for="toctree-checkbox-22"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../environment/">Environment variables</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/uefi_variables/">UEFI variables for VMs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../daemon-behavior/">Daemon behavior</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../syscall-interception/">System call interception</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../userns-idmap/">User namespace setup</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/ovn-internals/">OVN implementation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/vm_live_migration_internals/">VM live migration implementation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/dqlite-internals/">Dqlite</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference external" href="https://github.com/canonical/lxd">Project repository</a></li>
<li class="toctree-l2"><a class="reference external" href="https://images.lxd.canonical.com">Image server</a></li>
</ul>
</li>
</ul>

</div>
</div>

      </div>
      
    </div>
  </aside>
  <div class="main">
    <div class="content">
      <div class="article-container">
        <a href="#" class="back-to-top muted-link">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
            <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
          </svg>
          <span>Back to top</span>
        </a>
        <div class="content-icon-container">
          <div class="edit-this-page">
  <a class="muted-link" href="https://github.com/canonical/lxd/edit/main/doc/tutorial/first_steps.md" title="Contribute to this page">
    <svg><use href="#svg-pencil"></use></svg>
    <span class="visually-hidden">Contribute to this page</span>
  </a>
</div><div class="theme-toggle-container theme-toggle-content">
            <button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme">
              <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
              <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
              <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
              <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
            </button>
          </div>
          <label class="toc-overlay-icon toc-content-icon" for="__toc">
            <span class="icon"><svg><use href="#svg-toc"></use></svg></span>
          </label>
        </div>
        <article role="main" id="furo-main-content">
          <section id="first-steps-with-lxd">
<span id="tutorial-first-steps"></span><span id="first-steps"></span><h1>First steps with LXD<a class="headerlink" href="#first-steps-with-lxd" title="Link to this heading">¶</a></h1>
<p>This tutorial guides you through your first steps with LXD. You’ll begin by installing and initializing LXD. Then you’ll use its CLI or graphical web UI to work with instances, including both containers and virtual machines. You’ll learn how to create and configure instances, create snapshots, and more.</p>
<section id="requirements">
<span id="tutorial-requirements"></span><h2>Requirements<a class="headerlink" href="#requirements" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p>At least 20 GiB free disk space</p></li>
<li><p>A Linux distribution installed</p></li>
</ul>
</section>
<section id="install-lxd-using-snap">
<span id="tutorial-install"></span><h2>Install LXD using snap<a class="headerlink" href="#install-lxd-using-snap" title="Link to this heading">¶</a></h2>
<p>This section of the tutorial assumes that you have the <code class="docutils literal notranslate"><span class="pre">snap</span></code> packaging system available on your system, which is the recommended way to install and update LXD.</p>
<p>To install LXD using <code class="docutils literal notranslate"><span class="pre">snap</span></code>, run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>snap<span class="w"> </span>install<span class="w"> </span>lxd
</pre></div>
</div>
<div class="note admonition">
<p class="admonition-title">If snap is not installed or not supported</p>
<p>If you see an error message indicating that <code class="docutils literal notranslate"><span class="pre">snap</span></code> is not installed, visit the <a class="reference external" href="https://snapcraft.io/docs/installing-snapd">Snap installation documentation</a> and follow the instructions there to install it.</p>
<p>If you use a Linux distribution that does not support <code class="docutils literal notranslate"><span class="pre">snap</span></code>, see <a class="reference internal" href="../../installing/#installing-other"><span class="std std-ref">Other Linux installation options</span></a> to install LXD by other means if possible, then skip to the <a class="reference internal" href="#tutorial-adduser"><span class="std std-ref">next section</span></a> of this tutorial.</p>
</div>
<section id="if-the-lxd-snap-is-already-installed">
<h3>If the LXD snap is already installed<a class="headerlink" href="#if-the-lxd-snap-is-already-installed" title="Link to this heading">¶</a></h3>
<p>This tutorial is designed for LXD version 5.21 and higher. If you see an error message that the LXD snap is already installed, run the following command to find the channel the snap is tracking:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>snap<span class="w"> </span>list<span class="w"> </span>lxd
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">Tracking</span></code> column lists the installed <a class="reference internal" href="../../reference/releases-snap/#ref-snap-channels"><span class="std std-ref">snap channel</span></a>. If the number shown is 5.21 or higher, run the following command to update the snap to the most recent release in its channel:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>snap<span class="w"> </span>refresh<span class="w"> </span>lxd
</pre></div>
</div>
<p>Otherwise, if the number shown is lower, an older version is installed. In this case, upgrade to the 5.21/stable channel by following the instructions in this guide: <a class="reference internal" href="../../howto/snap/#howto-snap-change"><span class="std std-ref">Change the snap channel</span></a>.</p>
</section>
</section>
<section id="add-the-current-user-to-the-lxd-group">
<span id="tutorial-adduser"></span><h2>Add the current user to the <code class="docutils literal notranslate"><span class="pre">lxd</span></code> group<a class="headerlink" href="#add-the-current-user-to-the-lxd-group" title="Link to this heading">¶</a></h2>
<div class="important admonition">
<p class="admonition-title">Important security notice</p>
<p>Local access to LXD through the Unix socket always grants full access to LXD.
This includes the ability to attach file system paths or devices to any instance as well as tweak the security features on any instance.</p>
<p>Therefore, you should only give such access to users who you’d trust with root access to your system.</p>
<p>For more information, see <a class="reference internal" href="../../explanation/security/#security-daemon-access"><span class="std std-ref">Access to the LXD daemon</span></a>.</p>
</div>
<p>Installing LXD through its snap should automatically create an <code class="docutils literal notranslate"><span class="pre">lxd</span></code> group on your system. The user you are logged in as must be in this group to interact with LXD.</p>
<p>Enter the following commands. The first command adds your user to the <code class="docutils literal notranslate"><span class="pre">lxd</span></code> group.
The second command starts a new shell where the group membership takes effect immediately.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>usermod<span class="w"> </span>-aG<span class="w"> </span>lxd<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$USER</span><span class="s2">&quot;</span>
newgrp<span class="w"> </span>lxd
</pre></div>
</div>
</section>
<section id="initialize-lxd">
<span id="tutorial-initialize"></span><h2>Initialize LXD<a class="headerlink" href="#initialize-lxd" title="Link to this heading">¶</a></h2>
<p>Next, initialize LXD using a minimal setup with default options.</p>
<p>Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxd<span class="w"> </span>init<span class="w"> </span>--minimal
</pre></div>
</div>
<p>If this command results in an error message, your group membership might not have taken effect. In this case, close and re-open your terminal, then try again.</p>
<p>If you do not see any message when running this command, that means it has succeeded. Congratulations! You have successfully installed and initialized LXD. Continue on to learn how to use some of LXD’s core features.</p>
<div class="tip admonition">
<p class="admonition-title">About the initialization options</p>
<p>The <code class="docutils literal notranslate"><span class="pre">lxd</span> <span class="pre">init</span></code> command can be run again later to update the options. Once you have learned more about LXD, you might want to tune the <a class="reference internal" href="../../howto/initialize/#initialize"><span class="std std-ref">initialization options</span></a> according to your own preferences, or learn how to <a class="reference internal" href="../../howto/initialize/#initialize-preseed"><span class="std std-ref">use a preseed file</span></a> to initialize LXD from a saved set of options. For now, the minimal configuration is sufficient.</p>
</div>
</section>
<section id="enable-the-lxd-ui">
<span id="tutorial-enable-ui"></span><h2>Enable the LXD UI<a class="headerlink" href="#enable-the-lxd-ui" title="Link to this heading">¶</a></h2>
<p>While the installation and initialization steps must be performed via the command line interface, a graphical interface (the LXD UI) is available for use after these setup steps. The LXD UI is accessed through your web browser.</p>
<p>If you prefer to use the LXD UI, expand and follow the steps below.</p>
<details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3">
<summary class="sd-summary-title sd-card-header">
<span class="sd-summary-text">View steps to enable the LXD UI</span><span class="sd-summary-state-marker sd-summary-chevron-right"><svg version="1.1" width="1.5em" height="1.5em" class="sd-octicon sd-octicon-chevron-right" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.72 18.78a.75.75 0 0 1 0-1.06L14.44 12 8.72 6.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l6.25 6.25a.75.75 0 0 1 0 1.06l-6.25 6.25a.75.75 0 0 1-1.06 0Z"></path></svg></span></summary><div class="sd-summary-content sd-card-body docutils">
<p class="rubric" id="expose-the-lxd-server-to-the-local-network">Expose the LXD server to the local network</p>
<p class="sd-card-text">By default, LXD is exposed through a Unix socket only and is not accessible over HTTPS. To access and manage LXD through a web browser using HTTPS, we must set the <a class="configref reference internal" href="../../server/#server-core:core.https_address"><code class="docutils literal notranslate"><span class="pre">core.https_address</span></code></a> server configuration option. We will use the local network by configuring this to the IPv6 loopback address <code class="docutils literal notranslate"><span class="pre">[::1]</span></code> and port 8443. Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>core.https_address<span class="w"> </span><span class="m">127</span>.0.0.1:8443
</pre></div>
</div>
<p class="sd-card-text">Confirm that the <code class="docutils literal notranslate"><span class="pre">core.https_address</span></code> is set to <code class="docutils literal notranslate"><span class="pre">127.0.0.1:8443</span></code>:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>config<span class="w"> </span>get<span class="w"> </span>core.https_address
</pre></div>
</div>
<p class="rubric" id="set-up-ui-access">Set up UI access</p>
<p class="sd-card-text">Go to this URL in your browser: <a class="reference external" href="https://localhost:8443"><code class="docutils literal notranslate"><span class="pre">https://localhost:8443</span></code></a></p>
<p class="sd-card-text">If you have not set up a secure <a class="reference internal" href="../../authentication/#authentication-server-certificate"><span class="std std-ref">TLS server certificate</span></a>, LXD uses a self-signed certificate, which will cause a security warning in your browser. Use your browser’s mechanism to continue this time despite the security warning.</p>
<p class="sd-card-text">For example, in Chrome, click <strong>Advanced</strong>, then follow the link to <strong>Proceed</strong> at the bottom as shown below:</p>
<figure class="align-default">
<a class="reference internal image-reference" href="../../_images/ui_security_warning.png"><img alt="Example for a security warning in Chrome" src="../../_images/ui_security_warning.png" style="width: 80%;" />
</a>
</figure>
<p class="sd-card-text">In Firefox, click <strong>Advanced</strong>, then follow the link to <strong>Accept the risk and continue</strong>.</p>
<p class="rubric" id="set-up-the-browser-certificate">Set up the browser certificate</p>
<p class="sd-card-text">Follow the instructions in the LXD UI browser page to install and select the browser certificate, also called a client certificate.</p>
<p class="sd-card-text">If you have previously installed a certificate for the LXD UI, your browser will offer you the option to use it. Confirm that the installed certificate’s issuer is listed in the LXD UI, then select it.</p>
<p class="sd-card-text">After you have selected your certificate, follow the LXD UI’s on-page instructions to set up the trust token.</p>
<p class="sd-card-text">Finally, click <span class="guilabel">Connect</span> in the UI to complete gaining access. You should then see the <span class="guilabel">Instances</span> page.</p>
</div>
</details><p>As you continue on with this tutorial, notice that many of the following sections include sets of tabs. When the <code class="docutils literal notranslate"><span class="pre">UI</span></code> tab is available, you can now use the instructions in that tab.</p>
</section>
<section id="create-instances">
<span id="tutorial-create-instances"></span><h2>Create instances<a class="headerlink" href="#create-instances" title="Link to this heading">¶</a></h2>
<p>LXD uses images to create instances from either <a class="reference internal" href="../../image-handling/#about-images"><span class="std std-ref">local or remote image servers</span></a>. We will fetch our container images from the remote <a class="reference external" href="https://cloud-images.ubuntu.com/releases/"><code class="docutils literal notranslate"><span class="pre">ubuntu:</span></code></a> server, which hosts official Ubuntu images.</p>
<section id="create-and-start-containers">
<span id="tutorial-create-containers"></span><h3>Create and start containers<a class="headerlink" href="#create-and-start-containers" title="Link to this heading">¶</a></h3>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-0-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-0-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-0-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-0-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-0-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-0-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>For managing instances, we use the <a class="reference internal" href="../../explanation/lxd_lxc/#lxd-lxc"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span></code> command instead of <code class="docutils literal notranslate"><span class="pre">lxd</span></code></span></a>.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">launch</span></code> command creates an instance, then immediately starts it. By default, it creates a container instead of a virtual machine. Use this command to launch a container named <code class="docutils literal notranslate"><span class="pre">first</span></code>, based on the Ubuntu 24.04 LTS image:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>launch<span class="w"> </span>ubuntu:24.04<span class="w"> </span>first
</pre></div>
</div>
<p>This downloads and unpacks the image, then uses it to create and start a container. Since this command does not specify a remote server, the default <a class="reference external" href="https://cloud-images.ubuntu.com/releases/"><code class="docutils literal notranslate"><span class="pre">ubuntu:</span></code></a> server is used. Once downloaded, this image is cached temporarily in the local image server.</p>
<p>We can also create an instance without starting it, using the <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">init</span></code> command. Note that this differs from the <code class="docutils literal notranslate"><span class="pre">lxd</span> <span class="pre">init</span></code> command you used to initialize LXD.</p>
<p>Create a container called <code class="docutils literal notranslate"><span class="pre">second</span></code> but do not start it, using the same image as the first:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>init<span class="w"> </span>ubuntu:24.04<span class="w"> </span>second
</pre></div>
</div>
<p>Since the image is now cached locally, this container is created much more quickly than the first.</p>
<p>To confirm that the containers have been created, run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>list
</pre></div>
</div>
<p>You should see both containers you created in the output, with the <code class="docutils literal notranslate"><span class="pre">first</span></code> container in a <code class="docutils literal notranslate"><span class="pre">RUNNING</span></code> state and the <code class="docutils literal notranslate"><span class="pre">second</span></code> container in a <code class="docutils literal notranslate"><span class="pre">STOPPED</span></code> state.</p>
</div><div aria-labelledby="tab-0-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-0-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>To create a container, select <span class="guilabel">Instances</span> from the main navigation, then click <span class="guilabel">Create instance</span>.</p>
<p>In the form that opens, name this instance <code class="docutils literal notranslate"><span class="pre">first</span></code>. Click <span class="guilabel">Browse images</span> and select the <code class="docutils literal notranslate"><span class="pre">Ubuntu</span> <span class="pre">24.04</span> <span class="pre">LTS</span></code> image. Note that the <span class="guilabel">Source</span> for this image is <code class="docutils literal notranslate"><span class="pre">Ubuntu</span></code>, which is the remote <a class="reference external" href="https://cloud-images.ubuntu.com/releases/"><code class="docutils literal notranslate"><span class="pre">ubuntu:</span></code></a> server.</p>
<p>Launch the container by clicking the <span class="guilabel">Create and start</span> button.</p>
<p>This downloads and unpacks the image, then uses it to create and start a container. The image is cached temporarily in the local image server.</p>
<p>Create another container named <code class="docutils literal notranslate"><span class="pre">second</span></code>, using the same image. This time, click <span class="guilabel">Create</span> instead of <span class="guilabel">Create and start</span>. This container will be created but not started.</p>
<p>Since the image is now cached locally, this container is created much more quickly than the first.</p>
</div></div>
</section>
</section>
<section id="create-and-start-a-vm">
<span id="tutorial-create-vm"></span><h2>Create and start a VM<a class="headerlink" href="#create-and-start-a-vm" title="Link to this heading">¶</a></h2>
<p>Next, let’s launch a VM using the Ubuntu 24.04 LTS image.</p>
<p>Although we will use the same image name as we used when creating a container, LXD will download a variant of the image built specifically for VMs. This image is not yet cached, and it is larger than the container VM, so it will take longer to download.</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-1-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-1-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-1-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-1-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-1-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-1-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>We will use the same <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">launch</span></code> command, this time to create an instance named <code class="docutils literal notranslate"><span class="pre">ubuntu-vm</span></code>. To create it as a VM instead of a container, we must add the <code class="docutils literal notranslate"><span class="pre">--vm</span></code> flag. Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>launch<span class="w"> </span>ubuntu:24.04<span class="w"> </span>ubuntu-vm<span class="w"> </span>--vm
</pre></div>
</div>
</div><div aria-labelledby="tab-1-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-1-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>Open the form to create an instance, and set its name to <code class="docutils literal notranslate"><span class="pre">ubuntu-vm</span></code>. Browse for an image. Do not select the the cached Ubuntu 24.04 image at the top, which has a <span class="guilabel">Type</span> set to <code class="docutils literal notranslate"><span class="pre">container</span></code>. Instead, select the Ubuntu 24.04 LTS image with the <span class="guilabel">Type</span> of <code class="docutils literal notranslate"><span class="pre">all</span></code>, which can be used for VMs.</p>
<p>After you select this image and return to the main creation form, set the <span class="guilabel">Instance type</span> to <code class="docutils literal notranslate"><span class="pre">VM</span></code>. Create and start the VM.</p>
<figure class="align-default">
<a class="reference internal image-reference" href="../../_images/create_vm.png"><img alt="Create an Ubuntu 24.04 LTS VM" src="../../_images/create_vm.png" style="width: 100%;" />
</a>
</figure>
</div></div>
</section>
<section id="configure-create-and-start-a-desktop-vm">
<span id="tutorial-create-vm-desktop"></span><h2>Configure, create, and start a desktop VM<a class="headerlink" href="#configure-create-and-start-a-desktop-vm" title="Link to this heading">¶</a></h2>
<p>A desktop Ubuntu VM is available from the remote <a class="reference external" href="https://images.lxd.canonical.com/"><code class="docutils literal notranslate"><span class="pre">images:</span></code></a> server. This server is provided by Canonical for unofficial images of not only Ubuntu variants but other Linux distributions, for testing and development purposes.</p>
<p>The <a class="configref reference internal" href="../../reference/instance_options/#instance-resource-limits:limits.memory"><code class="docutils literal notranslate"><span class="pre">limits.memory</span></code></a> option defaults to 1 GiB for VMs. For the desktop VM to run smoothly, we must allocate a higher memory limit.</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-2-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-2-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-2-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-2-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-2-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-2-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>You can configure instance options during <a class="reference internal" href="../../howto/instances_create/#instances-create"><span class="std std-ref">creation</span></a> or <a class="reference internal" href="../../howto/instances_configure/#instances-configure"><span class="std std-ref">afterward</span></a>. We will configure the desktop VM during creation, using the <code class="docutils literal notranslate"><span class="pre">--config</span></code> flag to set <a class="configref reference internal" href="../../reference/instance_options/#instance-resource-limits:limits.memory"><code class="docutils literal notranslate"><span class="pre">limits.memory</span></code></a> to <code class="docutils literal notranslate"><span class="pre">4GiB</span></code>.</p>
<p>Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>launch<span class="w"> </span>images:ubuntu/24.04/desktop<span class="w"> </span>ubuntu-desktop<span class="w"> </span>--vm<span class="w"> </span>--config<span class="w"> </span>limits.memory<span class="o">=</span>4GiB
</pre></div>
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>This is a large image and can take a while to download. If you like, you can open a separate terminal and continue with the next sections of the tutorial while you wait for the download to finish.</p>
</div>
<p>Once the VM has launched, confirm that its memory limit is set to <code class="docutils literal notranslate"><span class="pre">4</span> <span class="pre">GiB</span></code>:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>config<span class="w"> </span>get<span class="w"> </span>ubuntu-desktop<span class="w"> </span>limits.memory
</pre></div>
</div>
</div><div aria-labelledby="tab-2-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-2-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>Open the form to create a new instance. Name it <code class="docutils literal notranslate"><span class="pre">ubuntu-desktop</span></code>.</p>
<p>Browse for its image, and filter by variant <code class="docutils literal notranslate"><span class="pre">desktop</span></code> to find the Ubuntu 24.04 LTS desktop image. Note that its <span class="guilabel">Source</span> is <code class="docutils literal notranslate"><span class="pre">LXD</span> <span class="pre">Images</span></code>, meaning that it uses the remote <a class="reference external" href="https://images.lxd.canonical.com/"><code class="docutils literal notranslate"><span class="pre">images:</span></code></a> server. Select this image.</p>
<p>In the submenu, go to <span class="guilabel">Resource limits</span> and override the <span class="guilabel">Memory limit</span> to 4 GiB.</p>
<p>Finally, click <span class="guilabel">Create and start</span> to start the VM.</p>
</div></div>
</section>
<section id="inspect-instances">
<span id="tutorial-inspect"></span><h2>Inspect instances<a class="headerlink" href="#inspect-instances" title="Link to this heading">¶</a></h2>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-3-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-3-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-3-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-3-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-3-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-3-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>List all the instances that you created:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>list
</pre></div>
</div>
<p>The output tells you the name, state, IP addresses, instance type, and number of snapshots for each instance.</p>
<p>You can retrieve further information about each instance with <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">info</span></code>, including its architecture, process ID, usage data, and more. Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>info<span class="w"> </span>first
</pre></div>
</div>
</div><div aria-labelledby="tab-3-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-3-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>View the list of instances that you created:</p>
<figure class="align-default">
<a class="reference internal image-reference" href="../../_images/instances.png"><img alt="List of instances" src="../../_images/instances.png" style="width: 100%;" />
</a>
</figure>
<p>This list tells you the name, instance type, description, IPv4 address, and status for each instance. When you hover over an instance row, icons appear to start, restart, freeze (pause), or stop the instance.</p>
<p>Click one of the rows (but not on the instance name) to view the instance summary panel:</p>
<figure class="align-default">
<a class="reference internal image-reference" href="../../_images/instance_summary.png"><img alt="Information about an instance in the instance summary" src="../../_images/instance_summary.png" style="width: 100%;" />
</a>
</figure>
<p>This panel provides more information, including the instance’s architecture and process ID.</p>
<p>In either the list of instances or the instance summary panel, click the name of the instance to view its detail page. The <span class="guilabel">Overview</span> tab displays general information about the instance, including its architecture, process ID, creation date, and usage data. You can also view the instance’s network, devices, and profiles here.</p>
<p>Click the <span class="guilabel">Configuration</span> tab. From here, you can both view and edit the instance configuration details. You can also click the <span class="guilabel">YAML Configuration</span> toggle at the bottom of this tab to view and edit the full YAML representation of the instance configuration:</p>
<figure class="align-default">
<a class="reference internal image-reference" href="../../_images/yaml_configuration.png"><img alt="YAML configuration of an instance" src="../../_images/yaml_configuration.png" style="width: 100%;" />
</a>
</figure>
<p>The <span class="guilabel">Console</span> tab is mainly useful for viewing information from the startup process of an instance, and for viewing the graphic console of a desktop VM. Open this tab for the <code class="docutils literal notranslate"><span class="pre">ubuntu-desktop</span></code> VM to see that you can access the graphic console.</p>
<p>You can view and download log files from the <span class="guilabel">Logs</span> tab. Running instances log only limited information by default. More log files are added if an instance ends up in an error state.</p>
<p>We will explore the <span class="guilabel">Terminal</span> and <span class="guilabel">Snapshots</span> tabs later in this tutorial. For now, click the word <span class="guilabel">Instances</span> at the top of this page to return to the list of instances.</p>
</div></div>
<section id="start-a-stopped-instance">
<span id="tutorial-start"></span><h3>Start a stopped instance<a class="headerlink" href="#start-a-stopped-instance" title="Link to this heading">¶</a></h3>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-4-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-4-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-4-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-4-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-4-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-4-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>When you ran <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">list</span></code>, you saw that the <code class="docutils literal notranslate"><span class="pre">second</span></code> container’s state is <code class="docutils literal notranslate"><span class="pre">STOPPED</span></code>, because we used <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">init</span></code> to create the container instead of <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">launch</span></code>.</p>
<p>Start the <code class="docutils literal notranslate"><span class="pre">second</span></code> container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>start<span class="w"> </span>second
</pre></div>
</div>
<p>Run <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">list</span></code> again to confirm that it is now in a <code class="docutils literal notranslate"><span class="pre">RUNNING</span></code> state.</p>
</div><div aria-labelledby="tab-4-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-4-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>In the list of instances, you should see that the <code class="docutils literal notranslate"><span class="pre">second</span></code> container’s state is <code class="docutils literal notranslate"><span class="pre">Stopped</span></code>, because you created the container but did not start it.</p>
<p>Start the <code class="docutils literal notranslate"><span class="pre">second</span></code> container by clicking the <span class="guilabel">Start</span> button (▷) that appears when you hover over its row.</p>
</div></div>
<p>See <a class="reference internal" href="../../howto/instances_create/#instances-create"><span class="std std-ref">How to create instances</span></a> and <a class="reference internal" href="../../howto/instances_manage/#instances-manage"><span class="std std-ref">How to manage instances</span></a> for more information.</p>
</section>
</section>
<section id="configure-instances">
<span id="tutorial-configure"></span><h2>Configure instances<a class="headerlink" href="#configure-instances" title="Link to this heading">¶</a></h2>
<p>Each instance created inherits a default set of configuration options. You can customize these options for each instance. See <a class="reference internal" href="../../reference/instance_options/#instance-options"><span class="std std-ref">Instance options</span></a> for a list of available options.</p>
<p>Earlier, we set the <a class="configref reference internal" href="../../reference/instance_options/#instance-resource-limits:limits.memory"><code class="docutils literal notranslate"><span class="pre">limits.memory</span></code></a> option for the <code class="docutils literal notranslate"><span class="pre">ubuntu-desktop</span></code> VM during its creation. We can also update an instance’s configuration after creation.</p>
<p>As an example, let’s reduce the <code class="docutils literal notranslate"><span class="pre">second</span></code> container’s resource limits. Follow the instructions below to update its <a class="configref reference internal" href="../../reference/instance_options/#instance-resource-limits:limits.cpu"><code class="docutils literal notranslate"><span class="pre">limits.cpu</span></code></a> to <code class="docutils literal notranslate"><span class="pre">1</span></code>, and its <a class="configref reference internal" href="../../reference/instance_options/#instance-resource-limits:limits.memory"><code class="docutils literal notranslate"><span class="pre">limits.memory</span></code></a> to <code class="docutils literal notranslate"><span class="pre">192MiB</span></code>.</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-5-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-5-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-5-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-5-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-5-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-5-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>second<span class="w"> </span>limits.cpu<span class="o">=</span><span class="m">1</span><span class="w"> </span>limits.memory<span class="o">=</span>192MiB
</pre></div>
</div>
<p>To confirm that the options have been set, use the <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">config</span> <span class="pre">get</span></code> command for each option:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>config<span class="w"> </span>get<span class="w"> </span>second<span class="w"> </span>limits.cpu
lxc<span class="w"> </span>config<span class="w"> </span>get<span class="w"> </span>second<span class="w"> </span>limits.memory
</pre></div>
</div>
<p>You can also use the <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">config</span> <span class="pre">show</span></code> command to view values for all the options. Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>config<span class="w"> </span>show<span class="w"> </span>second
</pre></div>
</div>
</div><div aria-labelledby="tab-5-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-5-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>Go to the detail page for the <code class="docutils literal notranslate"><span class="pre">second</span></code> container, then its <span class="guilabel">Configuration</span> tab.</p>
<p>From the <span class="guilabel">Resource limits</span> section, override the <code class="docutils literal notranslate"><span class="pre">Exposed</span> <span class="pre">CPU</span> <span class="pre">limit</span></code> to a <code class="docutils literal notranslate"><span class="pre">number</span></code> of <code class="docutils literal notranslate"><span class="pre">1</span></code>.</p>
<p>Override the <code class="docutils literal notranslate"><span class="pre">Memory</span> <span class="pre">limit</span></code> to an <code class="docutils literal notranslate"><span class="pre">absolute</span></code> value of 192. Change the dropdown value from <code class="docutils literal notranslate"><span class="pre">GiB</span></code> to <code class="docutils literal notranslate"><span class="pre">MiB</span></code>.</p>
<p>Save the updated configuration, then confirm that you see the updated values reflected in the <span class="guilabel">Configuration</span> tab.</p>
</div></div>
</section>
<section id="open-an-interactive-shell-into-instances">
<span id="tutorial-shell"></span><h2>Open an interactive shell into instances<a class="headerlink" href="#open-an-interactive-shell-into-instances" title="Link to this heading">¶</a></h2>
<p>Thus far, we have only acted upon instances from outside of them, from the host system. It’s time to see what we can do inside an instance.</p>
<p>First, let’s run a couple of standard Linux commands on your host system. The first command below displays memory information in megabytes, and the second displays the number of available CPUs.</p>
<p>In a terminal, run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>free<span class="w"> </span>-m
nproc
</pre></div>
</div>
<p>Take note of the outputs. We will compare them to the outputs from the same commands run within your instances.</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-6-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-6-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-6-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-6-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-6-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-6-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>Use <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">shell</span></code> to open an interactive shell into the <code class="docutils literal notranslate"><span class="pre">first</span></code> container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>shell<span class="w"> </span>first
</pre></div>
</div>
<p>Notice that your command prompt has changed. You are now logged in as <code class="docutils literal notranslate"><span class="pre">root</span></code> inside the <code class="docutils literal notranslate"><span class="pre">first</span></code> instance.</p>
<p>In this shell session, run the same commands as you did on the host:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>free<span class="w"> </span>-m
nproc
</pre></div>
</div>
<p>Note that the total memory returned by <code class="docutils literal notranslate"><span class="pre">free</span> <span class="pre">-m</span></code> and the value returned by <code class="docutils literal notranslate"><span class="pre">nproc</span></code> are identical for the host system and the <code class="docutils literal notranslate"><span class="pre">first</span></code> container. This is because by default, containers inherit the resources from their host environment.</p>
<p>Next, exit the <code class="docutils literal notranslate"><span class="pre">first</span></code> container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">exit</span>
</pre></div>
</div>
<p>Enter an interactive shell into the <code class="docutils literal notranslate"><span class="pre">second</span></code> container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>shell<span class="w"> </span>second
</pre></div>
</div>
<p>Then in the <code class="docutils literal notranslate"><span class="pre">second</span></code> container, run the same commands:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>free<span class="w"> </span>-m
nproc
</pre></div>
</div>
<p>For the <code class="docutils literal notranslate"><span class="pre">second</span></code> container, notice that only <code class="docutils literal notranslate"><span class="pre">192</span> <span class="pre">MiB</span></code> total memory and <code class="docutils literal notranslate"><span class="pre">1</span></code> CPU is available. These are the options that we configured for this container earlier.</p>
<p>You can try other commands to interact with your instance. For example, enter the following command to display information about the operating system:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cat<span class="w"> </span>/etc/*release
</pre></div>
</div>
<p>Or have some fun:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>apt<span class="w"> </span>update
apt<span class="w"> </span>install<span class="w"> </span>fortune<span class="w"> </span>-y
/usr/games/fortune
</pre></div>
</div>
<p>When you’re done, exit the shell:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">exit</span>
</pre></div>
</div>
<p>Your command prompt should return to that of the host system. From here, try out one other way to run commands inside an instance: the <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">exec</span></code> command. This command is used to execute a single command inside an instance from the host system, without opening a shell. Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>second<span class="w"> </span>--<span class="w"> </span>free<span class="w"> </span>-m
</pre></div>
</div>
<p>Notice that the output is the same as if you had run <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">shell</span> <span class="pre">second</span></code> then the <code class="docutils literal notranslate"><span class="pre">free</span> <span class="pre">-m</span></code> command from inside the <code class="docutils literal notranslate"><span class="pre">second</span></code> container.</p>
<p>See <a class="reference internal" href="../../instance-exec/#run-commands"><span class="std std-ref">How to run commands in an instance</span></a> for more information.</p>
</div><div aria-labelledby="tab-6-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-6-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>Go to the <span class="guilabel">Terminal</span> tab for the <code class="docutils literal notranslate"><span class="pre">first</span></code> container. This tab provides an interactive shell into an instance.</p>
<p>From there, run the same commands as you did on the host:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>free<span class="w"> </span>-m
nproc
</pre></div>
</div>
<p>Note that the total memory returned by <code class="docutils literal notranslate"><span class="pre">free</span> <span class="pre">-m</span></code> and the value returned by <code class="docutils literal notranslate"><span class="pre">nproc</span></code> are identical for the host system and the <code class="docutils literal notranslate"><span class="pre">first</span></code> container. This is because by default, containers inherit the resources from their host environment.</p>
<p>Go to the <span class="guilabel">Terminal</span> tab for the <code class="docutils literal notranslate"><span class="pre">second</span></code> container and enter the same commands. Notice that only <code class="docutils literal notranslate"><span class="pre">192</span> <span class="pre">MiB</span></code> total memory and <code class="docutils literal notranslate"><span class="pre">1</span></code> CPU is available. These are the options that we configured for this container earlier.</p>
<p>You can try other commands to interact with your instance. For example, enter the following command to display information about the operating system:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cat<span class="w"> </span>/etc/*release
</pre></div>
</div>
<p>Or have some fun:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>apt<span class="w"> </span>update
apt<span class="w"> </span>install<span class="w"> </span>fortune
/usr/games/fortune
</pre></div>
</div>
</div></div>
</section>
<section id="access-files">
<span id="tutorial-files"></span><h2>Access files<a class="headerlink" href="#access-files" title="Link to this heading">¶</a></h2>
<p>To access files inside an instance from your host system, use the CLI.</p>
<p>As an example, let’s create a file in the <code class="docutils literal notranslate"><span class="pre">first</span></code> container, pull it out to the host system, modify it, then push it back to the container.</p>
<p>From the host system, use <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">exec</span></code> to create an empty <code class="docutils literal notranslate"><span class="pre">helloworld</span></code> file in the <code class="docutils literal notranslate"><span class="pre">first</span></code> container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>first<span class="w"> </span>--<span class="w"> </span>touch<span class="w"> </span>helloworld.txt
</pre></div>
</div>
<p>Confirm that the file is empty:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>first<span class="w"> </span>--<span class="w"> </span>cat<span class="w"> </span>helloworld.txt
</pre></div>
</div>
<p>Since the <code class="docutils literal notranslate"><span class="pre">touch</span></code> command creates an empty file, the <code class="docutils literal notranslate"><span class="pre">cat</span></code> command should display no output.</p>
<p>Pull this file from the <code class="docutils literal notranslate"><span class="pre">first</span></code> container to the current directory of your host system:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>file<span class="w"> </span>pull<span class="w"> </span>first/root/helloworld.txt<span class="w"> </span>.
</pre></div>
</div>
<p>Add content to the file:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;Hello world&quot;</span><span class="w"> </span>&gt;<span class="w"> </span>helloworld.txt
</pre></div>
</div>
<p>Push the file back to the container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>file<span class="w"> </span>push<span class="w"> </span>helloworld.txt<span class="w"> </span>first/root/helloworld.txt
</pre></div>
</div>
<p>Now again view the content of the file on the container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>first<span class="w"> </span>--<span class="w"> </span>cat<span class="w"> </span>helloworld.txt
</pre></div>
</div>
<p>You should see the line that you added:</p>
<div class="terminal docutils container">
<div class="input docutils container">
<div class="prompt docutils container">
<code class="docutils literal notranslate"><span class="pre">your-user&#64;host-system:~$</span> </code></div>
<span class="command"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">exec</span> <span class="pre">first</span> <span class="pre">--</span> <span class="pre">cat</span> <span class="pre">helloworld.txt</span>
</code></span></div>
<div class="terminal-code highlight-text notranslate"><div class="highlight"><pre><span></span>Hello world!
</pre></div>
</div>
</div>
<p>See <a class="reference internal" href="../../howto/instances_access_files/#instances-access-files"><span class="std std-ref">How to access files in an instance</span></a> for more information.</p>
</section>
<section id="back-up-and-restore-instances-by-creating-snapshots">
<span id="tutorial-snapshots"></span><h2>Back up and restore instances by creating snapshots<a class="headerlink" href="#back-up-and-restore-instances-by-creating-snapshots" title="Link to this heading">¶</a></h2>
<p>You can back up your instance by creating a snapshot, then use it later to restore the instance to a saved state.</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-7-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-7-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-7-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-7-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-7-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-7-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>The following command creates a snapshot called “clean” that saves the current state of your instance. Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>snapshot<span class="w"> </span>first<span class="w"> </span>clean
</pre></div>
</div>
<p>Let’s see how many snapshots are available for the <code class="docutils literal notranslate"><span class="pre">first</span></code> container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>list<span class="w"> </span>first
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">SNAPSHOTS</span></code> column shows the number of available snapshots.</p>
<p>Let’s find out more information about the available snapshots for the <code class="docutils literal notranslate"><span class="pre">first</span></code> container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>info<span class="w"> </span>first
</pre></div>
</div>
<p>At the bottom of the output, a <code class="docutils literal notranslate"><span class="pre">Snapshots</span></code> table displays details about available snapshots.</p>
<p>If you accidentally do something to break an instance, or wish to revert recent changes to it, you can restore a previous state through a snapshot. To see how this works, let’s deliberately break the <code class="docutils literal notranslate"><span class="pre">first</span></code> container by deleting the <code class="docutils literal notranslate"><span class="pre">bash</span></code> command from it:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>first<span class="w"> </span>--<span class="w"> </span>rm<span class="w"> </span>/usr/bin/bash
</pre></div>
</div>
<p>Confirm that you can no longer use the bash command on <code class="docutils literal notranslate"><span class="pre">first</span></code>:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>first<span class="w"> </span>--<span class="w"> </span>bash
</pre></div>
</div>
<p>This results in an error because the <code class="docutils literal notranslate"><span class="pre">bash</span></code> command no longer exists. Luckily, we have a snapshot we can use to restore the container to a previous state. Run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>restore<span class="w"> </span>first<span class="w"> </span>clean
</pre></div>
</div>
<p>Confirm that you can now enter the <code class="docutils literal notranslate"><span class="pre">bash</span></code> shell:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>first<span class="w"> </span>--<span class="w"> </span>bash
</pre></div>
</div>
<p>Then exit the shell:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">exit</span>
</pre></div>
</div>
<p>When you no longer need a snapshot, you can delete it. Go ahead and delete the <code class="docutils literal notranslate"><span class="pre">clean</span></code> snapshot:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>delete<span class="w"> </span>first/clean
</pre></div>
</div>
</div><div aria-labelledby="tab-7-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-7-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>Go to the instance detail page of the <code class="docutils literal notranslate"><span class="pre">first</span></code> container and select the <span class="guilabel">Snapshots</span> tab.</p>
<p>Click <span class="guilabel">Create snapshot</span> and enter the snapshot name <code class="docutils literal notranslate"><span class="pre">clean</span></code>. Leave the other options unchanged and create the snapshot. Confirm that the snapshot is now available in the <span class="guilabel">Snapshots</span> tab.</p>
<p>If you accidentally do something to break an instance, or wish to revert recent changes to it, you can restore a previous state through a snapshot. To see how this works, let’s deliberately break the <code class="docutils literal notranslate"><span class="pre">first</span></code> container by deleting the <code class="docutils literal notranslate"><span class="pre">bash</span></code> command from it.</p>
<p>Go to the <span class="guilabel">Terminal</span> tab and break the container:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>rm<span class="w"> </span>/usr/bin/bash
</pre></div>
</div>
<p>Refresh the page, and you’ll see the following error:</p>
<figure class="align-default">
<a class="reference internal image-reference" href="../../_images/broken_terminal.png"><img alt="Error when trying to load the terminal" src="../../_images/broken_terminal.png" style="width: 100%;" />
</a>
</figure>
<p>The UI cannot open a terminal for your container anymore, because you deleted the <code class="docutils literal notranslate"><span class="pre">bash</span></code> command. Luckily, we have a snapshot we can use to restore the container to a previous state.</p>
<p>Return to the <span class="guilabel">Snapshots</span> tab. From there, restore the container to the state of the <code class="docutils literal notranslate"><span class="pre">clean</span></code> snapshot by clicking the <span class="guilabel">Restore snapshot</span> button (<svg width='16' height='16' xmlns='http://www.w3.org/2000/svg'><path d='M5.948 9.012v1.5l-2.458.001A5.163 5.163 0 0012.76 10h1.596a6.665 6.665 0 01-11.839 1.785v2.158h-1.5v-4.93h4.93zM8 1.338a6.655 6.655 0 015.516 2.925V2.11h1.5v4.93h-4.93v-1.5h2.453A5.163 5.163 0 003.24 6H1.643A6.665 6.665 0 018 1.338z' fill='%23000'  fill-rule='evenodd'/></svg>) next to it.</p>
<p>Confirm that the container was reverted to its previous unbroken state by returning to the <span class="guilabel">Terminal</span> tab. The terminal should now load.</p>
<p>When you no longer need a snapshot, you can delete it. In the <span class="guilabel">Snapshots</span> tab, delete the snapshot by clicking the <span class="guilabel">Delete snapshot</span> button (<svg width='16' height='16' xmlns='http://www.w3.org/2000/svg'><path d='M4.5 6v6a1.5 1.5 0 001.356 1.493L6 13.5h4a1.5 1.5 0 001.493-1.356L11.5 12V6H13v6a3 3 0 01-3 3H6a3 3 0 01-3-3V6h1.5zm3 0v5.994H6V6h1.5zm2.498 0v5.994h-1.5V6h1.5zM8.5 0A2.5 2.5 0 0111 2.5V3h3v1.5H2V3h3v-.5A2.5 2.5 0 017.5 0h1zm0 1.5h-1a1 1 0 00-.993.883L6.5 2.5V3h3v-.5a1 1 0 00-.883-.993L8.5 1.5z' fill='%23000' fill-rule='evenodd'/></svg>) next to it.</p>
<p>To learn more about instance snapshots, see: <a class="reference internal" href="../../howto/instances_backup/#instances-snapshots"><span class="std std-ref">Use snapshots for instance backup</span></a>.</p>
</div></div>
</section>
<section id="optional-stop-and-delete-all-instances">
<span id="tutorial-delete"></span><h2>Optional: Stop and delete all instances<a class="headerlink" href="#optional-stop-and-delete-all-instances" title="Link to this heading">¶</a></h2>
<p>Congratulations! You have reached the end of this tutorial and acquired a greater understanding of LXD’s usage and capabilities along the way.</p>
<p>If you wish, you can clean up the instances you created.</p>
<div class="warning admonition">
<p class="admonition-title">Take caution when deleting instances</p>
<p>Deleting an instance is irreversible. All snapshots and other information associated with the instance will be lost.</p>
</div>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-8-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-8-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-8-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-8-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-8-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-8-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>You must first stop an instance before you can delete it:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>stop<span class="w"> </span>ubuntu-vm
lxc<span class="w"> </span>delete<span class="w"> </span>ubuntu-vm
</pre></div>
</div>
<p>You can also use the <code class="docutils literal notranslate"><span class="pre">--force</span></code> flag to delete an instance without stopping it:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>lxc<span class="w"> </span>delete<span class="w"> </span>ubuntu-desktop<span class="w"> </span>--force
</pre></div>
</div>
<p>In the same way, you can delete the other instances that you created in this tutorial (<code class="docutils literal notranslate"><span class="pre">first</span></code> and <code class="docutils literal notranslate"><span class="pre">second</span></code>).</p>
</div><div aria-labelledby="tab-8-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-8-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>Click the checkbox to the left of each instance you want to delete. Use the buttons that appear at the top of the page to first stop then delete all checked instances.</p>
</div></div>
</section>
<section id="optional-hold-snap-updates">
<span id="tutorial-snap-updates"></span><h2>Optional: Hold snap updates<a class="headerlink" href="#optional-hold-snap-updates" title="Link to this heading">¶</a></h2>
<p>By default, snaps update automatically when a new release is published to their channel. In production environments, we strongly recommend that you disable automatic updates for the LXD snap and apply them manually. This approach allows you to schedule maintenance windows and avoid unplanned downtime.</p>
<p>To hold updates for the LXD snap indefinitely, run on your host machine:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>snap<span class="w"> </span>refresh<span class="w"> </span>--hold<span class="w"> </span>lxd
</pre></div>
</div>
<p>Once updates are on hold, manually update LXD regularly to benefit from security and bug fixes.</p>
<p>If you do not intend to run a production deployment of LXD, you might not need this. To remove the hold and restore automatic updates, run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>snap<span class="w"> </span>refresh<span class="w"> </span>--unhold<span class="w"> </span>lxd
</pre></div>
</div>
<p>For more information on managing the LXD snap and its updates, see: <a class="reference internal" href="../../howto/snap/#howto-snap"><span class="std std-ref">How to manage the LXD snap</span></a>.</p>
</section>
<section id="next-steps">
<span id="tutorial-next"></span><h2>Next steps<a class="headerlink" href="#next-steps" title="Link to this heading">¶</a></h2>
<p>Now that you’ve completed your first steps with LXD, you have a general idea of how LXD works. Next, read up on important concepts in the <a class="reference internal" href="../../explanation/#explanation"><span class="std std-ref">Explanation</span></a> section and check out more advanced use cases in our <a class="reference internal" href="../../howto/#howtos"><span class="std std-ref">How-to guides</span></a>. You can also find a wealth of information in the <a class="reference internal" href="../../reference/#reference"><span class="std std-ref">Reference</span></a> section, including the <a class="reference internal" href="../../api/"><span class="doc">Main API specification</span></a>.</p>
</section>
</section>

        </article>
      </div>
      <footer>
        
   

<div class="related-pages">
  
  
      
  
  
  <a class="next-page" href="../../howto/">
        <div class="page-info">
          <div class="context">
            <span>Next</span>
          </div>
          <div class="title">How-to guides</div>
        </div>
        <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
      </a>
    <a class="prev-page" href="../../">
        <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
        <div class="page-info">
          <div class="context">
            <span>Previous</span>
          </div>
          
            <div class="title">Home</div>
          
        </div>
      </a>
</div>
<div class="bottom-of-page">
  <div class="left-details">
    <div class="copyright">
        &copy; 2014-2026 AGPL-3.0, LXD contributors 
    </div><div class="last-updated">
      Last updated on Feb 26, 2026</div>
  </div>
  <div class="right-details">
    
      <a href="" class="js-revoke-cookie-manager muted-link">Manage your tracker settings</a>
</div>

      </footer>
    </div>
    <aside class="toc-drawer">
      
<div class="toc-sticky toc-scroll">
   
    <div class="toc-title-container">
      <span class="toc-title">
       Contents
      </span>
    </div>
    <div class="toc-tree-container">
      <div class="toc-tree">
        <ul>
<li><a class="reference internal" href="#">First steps with LXD</a><ul>
<li><a class="reference internal" href="#requirements">Requirements</a></li>
<li><a class="reference internal" href="#install-lxd-using-snap">Install LXD using snap</a><ul>
<li><a class="reference internal" href="#if-the-lxd-snap-is-already-installed">If the LXD snap is already installed</a></li>
</ul>
</li>
<li><a class="reference internal" href="#add-the-current-user-to-the-lxd-group">Add the current user to the <code class="docutils literal notranslate"><span class="pre">lxd</span></code> group</a></li>
<li><a class="reference internal" href="#initialize-lxd">Initialize LXD</a></li>
<li><a class="reference internal" href="#enable-the-lxd-ui">Enable the LXD UI</a></li>
<li><a class="reference internal" href="#create-instances">Create instances</a><ul>
<li><a class="reference internal" href="#create-and-start-containers">Create and start containers</a></li>
</ul>
</li>
<li><a class="reference internal" href="#create-and-start-a-vm">Create and start a VM</a></li>
<li><a class="reference internal" href="#configure-create-and-start-a-desktop-vm">Configure, create, and start a desktop VM</a></li>
<li><a class="reference internal" href="#inspect-instances">Inspect instances</a><ul>
<li><a class="reference internal" href="#start-a-stopped-instance">Start a stopped instance</a></li>
</ul>
</li>
<li><a class="reference internal" href="#configure-instances">Configure instances</a></li>
<li><a class="reference internal" href="#open-an-interactive-shell-into-instances">Open an interactive shell into instances</a></li>
<li><a class="reference internal" href="#access-files">Access files</a></li>
<li><a class="reference internal" href="#back-up-and-restore-instances-by-creating-snapshots">Back up and restore instances by creating snapshots</a></li>
<li><a class="reference internal" href="#optional-stop-and-delete-all-instances">Optional: Stop and delete all instances</a></li>
<li><a class="reference internal" href="#optional-hold-snap-updates">Optional: Hold snap updates</a></li>
<li><a class="reference internal" href="#next-steps">Next steps</a></li>
</ul>
</li>
</ul>

      </div>
    </div>
   
    
  </div>

    </aside>
  </div>
</div><script src="../../_static/jquery.js?v=5d32c60e"></script>
    <script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
    <script src="../../_static/documentation_options.js?v=a5603611"></script>
    <script src="../../_static/doctools.js?v=9a2dae69"></script>
    <script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../../_static/scripts/furo.js?v=46bd48cc"></script>
    <script src="../../_static/clipboard.min.js?v=a7894cd8"></script>
    <script src="../../_static/copybutton.js?v=b01cb6f2"></script>
    <script src="../../_static/config-options.js"></script>
    <script src="../../_static/design-tabs.js?v=f930bc37"></script>
    <script src="../../_static/tabs.js?v=3030b3cb"></script>
    <script src="../../_static/js/bundle.js?v=a4d88309"></script>
    <script src="../../_static/header-nav.js?v=e117ad08"></script>
    <script src="../../_static/github_issue_links.js?v=32bb732f"></script>
    
<script>
  const github_url = "https://github.com/canonical/lxd";
</script>
</body>
</html>