[26] Rocky Linux 9 – Menadżer pakietów – Snappy
15 stycznia 2025Zainstalujemy teraz Snappy, czyli system wdrażania oprogramowania i zarządzania pakietami.
Zainstaluj i uruchom Snapd, aby móc korzystać z menadżera pakietów Snap.
# zainstaluj z repozytorium EPEL [root@vrl01 ~]# dnf --enablerepo=epel -y install Snapd [root@vrl01 ~]# ln -s /var/lib/snapd/snap /snap [root@vrl01 ~]# echo 'export PATH=$PATH:/var/lib/snapd/snap/bin' > /etc/profile.d/snap.sh [root@vrl01 ~]# systemctl enable --now snapd.service snapd.socket
Podstawowe użycie i wykorzystanie komendy [snap].
# pokaż wszystkie zainstalowane pakiety [root@vrl01 ~]# snap list No snaps are installed yet. Try 'snap install hello-world'. # wyszukaj pakiety z określonym słowie w nazwie repozytorium [root@vrl01 ~]# snap find kubernetes Name Version Publisher Notes Summary kubernetes-worker 0.0.2 canonical✓ - A complete Kubernetes worker kubernetes-test 1.28.7 canonical✓ classic tests for kubernetes kubernetes-test-eks 1.10.3 canonical-cloud-snaps classic tests for kubernetes microk8s v1.28.7 canonical✓ classic Kubernetes for workstations and appliances kata-containers 2.4.2 katacontainers✓ classic Build lightweight VMs that seamlessly plug into the containers ecosystem . . . . . . # zainstaluj pakiet [hello-world] [root@vrl01 ~]# snap install hello-world 2024-03-01T21:41:21+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@vrl01 ~]# snap list Name Version Rev Tracking Publisher Notes core 16-2.61.1 16574 latest/stable canonical✓ core hello-world 6.4 29 latest/stable canonical✓ - # pokaż informacje o pakiecie [root@vrl01 ~]# 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 21:41 CET channels: latest/stable: 6.4 2024-02-27 (29) 20kB - latest/candidate: 6.4 2024-02-27 (29) 20kB - latest/beta: 6.4 2024-02-27 (29) 20kB - latest/edge: 6.4 2024-02-27 (29) 20kB - installed: 6.4 (29) 20kB – # uruchom aplikację [root@vrl01 ~]# hello-world Hello World! # PATH (ścieżka) [root@vrl01 ~]# which hello-world /var/lib/snapd/snap/bin/hello-world [root@vrl01 ~]# ll /var/lib/snapd/snap/bin/hello-world lrwxrwxrwx. 1 root root 13 03-01 21:41 /var/lib/snapd/snap/bin/hello-world -> /usr/bin/snap # wyłącz aplikację [root@vrl01 ~]# snap disable hello-world hello-world disabled [root@vrl01 ~]# snap list Name Version Rev Tracking Publisher Notes core 16-2.61.1 16574 latest/stable canonical✓ core hello-world 6.4 29 latest/stable canonical✓ disabled [root@vrl01 ~]# hello-world -bash: /var/lib/snapd/snap/bin/hello-world: Nie ma takiego pliku ani katalogu # włącz aplikację [root@vrl01 ~]# snap enable hello-world hello-world enabled [root@vrl01 ~]# hello-world Hello World! # odinstaluj aplikację # [snap remove] wymaga polecenia [tar] w systemie [root@vrl01 ~]# snap remove hello-world hello-world removed [root@vrl01 ~]# snap list Name Version Rev Tracking Publisher Notes core 16-2.61.1 16574 latest/stable canonical✓ core