由 Ubuntu 主導,基於 LXC 強化的 system container 操作界面 LXD 支援圖形界面了~
看到這功能,就從上次的舊電腦的 Ubuntu 18.04 LTS 努力的升級到 22.04 LTS,然後看看這個網頁管理功能。
這邊紀錄一下,LXD 5.x 版的圖形界面。
首先,先筆記一下:在 Ubuntu 18.04 LTS 時 LXD 是以 apt 安裝 deb 套件;在 Ubuntu 20.04 LTS 之後,一律改以 snap 安裝。不過 snap 安裝的指令補完功能會缺。
要恢復的話,要從 snap 目錄挖出來。這樣才能用 Tab 鍵兩次簡化指令輸入。
user@lxdlab:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy user@lxdlab:~$ sudo ln -s /snap/lxd/current/etc/bash_completion.d/snap.lxd.lxc /etc/bash_completion.d/ user@lxdlab:~$
接著是 snap 的版本更新,安裝的時候,有時會固定版本,要更新的話,可以透過切換 channel 方式處理。例如,這邊是從 4.0.9 版要更新到 5.x 版。
為了要用圖形管理界面,好像得更新到 5.x 版~
user@lxdlab:~$ snap list Name Version Rev Tracking Publisher Notes core 16-2.60.4 16202 latest/stable canonical✓ core core20 20231123 2105 latest/stable canonical✓ base lxd 4.0.9-a29c6f1 24061 4.0/stable/… canonical✓ - user@lxdlab:~$ lxd --version 4.0.9 user@lxdlab:~$ user@lxdlab:~$ snap info lxd name: lxd summary: LXD - container and VM manager publisher: Canonical✓ store-url: https://snapcraft.io/lxd contact: https://github.com/canonical/lxd/issues license: unset description: | LXD is a system container and virtual machine manager. It offers a simple CLI and REST API to manage local or remote instances, uses an image based workflow and support for a variety of advanced features. Images are available for all Ubuntu releases and architectures as well as for a wide number of other Linux distributions. Existing integrations with many deployment and operation tools, makes it work just like a public cloud, except everything is under your control. LXD containers are lightweight, secure by default and a great alternative to virtual machines when running Linux on Linux. LXD virtual machines are modern and secure, using UEFI and secure-boot by default and a great choice when a different kernel or operating system is needed. With clustering, up to 50 LXD servers can be easily joined and managed together with the same tools and APIs and without needing any external dependencies. Supported configuration options for the snap (snap set lxd [<key>=<value>...]): - ceph.builtin: Use snap-specific Ceph configuration [default=false] - ceph.external: Use the system's ceph tools (ignores ceph.builtin) [default=false] - criu.enable: Enable experimental live-migration support [default=false] - daemon.debug: Increase logging to debug level [default=false] - daemon.group: Set group of users that have full control over LXD [default=lxd] - daemon.user.group: Set group of users that have restricted LXD access [default=lxd] - daemon.preseed: Pass a YAML configuration to `lxd init` on initial start - daemon.syslog: Send LXD log events to syslog [default=false] - daemon.verbose: Increase logging to verbose level [default=false] - lvm.external: Use the system's LVM tools [default=false] - lxcfs.pidfd: Start per-container process tracking [default=false] - lxcfs.loadavg: Start tracking per-container load average [default=false] - lxcfs.cfs: Consider CPU shares for CPU usage [default=false] - lxcfs.debug: Increase logging to debug level [default=false] - openvswitch.builtin: Run a snap-specific OVS daemon [default=false] - openvswitch.external: Use the system's OVS tools (ignores openvswitch.builtin) [default=false] - ovn.builtin: Use snap-specific OVN configuration [default=false] - shiftfs.enable: Enable shiftfs support [default=auto] For system-wide configuration of the CLI, place your configuration in /var/snap/lxd/common/global-conf/ (config.yml and servercerts) commands: - lxd.benchmark - lxd.buginfo - lxd.check-kernel - lxd.lxc - lxd.lxc-to-lxd - lxd - lxd.migrate services: lxd.activate: oneshot, enabled, inactive lxd.daemon: simple, enabled, active snap-id: J60k4JY0HppjwOjW8dZdYc8obXKxujRu tracking: 4.0/stable/ubuntu-22.04 refresh-date: today at 08:55 UTC channels: latest/stable: 5.19-8635f82 2023-11-22 (26200) 159MB - latest/candidate: 5.20-b670f1a 2023-12-12 (26570) 157MB - latest/beta: ↑ latest/edge: git-e676fc6 2024-01-03 (26615) 157MB - 5.19/stable: 5.19-31ff7b6 2023-10-20 (26093) 159MB - 5.19/candidate: ↑ 5.19/beta: ↑ 5.19/edge: ↑ 5.18/stable: 5.18-762f582 2023-09-26 (25748) 189MB - 5.18/candidate: ↑ 5.18/beta: ↑ 5.18/edge: ↑ 5.17/stable: 5.17-e5ead86 2023-08-29 (25505) 184MB - 5.17/candidate: ↑ 5.17/beta: ↑ 5.17/edge: ↑ 5.16/stable: 5.16-f2b0200 2023-07-26 (25353) 183MB - 5.16/candidate: ↑ 5.16/beta: ↑ 5.16/edge: ↑ 5.15/stable: 5.15-3fe7435 2023-06-28 (25086) 181MB - 5.15/candidate: ↑ 5.15/beta: ↑ 5.15/edge: ↑ 5.0/stable: 5.0.2-838e1b2 2023-01-25 (24322) 117MB - 5.0/candidate: 5.0.2-838e1b2 2023-01-18 (24322) 117MB - 5.0/beta: ↑ 5.0/edge: git-3afa7f6 2024-01-02 (26604) 91MB - 4.0/stable: 4.0.9-a29c6f1 2022-12-04 (24061) 96MB - 4.0/candidate: 4.0.9-a29c6f1 2022-12-02 (24061) 96MB - 4.0/beta: ↑ 4.0/edge: git-407205d 2022-11-22 (23988) 96MB - 3.0/stable: 3.0.4 2019-10-10 (11348) 55MB - 3.0/candidate: 3.0.4 2019-10-10 (11348) 55MB - 3.0/beta: ↑ 3.0/edge: git-81b81b9 2019-10-10 (11362) 55MB - installed: 4.0.9-a29c6f1 (24061) 96MB - user@lxdlab:~$ user@lxdlab:~$ sudo snap install lxd --channel=latest/stable snap "lxd" is already installed, see 'snap help refresh' user@lxdlab:~$ sudo snap refresh lxd --channel=latest/stable 2024-01-03T12:53:29Z INFO Waiting for "snap.lxd.daemon.service" to stop. lxd 5.19-8635f82 from Canonical✓ refreshed user@lxdlab:~$ user@lxdlab:~$ snap list Name Version Rev Tracking Publisher Notes core 16-2.60.4 16202 latest/stable canonical✓ core core20 20231123 2105 latest/stable canonical✓ base core22 20231123 1033 latest/stable canonical✓ base lxd 5.19-8635f82 26200 latest/stable canonical✓ - user@lxdlab:~$ user@lxdlab:~$ lxd --version 5.19 user@lxdlab:~$
升版到 LXD 5.x 之後,就可以啟用 LXD UI 界面了~LXD UI 直接做加密傳輸,因此開的是 https
user@lxdlab:~$ sudo snap set lxd ui.enable=true user@lxdlab:~$ sudo snap restart --reload lxd Restarted. user@lxdlab:~$ lxc config set core.https_address :8443 user@lxdlab:~$
接著就可以進入網頁畫面
https://<LXD 的電腦 IP>:8443/ui/login
LXD 做的很完善,可以把很麻煩的 SSL 憑證信任設定,用網頁按鈕輔助完成。
照著做:先按下大大的綠色按鈕後,會要求要給憑證一個密碼。這步可以跳過
然後就有下載按鈕了,兩份都要抓,然後 crt 要放到 LXD 主機上。而 pfx 要餵進去瀏覽器。
這邊把 crt 放在 ~ 底下,然後照畫面寫的指令匯入 LXD
user@lxdlab:~$ lxc config trust add ~/lxd-ui-172.16.1.134.crt user@lxdlab:~$
在瀏覽器上用以下的設定網址
中間步驟的圖有點多,這邊留主要的圖就好
接著登入就會問憑證
進入之後就是圖形版 LXD 了~
甚至這邊還有網頁版的指令界面~
新版的 LXD 不只是控制 LXC Container,也同時控制 KVM 虛擬機(QEMU)~
而且還能夠設置叢集,等同 Proxmox 與 VMWare 等平台~~
不過我測試環境大多設置 LXC 就很足夠惹~
參考資料:
更新 snap 的 LXD
指令補完
LXD UI
Ubuntu 的 LXD 跟 LXC 專案分家,LXC 社群獨立準備一個界面 Incus。
這個就不是由 Ubuntu 提供企業支援的軟體,不過也就不限定在 snap 安裝,可以在不同平台(例如,Red Hat 系列的 Fedora 或 ArchLinux 等)。
沒有留言:
張貼留言