转载来源:https://computingforgeeks.com/install-snapd-snap-applications-centos-7/

How to Install Snapd and Snap applications on CentOS 7

(Last Updated On: August 21, 2018)

In this guide, I’ll take you through the steps to install and use snapd service on CentOS 7 server. For those new to snap terminology, snap comes from Snappy which is a package management and software deployment system from Canonical. It was originally designed for the Ubuntu phone operating system.

What is a snap?

snap :

  • is a squashFS filesystem containing your app code and a snap.yaml file containing specific metadata. It has a read-only file-system and, once installed, a writable area.
  • is self-contained. It bundles most of the libraries and runtimes it needs and can be updated and reverted without affecting the rest of the system.
  • is confined from the OS and other apps through security mechanisms, but can exchange content and functions with other snaps according to fine-grained policies controlled by the user and the OS defaults.

What is Snapd?

Snapd is a REST API daemon service that runs on your Linux system to manage snap packages (“snaps“). It interacts with the snap store and provides the command clientsnap used to interact with it. You must install snapd before you can start managing snaps on any Linux distribution.

Why use Snaps?

Snap packages any app for every Linux desktop, server, cloud or device. Snaps are faster to install, easier to create, safer to run, and they update automatically and transactionally so your app is always fresh and never broken. You can bring your own build infrastructure or use ours.

How to Install and Use Snapd on CentOS 7

Follow steps below to install Snapd on CentOS 7 server.

Step 1:  Install the COPR plugin and EPEL

Kick off the installation by adding epel repository and installing copr yum plugin.

sudo yum install epel-release
sudo yum install yum-plugin-copr

Then add the repo:

$ sudo yum copr enable ngompa/snapcore-el7Loaded plugins: copr, fastestmirrorYou are about to enable a Copr repository. Please note that this
repository is not part of the main Fedora distribution, and quality
may vary.The Fedora Project does not exercise any power over the contents of
this repository beyond the rules outlined in the Copr FAQ at
<https://fedorahosted.org/copr/wiki/UserDocs#WhatIcanbuildinCopr>, and
packages are not held to any quality or securty level.Please do not file bug reports about these packages in Fedora
Bugzilla. In case of problems, contact the owner of this repository.Do you want to continue? [y/N]: y
copr done

Once the repository has been added, install snapd package.

sudo yum -y install snapd

Wait for the installation to finish then enable snapd socket:

$ sudo systemctl enable --now snapd.socket
Created symlink from /etc/systemd/system/sockets.target.wants/snapd.socket to /usr/lib/systemd/system/snapd.socket.

Classic confinement requires snaps under /snap or symlink from /snap to /var/lib/snapd/snap. Create a symlink for it like below:

sudo ln -s /var/lib/snapd/snap /snap

Snapd is now ready for use. You interact with it using the snap command. See help page below:

# snap --help
Usage:snap [OPTIONS] <command>Install, configure, refresh and remove snap packages. Snaps are
'universal' packages that work across many different Linux systems,
enabling secure distribution of the latest apps and utilities for
cloud, servers, desktops and the internet of things.This is the CLI for snapd, a background service that takes care of
snaps on the system. Start with 'snap list' to see installed snaps.Application Options:--version  Print the version and exitHelp Options:-h, --help     Show this help messageAvailable commands:abort       Abort a pending changeack         Adds an assertion to the systemalias       Sets up a manual aliasaliases     Lists aliases in the systembuy         Buys a snapchanges     List system changesconnect     Connects a plug to a slotdisable     Disables a snap in the systemdisconnect  Disconnects a plug from a slotdownload    Downloads the given snapenable      Enables a snap in the systemfind        Finds packages to install (aliases: search)get         Prints configuration optionshelp        Helpinfo        show detailed information about a snapinstall     Installs a snap to the systeminterface   Lists snap interfacesinterfaces  Lists interfaces in the systemknown       Shows known assertions of the provided typelist        List installed snapslogin       Authenticates on snapd and the storelogout      Log out of the storelogs        Retrieve logs of servicespack        pack the given target dir as a snapprefer      Prefer aliases from a snap and disable conflictsrefresh     Refreshes a snap in the systemremove      Removes a snap from the systemrestart     Restart servicesrevert      Reverts the given snap to the previous staterun         Run the given snap commandservices    Query the status of servicesset         Changes configuration optionsstart       Start servicesstop        Stop servicesswitch      Switches snap to a different channeltasks       List a change's tasks (aliases: change)try         Tests a snap in the systemunalias     Unalias a manual alias or an entire snapversion     Shows version detailswatch       Watch a change in progresswhoami      Prints the email the user is logged in with.

