How to install snap ubuntu
How to install snap ubuntu
Установка Snap в Linux
Что такое Snap пакеты?
Здесь в игру вступают пакеты. После завершения разработки программы её разработчики создают пакеты, например, deb или rpm и размещают их в репозиториях программного обеспечения, откуда пользователи могут их очень легко установить. Установить программу из любого deb пакета можно буквально в пару кликов. Но такие пакеты содержат только саму программу, все зависимости и необходимые ей библиотеки пакетный менеджер ищет и устанавливает автоматически.
В свою очередь Snap пакеты содержат саму программу, а также все её зависимости. Это имеет несколько преимуществ перед обычными deb или rpm пакетами, поскольку теперь программу можно запустить в любом дистрибутиве, а также разработчик может быть уверен, что его программа получает именно необходимые ей версии библиотек.
Установка snap
В дистрибутивах, основанных на Debian и в самом Debian для использования snap пакетов сначала надо установить менеджер пакетов snap. Для этого выполните:
sudo apt install snapd
Установка snap в Fedora или CentOS отличается не сильно:
sudo dnf install snapd
После установки для включения возможности установки классических приложений через snap надо создать символическую ссылку на /var/lib/snapd/snap в корне:
После этого можно установить магазин приложений snap-store:
sudo snap install snap-store
Или устанавливать пакеты snap через терминал.
Как пользоваться snap
Основы рассмотрели, теперь перейдем к управлению пакетами. Процесс взаимодействия со snap очень похож на apt или dnf, только не надо обновлять репозитории. Все действия выполняются в терминале.
1. Поиск пакетов
Чтобы найти нужный пакет или посмотреть есть ли он в магазине приложений snap используйте команду find. Например:
snap find chromium
Будут выведены все пакеты соответствующие данному критерию, доступные для установки в вашей системе. Если выполнить команду find без параметров, то система выведет несколько рекомендуемых пакетов.
2. Информация о пакете
Чтобы посмотреть информацию о пакете используйте команду info:
snap info chromium
3. Установка пакетов
Вы можете установить snap пакет в Ubuntu или любом другом дистрибутиве командой install:
sudo snap install chromium
Когда установка snap пакетов завершится, программа выдаст соответствующее сообщение. Для установки пакета из определенного канала используйте соответствующую опцию, например —stable, —candidate, —beta или —edge. По умолчанию используется канал stable. Например:
По умолчанию приложение может получить доступ только к тем частям системы, к которым у него подключены интерфейсы. Эти подключения устанавливаются автоматически во время установки пакета. Посмотреть их можно командой connections:
snap connections chromium
Иногда для приложений недостаточно такого уровня доступа. Тогда для них используется уровень безопасности classic. В этом режиме приложение получает доступ к системным ресурсам как любые другие системные программы. Для установки таких программ надо использовать опцию —classic, иначе установить их не получится:
Есть ещё один режим безопасности, при котором приложение получает полный доступ к системе: devmode. Для установки таких программ надо использовать опцию —devmode.
4. Удаление пакета
Удалить snap пакет из системы очень просто. Для этого достаточно использовать команду remove:
sudo snap remove chromium
5. Установленные программы
Для того чтобы посмотреть все пакеты, установленные в системе используйте команду list:
6. История изменений
Также вы можете посмотреть историю изменений, внесенных, в систему с помощью этого пакетного менеджера:
7. Обновление пакетов
Если вы хотите обновить пакет snap, до более новой версии, выполните команду refresh:
sudo snap refresh opera
Если установлена самая свежая версия вы получите сообщение об ошибке.
Для обновления всех пакетов, установленных в системе просто выполните команду refresh:
sudo snap refresh
Если обновление вам не понравилось, вы можете откатить версию всех пакетов или одного из них до предыдущей. Для этого выполните команду revert:
sudo snap revert opera
Выводы
С момента создания этой технологии прошло много времени и сейчас доступно уже много snap пакетов. Они даже вытеснили многие PPA репозитории, что теперь заброшены и не поддерживаются. Поскольку существует инструмент snapcraft, который делает создание snap пакетов намного проще, все разработчики могут подготовить эти пакеты для своих программ.
А что вы думаете о системе управления пакетами и о самих пакетах snap? Будете использовать систему установки snap чаще чем apt? Напишите в комментариях!
Установка и использование Snap-пакетов в Ubuntu 18.04
Введение
Snap (или Snappy) — это система развертывания программ и управления пакетами, созданная Canonical. Эти пакеты чаще называют «снепами». Для работы с ними используется утилита «snapd», встроенная в ряд дистрибутивов Linux и позволяющая дистрибутивно-независимо развертывать программы на более высоком уровне.
Snapd — это REST API демон, служащий для управления snap-пакетами. Пользователи взаимодействуют с ним с помощью клиента snap, который входит в тот же пакет. Вы можете установить любое приложение на Linux-десктоп, сервер, облако или устройство.
Вам понадобится
GNU/Linux дистрибутив u и некоторые базовые знания о работе в командной строке. В данном руководстве вы узнаете, как настроить и использовать snap-команды.
Установка системы Snap
Если у вас установлена Ubuntu 16.04 LTS (Xenial Xerus) или более поздние версии, включая Ubuntu 18.04 LTS (Bionic Beaver), то вам ничего не надо делать. Snap установлен по умолчанию и готов к работе. Соответственно, если у вас установлена более ранняя версия или системы Snap нет по каким-то другим причинам, то сначала установите ее, а затем приступайте к работе.
Установку можно осуществить с помощью следующих команд:
Работа с системой Snap
snapd настроен и готов к использованию!
Поиск snap-приложений/пакетов
Чтобы найти доступные snap-приложения или пакеты выполните следующую команду:
Установка snap-приложений
Вы можете установить любые приложения/пакеты, доступные в формате snap, выполнив следующую команду:
Также можно указать конкретный канал, из которого вы хотите установить приложение. Канал — это snap-концепция, которая позволяет переключаться между разными каналами snap-приложений.
Запуск установленных snap-пакетов
Также его можно запустить через команду:
Просмотр списка установленных приложений
Чтобы увидеть все установленные snap-пакеты, выполните следующую команду:
Обновление установленных snap-приложений/пакетов
Снепы обновляются автоматически, но вы можете также обновить их вручную с помощью следующей команды:
Чтобы посмотреть, какие обновления snap-пакетов готовы к установке, выполните следующую команду:
Возврат к более ранней версии snap-приложений/пакетов
Если по какой-то причине вам не понравилось последнее обновление snap-пакета, вы можете вернуться к предыдущей версии с помощью следующей команды:
Такая команда вернет необходимую версию snap-пакета и данные, соответствующие ПО. Если предыдущая версия snap-пакета получена из другого канала, она все равно установится, и канал останется прежним.
Удаление snap-приложений/пакетов
Если вы хотите избавиться от снепов, удалите snap-пакет с помощью следующей команды:
Эта команда удалит приложение, все ее зависимости во время выполнения и связанные пользовательские данные. Если снеп запущен, команда сначала закроет его и затем удалит.
Включение и выключение snap-приложений/пакетов
Если вы хотите временно остановить работу снепа, просто отключите его и снова включите тогда, когда потребуется.
Список запущенных служб
Перезапуск, запуск и приостановление snap-служб
Все службы, необходимые для работы снепов, будут перезагружены по умолчанию:
Чтобы запустить ранее остановленную службу, используйте следующую команду:
Чтобы остановить запущенную службу, используйте следующую команду:
Конфигурации snap set и get
Некоторые снепы, например, работающие в фоновом режиме, выставляют параметры конфигурации, которые можно изменить.
Выставленные параметры конфигурации можно посмотреть с помощью установленного снепа. Введите команду snap get
Чтобы изменить параметры конфигурации, задайте команду «snap set»:
Скачивание и установка snap-приложений offline
Установить snap-приложения можно и без подключения к интернету. Для этого необходимо скачать файлы snap-приложений/пакетов, задав следующую команду:
Заключение
Хотя данная система все еще разрабатывается, и доступно не так много snap-приложений/пакетов, тем не менее, она является одной из лучших систем управления ПО. Snap становится все популярнее, особенно благодаря таким настойчивым методам Canonical.
Getting started
A snap is a bundle of an app and its dependencies that works without modification across many different Linux distributions. Snaps are discoverable and installable from the Snap Store, an app store with an audience of millions.
The following sections provide a basic overview of using snaps, from installation to management and manipulation.
Install snapd
The snapd daemon manages the snap environment on the local system. Its installation will include the snap tool for interacting with snaps. You can check both are installed by attempting to run snap version on the command line:
If all is well, version numbers for the main system components will be output, as shown above, albeit with potentially different versions and Linux distribution identifier.
If the snap command is not found, or if the command takes a while to respond before reporting that snapd is unavailable, make sure snapd is properly installed before continuing.
The «$» above represents the command line prompt. Sample commands come after this prompt with any relevant output shown below.
Find a snap
With snapd installed, snaps can be discovered, searched for, and installed from the Snap Store, from the Snap Store desktop app, and directly from the command line. For example, the following command returns a list of media players:
The ✓ alongside videolan in the above output indicates that the snap publisher has been verified.
Learn about a snap
The snap info command makes it easy to find more details about a specific snap. These details include what a snap does, who publishes it, the command(s) it provides and which channel versions are available for installation:
Install a snap
Installing a snap is straightforward:
Channels are an important snap concept. They define which release of a snap is installed and tracked for updates. The stable channel is used by default, but opting to install from a different channel is easily accomplished:
After installation, the channel being tracked can be changed with:
Run apps and commands from snaps
For example, the command installed via the VLC snap is simply vlc:
If executing a command directly doesn’t work, try prefixing it with the /snap/bin path:
Where snaps store data
Most snaps use strict confinement to isolate both their execution environments and their data from your system (see Snap Confinement for further details). A confined snap that needs user-access to files will most likely use the home interface to bridge this confinement gap, allowing you to save and load files from your home directory automatically.
You can see whether the home interface is being used in the output to snap connections :
Regardless of whether the home interface is used or not, a snap can also store user data, such as a database or configuration files, within its own directory under $HOME/snap. Data within this snap-specific directory is stored in one of two further directories, depending on whether the data needs to be tied to a specific release, or whether it can be used across multiple releases.
For more details on where snaps store their data, see Data locations.
List installed snaps
Use snap list to show a list of snaps installed on your system:
Some snaps, such as core listed above, are installed by automatically by snapd to satisfy the requirements of other snaps.
Update an installed snap
Snaps are updated automatically. However, to manually check for updates, use the following command:
The above will check the channel being tracked by the snap. If a newer version of the snap is available, it will be downloaded and installed.
Changing the channel being tracked and refreshing the snap can be accomplished with a single command:
Updates are automatically installed within 6 hours of a revision being made to a tracked channel, keeping most systems up-to-date. This schedule can be tuned via configuration options.
Versions and revisions
Versions and revisions convey different details about one specific release of a snap:
The version is a string that was assigned to a project by its developers, according to their development practices. It tells the user what content to expect from a snap. The revision is an automatic number assigned by the Snap store, giving the snap a unique identity within the channel.
Neither the version nor the revision enforce an order of release. The local system will simply attempt to install whatever snap is recommended by the publisher in the channel being tracked.
Revert to a previously used snap
A snap may be reverted to a previously used revision with the snap revert command:
This operation will revert both the snap revision and the configuration data associated with the software. If the previously used revision of the snap is from a different channel, that snap will be installed but the channel being tracked won’t change.
User data, such as data generated by the snap and stored in a database, is often stored in a common directory and will not be reverted. See Data locations for more details on what information is stored and where.
A snap won’t automatically update to a version previously reverted from, and the output from snap refresh will continue to state All snaps up to date. A reverted snap will be automatically updated when a new and different revision is made available by the publisher.
However, explicitly adding the snap name to snap refresh will update the snap, regardless of whether the latest revision was previously reverted from or not:
On an Ubuntu Core system, such as Ubuntu Core 18 and Ubuntu Core 16, reverting twice will work too. This is because snapd attempts to keep three revisions of a snap: the most recently installed plus the two previous installations. On classic systems like Ubuntu 18.04 LTS or Ubuntu 16.04 LTS, two revisions are retained by default. This behaviour can be modified with the refresh.retain system option.
List all available revisions
The following command lists all revisions available for all installed snaps, and also highlights which particular revisions are disabled at the moment:
A previously used snap that was reverted from will display disabled in the Notes column of the output.
Manually keeping track of which snap revisions available is generally unnecessary. A single revision will only ever be in use at a time, and snapd will remove old revisions automatically.
Create and restore a snapshot
Snapshots are generated manually with the snap save command and automatically when a snap is removed. A snapshot can be used to backup the state of your snaps, revert snaps to a previous state and to restore a fresh snapd installation to a previously saved state.
The snap save command creates a snapshot for all installed snaps, or if declared individually, specific snaps:
The restore command replaces the current user, system and configuration data with the corresponding data from the specified snapshot:
Excluding a snap’s system and configuration data from snap restore is not currently possible.
See Snapshots for further details on creating, exporting, importing and validating snapshots.
Disable and enable snaps
If a snaps is temporarily undesired, it can be disabled and later enabled again. This avoids having to remove and reinstall them in the system:
Remove a snap
To remove a snap from your system, along with its internal user, system and configuration data, use the remove command:
Prior to removal (except on Ubuntu Core systems), a snap’s internal user, system, and configuration data is saved as a snapshot (snapd 2.39+), and retained for 31 days.
However, a snapshot can be used to restore the state of your snap upon reinstallation. See Snapshots for further details.
How to Install Snap on Ubuntu
Home » SysAdmin » How to Install Snap on Ubuntu
Snap is a tool developed by Canonical for the purpose of package management and software deployment on Linux.
Snaps are packaged applications compiled with libraries and dependencies. Snaps work across a range of Linux distributions, which makes them a distro-agnostic upstream software deployment solution. The snapd daemon is a background service that allows you to manage the snaps on your system.
This tutorial explains how to install and use Snap on Ubuntu.
Note: Learn how the Snap packaging system compares to the APT package manager in Snap vs. APT.
How to Install Snap on Ubuntu
Snap is already installed and available for use on the majority of the latest Ubuntu distributions.
Enter snap version in the terminal to check if you have Snap installed on your system.
This lists the version of the Snap tool, the snapd daemon, the software series number, the name and release of your Linux distribution, as well as the kernel version.
If you do not have Snap preinstalled, install it via the terminal.
1. Start by updating packages:
2. Enter the following command:
How to Install Snap Store on Ubuntu
The Snap Store is a GUI application for finding, installing and managing snaps on Linux.
1. Install the Snap Store using the command below:
2. Wait until the download completes and launch it by entering:
Note: The Snap Store runs on GNOME and it works best on GTK Ubuntu desktop environments. To err on the safe side and take full advantage of the Snap Store, install a Linux desktop environment that uses GTK, such as GNOME, Mate, or Cinnamon.
Using Snap
To use a snap package on your system, you need to install it first. Use the Snap Store if you prefer the GUI method, or use the terminal.
To install a snap app via the terminal, enter the following command:
Wait for the installation to finish.
Search for Snaps
To browse through available snap packages, use the following:
For example, to search for a web browser, enter:
The output shows a list of apps related to the keyword ‘browser’.
List Installed Snaps
To see a list of all snaps installed on your system, enter the following:
The output shows snap details such as package name, version, revision, and the publisher.
Run Installed Snaps
Run installed snaps from the terminal by entering the app name:
For example, to open the Opera web browser type opera in the terminal and the app launches.
Remove Installed Snaps
To remove an installed snap, use the following command:
The snap remove command removes the application code and any services previously declared by the app. The command also cleans up the app’s runtime dependencies and all associated user data.
Note: For more options on using snap packages, visit our article A Comprehensive Guide To Using Snap Packages On Ubuntu.
After reading this tutorial, you should know how to install Snap on Ubuntu and work with Snap packages.
A Comprehensive Guide to Using Snap Packages on Ubuntu
Home » SysAdmin » A Comprehensive Guide to Using Snap Packages on Ubuntu
Snaps are contained applications in the form of packaged software. The package manager for Snap apps is Snap, created by Canonical for Linux.
Snap comes preinstalled on most of the latest Linux distributions. To check if you have Snap preinstalled on your system and to see how to install Snap, read our tutorial on how to install snap on Ubuntu.
In this tutorial, you will learn how to use Snap packages on Ubuntu.
How to Use Snap Packages?
Manage Snap packages in two ways – by running snap commands in the terminal or by using the Snap Store GUI app.
The Snap Store is a snap app itself. Install it by entering the following command in the terminal:
Install Snap Apps
Install a snap app using the terminal, or use the store if you prefer a graphical environment.
To install a snap using the terminal you need to know the exact app name. The general syntax for installing snap packages is:
write the name of the snap app you want to install. For example:
To install a snap using the Snap Store app, follow these steps:
1. Open the Snap Store by entering snap-store in the terminal.
2. Click the app you want to install.
3. Select Install and enter your password. Wait for the download to finish.
Snap confinement describes the level of isolation of a snap on your system. The levels are:
Run Snaps
Run snaps in two ways:
To run a snap via the terminal, enter the package name in the terminal.
For example, enter snap-store to open the Snap Store app.
Note: If you get theme parsing errors when launching some snaps, this is due to incompatibilities between the fontconfig library in the snap and the hosts fontconfig. This is a known issue, and the app opens normally anyway.
Another way to run a snap is to search for the app in the app menu and launch it from there.
Note that it takes some time for the app to open the first time you run it. Subsequent runs are much faster.
List Installed Snaps
See a list of installed snaps in two ways:
To list installed snaps using the terminal, use the list command:
This shows a list of installed snaps, including the app version, revision number, snap confinement level, publisher and app notes.
Launch the Snap Store and click the Installed tab. That lists all snap apps on your system.
Search for Snaps
Run the snap find command to search for an application. The search term doesn’t need to match the name of the application. For example, you can search for a media player by typing “media_player”.
Search for an app by entering the keyword in the search box of the Snap Store or browse the available categories.
Update Snaps
Snaps automatically update to the latest available version each day. To update snaps manually, use the terminal or the Snap Store.
Check for updates for a single app or see all available updates:
1. Update a single app.
2. Enter your password and the update process starts.
This updates the app or informs the user that the latest version is already installed.
To see which snap packages have available updates, use the command below:
The output lets you know if there are any updates available for your installed snaps.
For a visual approach to updating apps, enter the Snap Store and click the Updates tab. Available updates are displayed.
Downgrade Snaps
If you encounter issues after updating a snap to its latest version, or if you do not like the new update for any reason, revert to the previous one by entering the snap revert command:
Important: This is only possible if you had the app’s previous version on your system. Otherwise, you get an error saying that there is no revision to revert to. This also works when you try a beta version of an app and want to revert to the stable one.
Remove Snaps
To remove a snap from the system, use the following command:
The procedure also removes all previous revisions. To remove a specific version, use the same command and add the —revision= argument.
Once an app is removed, a snapshot of the snap’s system, configuration and user data remains for 31 days.
To remove a snap without generating a snapshot, add the —purge argument to the remove command:
To remove a snap using the Snap Store:
1. Select the Installed tab.
2. Find the app you want to remove and click the Remove button.
Enable and Disable Snaps
If you don’t need a snap, but you don’t want to remove it from your system entirely, disable it by entering:
Enable a disabled snap with the following command:
List All Running Services
Snap allows you to see the services initiated by snap apps.
Use the command snap services to list all system services launched by snap packages currently installed and enabled on your system:
The output shows the service name, whether it launches on system startup, if it’s currently running and any notes available.
To list the services of a single snap, state the package name in the command:
Start, Restart, and Stop Snap Services
After making changes to a snap app, restart snap services for the changes to take effect.
To restart all services, enter the following command:
This restarts all services for a specified snap.
To restart a specific individual service of an app, use the same command with the service name:
To stop all snap services, use the following command:
To stop a snap’s single service, enter the following:
Note: If you manually stop snap services the snap app may malfunction. To temporarily disable a snap, use the —disable command instead.
To prevent a snap service from starting on boot, add the —disable argument:
Use the command sudo snap start
to start all snap services:
On the other hand, to start an individual snap service, use the following command:
The start command includes an —enable option to re-enable the automatic starting of a service on system boot.
For a service to start on next boot, add the —enable argument:
Download and Install Snap Apps Offline
To install snap apps on a system without Internet access, first download the necessary files on a machine with Internet connection.
To download a snap package, use the following command:
Note: It is advisable to also download and install the “core” and “gnome-3-26-1604” snaps if they are not already present on the target system. This is because some GNOME snaps require them to function properly.
2. Install the packages using the following commands:
Modify Snap Configurations
Snaps that provide background services allow you to see and change their configuration options.
To see a snap’s configuration options, use the sudo snap get
The output shows available configuration options of the specified snap. A in the output indicates that there are further options below the current key level.
The output also indicates if the specified app does not have configuration options.
To explore additional options, add the key name to the previous command:
To change a snap’s configuration option, use the command:
To restore a value to its default state, use the following:
Alternatively, to restore a value to its default stage, use the set command but add ! at the end of the key name to restore the default value:
Combine ! with other setting options at the same time:
The system checks the configuration update. If you enter a wrong value, the system detects the error and cancels the change, reverting to the previous configuration.
Note: If the update takes longer than 5 minutes, it automatically aborts and rolls back the configuration options.
Display History of Changes Made to Your System
Snap allows the user to see the history of changes it has made on the system.
Use the snap changes command to see a full list of changes in your system.
The output shows when the change took place, its status, and a summary of what happened.
Switch Channels
Snap apps are available in several channels, depending on the apps’ development status. Switch between these channels, for example, to access a beta version of the app. Switching channels is similar to switching branches in git.
There are four available channels:
To change to a different channel, use the following command:
After switching the channel, the specified app gets updates from that channel. To switch back to the previous one, use the refresh command and enter the channel name.
Alternatively, use the revert command.
You now know how to use Snaps on Ubuntu. You also know how to use the Snap Store, modify and adjust snap services and configurations to your own preference and choose the release you like.
Feel free to download and test different apps and settings. The number of apps available is constantly increasing and snap development has picked up speed in recent years, with an audience of millions in the Snap Store. To learn more about package managers and different package formats in Linux, check out our Flatpak vs. Snap vs. AppImage comparison article.
Источники информации:
- http://medium.com/nuances-of-programming/%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0-snap-%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%BD%D0%B0%D1%8F-%D0%BF%D0%BE%D1%87%D1%82%D0%B8-%D0%BD%D0%B0-%D0%B2%D1%81%D0%B5%D1%85-%D0%B4%D0%B8%D1%81%D1%82%D1%80%D0%B8%D0%B1%D1%83%D1%82%D0%B8%D0%B2%D0%B0%D1%85-linux-%D0%BF%D0%BE%D0%BC%D0%BE%D0%B3%D0%B0%D0%B5%D1%82-%D1%80%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D1%87%D0%B8%D0%BA%D0%B0%D0%BC-%D0%B8-%D0%BF%D1%80%D0%BE%D1%81%D1%82%D1%8B%D0%BC-8a80b63cfd91
- http://snapcraft.io/docs/getting-started
- http://phoenixnap.com/kb/install-snap-ubuntu
- http://phoenixnap.com/kb/snap-packages