Cách cài đặt Trình quản lý gói Flatpak trên Ubuntu 22.04

theanh

Administrator
Nhân viên
Flatpak, hay xdg-app, là một công cụ quản lý gói cho hệ điều hành Linux. Công cụ này cho phép bạn cài đặt và quản lý các gói bằng trình quản lý gói flatpak. Flatpak có kho lưu trữ riêng nên bạn không cần phải dựa vào các kho lưu trữ khác. Công cụ này cung cấp tất cả các thư viện và phần phụ thuộc cần thiết để cài đặt phần mềm. Đây là một khuôn khổ triển khai ứng dụng đa phân phối cho phép các nhà phát triển thiết lập Flatpak cho các ứng dụng cho tất cả các bản phân phối chính.

Bài đăng này sẽ chỉ cho bạn cách cài đặt và sử dụng công cụ quản lý gói Flatpak trên Ubuntu 22.04.

Điều kiện tiên quyết​

  • Một máy chủ chạy Ubuntu 22.04.
  • Mật khẩu gốc được cấu hình trên máy chủ.

Cài đặt Flatpak​

Theo mặc định, gói Flatpak được bao gồm trong kho lưu trữ mặc định của Ubuntu. Bạn có thể cài đặt bằng cách chạy lệnh sau:
Mã:
apt install flatpak -y
Sau khi gói Flatpak được cài đặt, bạn có thể xác minh phiên bản của nó bằng cách sử dụng lệnh sau lệnh:
Mã:
flatpak --version
Bạn sẽ thấy đầu ra sau:
Mã:
Flatpak 1.12.7

Kích hoạt kho lưu trữ Flatpak​

Trước khi sử dụng Flatpak, bạn sẽ cần thêm kho lưu trữ Flatpak vào hệ thống của mình. Bạn có thể thêm nó bằng lệnh sau:
Mã:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Bây giờ bạn có thể dễ dàng tìm kiếm và cài đặt các ứng dụng bằng Flatpak.

Tìm kiếm ứng dụng bằng Flatpak​

Flatpak cung cấp chức năng tìm kiếm để tìm kiếm các ứng dụng khả dụng bằng giao diện dòng lệnh.