How to Install Snap Applications on CentOS 7

We use snap command line tool to interact with snaps available on Snap Store.

Searching for a snap:

To search for Snaps, use

$ snap find <search terms>

This will query the store and list the results with their version number, developer names, and the description.

I’ll do an example for installation of Microsoft PowerShell automation and configuration management platform on CentOS 7 server.

# snap search powershell
Name                Version          Developer             Notes    Summary
powershell-preview  6.1.0-preview.4  microsoft-powershell  classic  PowerShell for every system!
powershell          6.0.4            microsoft-powershell  classic  PowerShell for every system!

Install snap by running:

sudo yum install -y icu
sudo snap install powershell --classic

Wait for the download to finish, it should take short time to complete. Since the binary file is located under,/snap/bin/ we need to add this to the $PATHvariable.

$ sudo vim /etc/profile
export PATH="$PATH:/snap/bin/"

Source the file to get new PATH

source /etc/profile

Test by starting the pwshsession.

# pwsh
PowerShell v6.0.4
Copyright (c) Microsoft Corporation. All rights reserved.https://aka.ms/pscore6-docs
Type 'help' to get help.PS /root>

To list installed snaps:

# snap list
Name        Version    Rev   Developer             Notes
core        16-2.34.3  5145  canonical             core
powershell  6.0.4      8     microsoft-powershell  classic

Manually update snaps by running snap refresh

# snap refresh powershell
snap "powershell" has no updates available

Removing Snaps

To remove a snap, all you need to do is run.snap remove <snap name>  In our case just do:

# snap remove powershell
powershell removed

Check snap info:

Use the command snap info to check for more info about a snap package.

[root@cent-01 ~]# snap info powershell
name:      powershell
summary:   PowerShell for every system!
publisher: microsoft-powershell
contact:   https://github.com/powershell/powershell
description: |PowerShell is an automation and configuration management platform.It consists of a cross-platform (Windows, Linux, and macOS)command-line shell and associated scripting language.Seehttps://docs.microsoft.com/en-us/powershell/scripting/powershell-core-supportfor support details.
snap-id:     JSNnoJl3EqkMuWoy5Dgq8PMqZ0uNcpie
channels:              stable:    6.0.4 (8) 58MB classiccandidate: 6.0.4 (8) 58MB classicbeta:      6.0.4 (8) 58MB classicedge:      6.0.4 (8) 58MB classic

Roll back to a previous version of an application

Use snap revert

$ sudo snap revert <snap name>

Conclusion

By now you should be able to install snaps the store, manually update them, remove them, check installed snaps and much more. The snap command line is designed to be as simple and memorisable as possible. It should become a second nature to you after using it just a couple of times.

