centos8 系统通过 snaps 安装markdown编辑器 typora
Snaps 是打包了程序所有依赖的应用,可应用于桌面系统、云端和物联网,具有安装简易、安全、跨平台以及无需手动解决程序依赖问题。 Snaps 可以从 Snap Store 获取下载和安装。
Snap 是一项应用程序及其依赖的捆绑集成包bundle
,可在linux 发行版中无需修改就可以直接运行。 Snapd 是一项后台服务,可以自动管理和维护Snap 。Snapcraft 是用于构建和发布 Snap 的命令和框架。
1. enable snapd
Snap 适用于 Centos 7.6 版本及以上、 RHEL 7.6版本及以上,可以通过 Extra Packages for Enterprise Linux(EPEL) repository 仓库获取安装。
EPEL 是一个 Fedora Special Interest Group , 负责创建、维护和管理Enterprise Linux一系列高质量additional packages, 包括但不限于 RHEL、CentOS、Scientific Linux(SL), Oracle Linux(OL).
EPEL包通常基于它们的 Fedora 对应包,永远不会与 base Enterprise Linux 发行版中的包冲突或发生替换。 EPEL 使用与 Fedora 基本相同的infrastructures, 包括 buildsystem, bugzilla instance, update manager, mirror manager and more.
1.1 添加 EPEL 仓库
[arthur@localhost ~]$ yum repolist | grep epel
epel Extra Packages for Enterprise Linux 8 - x86_64
epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64
此处,显示当前系统已经添加 epel 仓库,若无,可以通过以下方式添加:
[arthur@localhost ~]$ sudo yum install epel-release
[sudo] password for arthur:
Last metadata expiration check: 2:41:41 ago on Tue 31 Aug 2021 07:22:49 AM EDT.
Package epel-release-8-10.el8.noarch is already installed.
Dependencies resolved.
...
Upgraded:
epel-release-8-11.el8.noarch
Complete!
1.2 安装 Snap
[arthur@localhost ~]$ sudo yum install snapd
Last metadata expiration check: 2:42:12 ago on Tue 31 Aug 2021 07:22:49 AM EDT.
...
Installing:
snapd x86_64 2.51-1.el8 epel 17 M
...
Installing dependencies:
snap-confine x86_64 2.51-1.el8 epel 3.0 M
snapd-selinux noarch 2.51-1.el8 epel 424 k
...
Downloading Packages:
(1/5): snapd-selinux-2.51-1.el8.noarch.rpm 952 kB/s | 424 kB 00:00
(2/5): selinux-policy-3.14.3-67.el8_4.1.noarch.rpm 1.7 MB/s | 628 kB 00:00
(3/5): snap-confine-2.51-1.el8.x86_64.rpm 1.6 MB/s | 3.0 MB 00:01
(4/5): snapd-2.51-1.el8.x86_64.rpm 3.9 MB/s | 17 MB 00:04
(5/5): selinux-policy-targeted-3.14.3-67.el8_4.1.noarch.rpm 3.1 MB/s | 15 MB 00:04
\------------------------------------------------------------------------------------------------------------------------------------------------------
Total 5.1 MB/s | 36 MB 00:06
...
Installed:
snap-confine-2.51-1.el8.x86_64 snapd-2.51-1.el8.x86_64 snapd-selinux-2.51-1.el8.noarch
Complete!
1.3 启用 systemd
单元
systemd
单元负责管理 snap communication socket .systemd
是 Linux 操作系统中系统和服务的 manager. 它被设计为向后兼容 SysV init 脚本,并提供许多特性,比如在引导时并行启动系统服务、按需激活守护进程(daemons
)或基于依赖关系的服务控制逻辑。 socket unit
是 systemd
unit 的一种类型,文件拓展名为.socket
, 是进程间通信套接字。
[arthur@localhost ~]$ sudo systemctl enable --now snapd.socket
Created symlink /etc/systemd/system/sockets.target.wants/snapd.socket → /usr/lib/systemd/system/snapd.socket.
1.4 创建/var/lib/snapd/snap
与 /snap
之间的符号连接symbolic link
$ ln --help
Usage: ln [OPTION]... [-T] TARGET LINK_NAME
or: ln [OPTION]... TARGET
or: ln [OPTION]... TARGET... DIRECTORY
or: ln [OPTION]... -t DIRECTORY TARGET...
In the 1st form, create a link to TARGET with the name LINK_NAME.
In the 2nd form, create a link to TARGET in the current directory.
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.
Create hard links by default, symbolic links with --symbolic.
By default, each destination (name of new link) should not already exist.
When creating hard links, each TARGET must exist. Symbolic links
can hold arbitrary text; if later resolved, a relative link is
interpreted in relation to its parent directory.
[arthur@localhost ~]$ sudo ln -s /var/lib/snapd/snap /snap
完成上述步骤之后,虽然官网说明文档提到可以退出登陆后再重新登入,但还是推荐重启系统,以确保 snap 路径更新成功。
2. 安装 typora
[arthur@localhost ~]$ sudo snap install typora
此后,就会一路自动化安装 typora .
安装完成后,需要在命令行启动 typora :
$typora
reference :
[1] install typora on centos.snapcraft.
[2] EPEL.fedoraproject.org.
[3] managing services with systemd.redhat.com