Cú pháp cơ bản để tìm kiếm ứng dụng được hiển thị bên dưới:
Mã:
flatpak search application-name
Ví dụ, để tìm kiếm ứng dụng điện tín, hãy chạy lệnh sau:
Mã:
flatpak search telegram
Bạn sẽ nhận được thông báo sau kết quả:
Mã:
Name Description Application ID Version Branch Remotes
Telegram Desktop Fast. Secure. Powerful. org.telegram.desktop 4.3.1 stable flathub
Telegram Desktop Webvi… Webview add-on that enables Telegram Desktop to show web content …telegram.desktop.webview 2.38.2 stable flathub
Kotatogram Desktop Kotatogram Desktop messenger io.github.kotatogram 1.4.8 stable flathub
LibreTrack Private, cross-platform package tracking app …roninyaroslav.libretrack 1.3.0 stable flathub
Tangram Browser for your pinned tabs re.sonny.Tangram 1.4.2 stable flathub
Bolls A web app for reading the Bible with full emphasis on the God`s Word… life.bolls.bolls 2.1.80 stable flathub
Franz Messenger for the desktop com.meetfranz.Franz 5.9.1 stable flathub
Delta Chat Delta Chat email-based messenger chat.delta.desktop v1.32.1 stable flathub
Để tìm kiếm Skype, hãy chạy lệnh sau:
Mã:
flatpak search skype
Bạn sẽ nhận được thông báo sau đầu ra:
Mã:
Name Description Application ID Version Branch Remotes
Skype Call and message skype users, with video chat support com.skype.Client 8.90.0.407 stable flathub
Franz Messenger for the desktop com.meetfranz.Franz 5.9.1 stable flathub

Cài đặt Google Chrome bằng Flatpak​

Đầu tiên, hãy tìm kiếm ứng dụng google chrome bằng lệnh sau:
Mã:
flatpak search chrome
Bạn sẽ nhận được thông báo sau đầu ra:
Mã:
Name Description Application ID Version Branch Remotes
Google Chrome The web browser from Google com.google.Chrome 107.0.5304.110-1 stable flathub
Chromium Web Bro… The web browser from Chromium project org.chromium.Chromium 107.0.5304.110 stable flathub
ungoogled-chromi… A lightweight approach to removing Google web service dependency …Eloston.UngoogledChromium 107.0.5304.110 stable flathub
Google Chrome (u… The web browser from Google com.google.ChromeDev 109.0.5410.0-1 stable flathub
CrosAdapta Chrome OS GTK theme ….gtk.Gtk3theme.CrosAdapta 3.22 flathub
PhotoQt Image Vi… View and manage images org.photoqt.PhotoQt 2.9.1 stable flathub
Firestorm Viewer Client for accessing 3D virtual worlds …ormviewer.FirestormViewer 6.3.9.58205 stable flathub
Joplin A free, open source note taking and to-do application, which can… net.cozic.joplin_desktop 2.8.8 stable flathub
Google Play Musi… Run Google Play Music as a standalone desktop app …ymusicdesktopplayer.GPMDP 4.7.1 stable flathub
Gabut Download M… Simple and Faster Download Manager ….github.gabutakut.gabutdm 1.9.9 stable flathub
Postman Postman is a complete API development environment. com.getpostman.Postman 10.1.2 stable flathub
Boxy SVG Scalable Vector Graphics editor com.boxy_svg.BoxySVG 3.92.0 stable flathub
Bây giờ bạn có thể sử dụng id ứng dụng từ đầu ra ở trên để cài đặt Google Chrome:
Mã:
flatpak install com.google.Chrome
Bạn sẽ thấy đầu ra sau:
Mã:
Looking for matches…
Required runtime for com.google.Chrome/x86_64/stable (runtime/org.freedesktop.Platform/x86_64/22.08) found in remote flathub
Do you want to install it? [Y/n]: Y
com.google.Chrome permissions: ipc network cups pcsc pulseaudio wayland x11 devices file access [1] dbus access [2] bus ownership [3] system dbus access [4] tags [5] [1] /run/.heim_org.h5l.kcm-socket, host-etc, xdg-documents, xdg-download, xdg-music, xdg-pictures, xdg-run/dconf, xdg-run/pipewire-0, xdg-videos, ~/.config/dconf:ro, ~/.config/kioslaverc [2] ca.desrt.dconf, org.freedesktop.FileManager1, org.freedesktop.Notifications, org.freedesktop.secrets, org.gnome.SessionManager [3] org.mpris.MediaPlayer2.chromium.* [4] org.freedesktop.Avahi, org.freedesktop.UPower [5] proprietary ID Branch Op Remote Download 1. org.freedesktop.Platform.GL.default 22.08 i flathub < 131.0MB 2. org.freedesktop.Platform.Locale 22.08 i flathub < 333.0MB (partial) 3. org.freedesktop.Platform.openh264 2.2.0 i flathub < 944.3kB 4. org.freedesktop.Platform 22.08 i flathub < 214.4MB 5. com.google.Chrome stable i flathub < 100.1MB
Proceed with these changes to the system installation? [Y/n]: Y
Để liệt kê tất cả các ứng dụng đã cài đặt, hãy chạy lệnh sau lệnh:
Mã:
flatpak list
Bạn sẽ nhận được các danh sách sau:
Mã:
Name Application ID Version Branch Installation
Google Chrome com.google.Chrome 107.0.5304.110-1 stable system
Freedesktop Platform org.freedesktop.Platform 22.08.3 22.08 system
Mesa org.freedesktop.Platform.GL.default 22.1.7 22.08 system
openh264 org.freedesktop.Platform.openh264 2.1.0 2.2.0 system

Chạy ứng dụng Flatpak​

Sau khi cài đặt ứng dụng Google Chrome, bạn có thể khởi chạy ứng dụng bằng cách chạy lệnh sau lệnh:
Mã:
flatpak run com.google.Chrome
Lệnh trên sẽ khởi chạy ứng dụng GUI của Google Chrome.

Xóa ứng dụng bằng Flatpak​

Để xóa ứng dụng Google Chrome, hãy chạy lệnh sau:
Mã:
flatpak uninstall com.google.Chrome
Bạn sẽ thấy thông báo sau đầu ra:
Mã:
ID Branch Op 1. com.google.Chrome stable r
Proceed with these changes to the system installation? [Y/n]: Y
Để xóa các ứng dụng không sử dụng, hãy chạy lệnh sau:
Mã:
flatpak uninstall --unused
Để biết thêm thông tin về các lệnh Flatpak, hãy chạy lệnh sau lệnh:
Mã:
flatpak --help
Bạn sẽ thấy tất cả các tùy chọn dòng lệnh trong đầu ra sau:
Mã:
Usage: flatpak [OPTION…] COMMAND
Builtin Commands: Manage installed applications and runtimes install Install an application or runtime update Update an installed application or runtime uninstall Uninstall an installed application or runtime mask Mask out updates and automatic installation pin Pin a runtime to prevent automatic removal list List installed apps and/or runtimes info Show info for installed app or runtime history Show history config Configure flatpak repair Repair flatpak installation create-usb Put applications or runtimes onto removable media Find applications and runtimes search Search for remote apps/runtimes Manage running applications run Run an application override Override permissions for an application make-current Specify default version to run enter Enter the namespace of a running application ps Enumerate running applications kill Stop a running application

Kết luận​

Xin chúc mừng! bạn đã cài đặt thành công Flatpak trên Ubuntu 22.04. Bây giờ bạn có thể sử dụng Flatpak làm trình quản lý gói thay thế cho APT để cài đặt và quản lý các gói. Hãy thoải mái hỏi tôi nếu bạn có bất kỳ câu hỏi nào.
 
Back
Bên trên