[31] Snappy – Instalacja

9 lutego 2021 Wyłączono przez Adam [zicherka] Nogły

Zainstaluj Snappy, czyli system wdrażania oprogramowania i zarządzania pakietami.
[1] Zainstaluj i uruchom Snapd, aby móc używać pakietów Snap.

[root@vlsr01 ~]# dnf install snapd
[root@vlsr01 ~]# ln -s /var/lib/snapd/snap /snap
[root@vlsr01 ~]# echo 'export PATH=$PATH:/var/lib/snapd/snap/bin' > /etc/profile.d/snap.sh
[root@vlsr01 ~]# systemctl enable --now snapd.service snapd.socket

[2] Podstawowe komendy u użycie [Snap].

# lista zainstalowanych pakietów
[root@vlsr01 ~]# snap list
No snaps are installed yet. Try 'snap install hello-world'.

# wyszukiwanie pakietów
[root@vlsr01 ~]# snap find kubernetes
Name Version Publisher Notes Summary
microk8s v1.20.1 canonical✓ classic Lightweight Kubernetes for workstations and appliances
eks v1.18.9 canonical✓ classic Amazon EKS Distro (EKS-D) snap
kata-containers 1.12.1 katacontainers✓ classic Lightweight virtual machines that seamlessly plug into the containers ecosystem
…
…

# instalacja pakietu [hello-world]
[root@vlsr01 ~]# snap install hello-world
2021-02-07T19:55:04+01:00 INFO Waiting for automatic snapd restart...
Warning: /var/lib/snapd/snap/bin was not found in your $PATH. If you've not restarted your session
since you installed snapd, try doing that. Please see https://forum.snapcraft.io/t/9469
for more details.

hello-world 6.4 from Canonical✓ installed

[root@vlsr01 ~]# snap list
Name Version Rev Tracking Publisher Notes
core 16-2.48.2 10583 latest/stable canonical✓ core
hello-world 6.4 29 latest/stable canonical✓ -

# pokaż informacje o pakiecie
[root@vlsr01 ~]# snap info hello-world
name: hello-world
summary: The 'hello-world' of snaps
publisher: Canonical✓
store-url: https://snapcraft.io/hello-world
contact: snaps@canonical.com
license: unset
description: |
This is a simple hello world example.
commands:
- hello-world.env
- hello-world.evil
- hello-world
- hello-world.sh
snap-id: buPKUD3TKqCOgLEjjHx5kSiCpIs5cMuQ
tracking: latest/stable
refresh-date: today at 19:55 CET
channels:
latest/stable: 6.4 2019-04-17 (29) 20kB -
latest/candidate: 6.4 2019-04-17 (29) 20kB -
latest/beta: 6.4 2019-04-17 (29) 20kB -
latest/edge: 6.4 2019-04-17 (29) 20kB -
installed: 6.4 (29) 20kB –

# uruchom aplikację (zainstalowany pakiet)
[root@vlsr01 ~]# hello-world
Hello World!

# PATH (ścieżka do pakietu)
[root@vlsr01 ~]# which hello-world
/var/lib/snapd/snap/bin/hello-world

[root@vlsr01 ~]# ll /var/lib/snapd/snap/bin/hello-world
lrwxrwxrwx. 1 root root 13 02-07 19:55 /var/lib/snapd/snap/bin/hello-world -> /usr/bin/snap

# wyłączenie aplikacji
[root@vlsr01 ~]# snap disable hello-world
hello-world disabled

[root@vlsr01 ~]# snap list
Name Version Rev Tracking Publisher Notes
core 16-2.48.2 10583 latest/stable canonical✓ core
hello-world 6.4 29 latest/stable canonical✓ disabled

[root@vlsr01 ~]# hello-world
-bash: /var/lib/snapd/snap/bin/hello-world: Nie ma takiego pliku ani katalogu

# włączenie aplikacji
[root@vlsr01 ~]# snap enable hello-world
hello-world enabled
[root@vlsr01 ~]# hello-world
Hello World!

# odinstalowanie aplikacji
# [snap remove] wymaga polecenia [tar] w systemie
# [tar] nie jest instalowany domyślnie w systemie w minimalnej instalacji
[root@vlsr01 ~]# snap remove hello-world
hello-world removed

[root@vlsr01 ~]# snap list
Name Version Rev Tracking Publisher Notes
core 16-2.48.2 10583 latest/stable canonical✓ core