How to Install Snapd and Snap applications on CentOS 7相关推荐

  1. How to install innotop and percona tookit on centos

    #各种依赖包下载地址 http://www.cpan.org/modules/by-module #一共要安装的依赖包:Time::HiRes,Term::ReadKey,DBI,DBD::mysql ...

  2. QA for Install Oracle 11G Release 2 on Centos Linux 7

    对于那个question,这里可能有另一种解决方案 前提:linux安装时勾选了"安装图形界面" 方案一(不安装vnc) 条件 windows客户端:安装xmanager, 1,x ...

  3. Ubuntu系统 不使用snap安装firefox,使用firefox官网下载的安装包安装firefox

    Ubuntu系统 不使用snap安装firefox,使用firefox官网下载的安装包安装firefox 一.源起 二.寻找原因记录(之前卸载snap的原因!!,本节主要说snap的事,装firefo ...

  4. linux so 发布,如何在Linux上构建发布包含.so动态库的snap安装包

    Linux上要发布源码包比较容易,只要做个压缩包.tar.gz就可以.但是如果要做一个包含库和可执行文件的安装包,就比较麻烦.Linux的版本很多,需要做不同格式的安装包,比如.deb和.rpm,同时 ...

  5. centos 7 包管理工具 snap 安装部署

    目录 snap简介 安装 常用的命令 snap简介 什么是snap,snap是一种全新的软件包管理方式,它类似一个容器拥有一个应用程序所有的文件和库,各个应用程序之间完全独立.所以使用snap包的好处 ...

  6. ubuntu18.04中软件下载无法使用,snap下载慢

    # 为snap配置代理 sudo snap set system proxy.http="socks5://127.0.0.1:1080" sudo snap set system ...

  7. 国内程序员的Linux开发平台-Deepin

    导读 研发工作了这么长时间,一直在Windows平台做研发工作,期间也纠结过Linux和Mac平台,经过一番自我分析,决定使用Linux环境作为主要开发环境,Linux环境版本众多,先尝试了Unbun ...

  8. 创造自己的专属免费网盘:Nextcloud

    由于百度网盘速度奇慢无比,而且同步文件夹还需要会员什么的.........这对于Nextcloud来说简直就是欺负人啊.所以我们通过搭建一个Nextcloud的私有云,来解决这些问题. 目录: 简介 ...

  9. MicroK8s及KubeFlow安装文档

    安装简单的k8s大约有三种思路:minikube,microk8s,kubeadm.minikube 虽然是官方出品,但主要还是基于虚拟机做的设计.在 Linux 生产环境下,microk8s 可能是 ...

最新文章

  1. 记录一下HALCON调用相机自带驱动加速采集速率
  2. Eclipse 中 Debug 模式跳转到 exitCurrentThread 的问题解决
  3. CV之Face Detection:Face Detection人脸检测原理及其常见分类技术
  4. python3进阶_Python3 进阶教程 2020全新版
  5. java 垃圾回收 null_java方法中把对象置null,到底能不能加速垃圾回收
  6. @Deprecated 注解 (@Documented 、@Retention、@Target)
  7. idea 使用sonarlint报错解决方案
  8. 计算机的时代背景,学生计算机论文,关于新时代背景下的中专计算机教学相关参考文献资料-免费论文范文...
  9. prometheus grafana 统计cpu个数
  10. 五、移动端技术解决方案
  11. cad无法安装_装机必备!免安装CAD迷你看图特别版PC软件
  12. 记录点滴——2020年终总结
  13. vs201的vc++目录
  14. 查看git暂存区有哪些文件
  15. 计算机网络实践网线制作,一种用于计算机网络对接网线接头的制作方法
  16. 学校建立学生心理健康的必要性
  17. STM32+ESP8266使用MQTTAT固件连接云
  18. 淘宝API app商品搜索
  19. 机器学习:二分类到多分类-ovr,ovo,mvm,sofmax
  20. 9_1 法律法规标准化

热门文章

  1. 单点登陆(SSO)组件的设计与实现一 【转】
  2. 纯CSS打造的Family tree(族谱)
  3. Node.js入门 - 回调函数
  4. LR逻辑斯蒂回归 — 机器学习面试
  5. MySQL的Limit性能问题
  6. 【AI视野·今日CV 计算机视觉论文速览 第190期】Fri, 9 Apr 2021
  7. 事务演练 mysql
  8. 案例 员工坐小车回家 c# 1614190875
  9. mysql-索引操作
  10. Event Viewer 查看 Windows 系统日志