Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark, in light modeAuto light/dark, in dark modeSkip to content
Snapcraft 8.14.1 documentation
Snapcraft 8.14.1 documentation
Back to top

Set up Snapcraft

Snapcraft can be installed on all popular Linux distributions compatible with systemd,as well as macOS and Windows.

Before you begin installation and setup, make sure your system meets thesystem requirements.

Install the main components

A working Snapcraft setup has two components – Snapcraft itself, and a buildprovider.

Install Snapcraft

If your Linux distribution has snapd installed, the easiest way to installSnapcraft is from the Snap Store:

snapinstallsnapcraft--classic

Install a build provider

Snapcraft relies on abuild provider to create an isolated build environment, like asandbox. Inside this environment, software can be built and packaged as snaps withoutmaking potentially destructive changes to the host system.

Build provider

Description

Default on

LXD

Creates and manages Linux container images. It can operate inside VMs.

Snapcraft 7 and higher on Linux

Multipass

Creates and manages virtual machine (VM) build instances. It automates setup andteardown of cloud-style Ubuntu VMs. It can’t be used reliably on platforms thatdon’t support nested virtualization. In other words, it most likely won’t runinside another VM.

  • Snapcraft 6 on Linux

  • All versions on macOS and Windows

When you first run Snapcraft, it installs the default build provider for your hostplatform. If the default build provider isn’t suitable, you can install the alternativeand thenswitch to it.

Install LXD

Install the LXD snap:

snapinstalllxd

LXD has special requirements from your local user account that Snapcraft can’t managefor you during its automatic setup. Add your user account to thelxd group so youcan access the LXD daemon:

sudousermod-a-Glxd$USER

Log out and back in to your local user account for the new group to take effect. Then,check that you’re a member of the group by running:

groups$USER

The list should containlxd.

Finnally, initialize LXD with a lightweight configuration:

sudolxdinit--auto

If you need help troubleshooting your LXD installation, seeHow to install LXD in the LXDdocumentation.

Install Multipass

Install the Multipass snap:

snapinstallmultipass

Tip

With core20 snaps and Multipass, the default virtual machine is assigned 2CPUs and 2GB of RAM. To extend the hardware capacity, you can set thefollowing environment variables to modify CPU and memory allocation, andimprove performance:

exportSNAPCRAFT_BUILD_ENVIRONMENT_CPU=8exportSNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=16G

Install multiple instances of Snapcraft

If you’re installing Snapcraft as a snap, you can install multiple concurrentversions at the same time. Doing so could come in handy if you want to test newfeatures in your snaps, before they arrive in a mainstream release.

First, enable parallel installs in snapd:

snapsetsystemexperimental.parallel-instances=true

List all the available versions of Snapcraft. For the version you’re interested in, takenote of the value in the channel column.

snapinfosnapcraft

Install a new instance of Snapcraft with theinstance key naming syntax, replacing<instance> with whichever name is appropriate for the instance, and<channel>with the target channel and track:

snapinstallsnapcraft_<instance><channel>--classic

For example, you could install the very latest official releases with:

snapinstallsnapcraft_edgelatest/edge--classic

Whenever you want to run this parallel version of Snapcraft, invoke the instance name ofthe command – in this example,snapcraft_edge.

Contents

[8]ページ先頭

©2009-2026 Movatter.jp