Install LXD Dashboard with LXDware

Install LXD dashboard dengan LXDware

Baca juga: Install LXD (Linux Container) on Ubuntu 20.04

Baca juga: Add Profile on LXD Linux Container

  • Tambahakn linux container ubuntu 20.04 pada server lxd
root@LXC:~/sys-ops.id# lxc launch images:ubuntu/focal/amd64 ubuntu-2004-lxd-dashboard
root@LXC:~/sys-ops.id# lxc list
+---------------------------+---------+----------------------+------+-----------+-----------+
|           NAME            |  STATE  |         IPV4         | IPV6 |   TYPE    | SNAPSHOTS |
+---------------------------+---------+----------------------+------+-----------+-----------+
| ubuntu-2004-container     | RUNNING | 10.101.10.139 (eth0) |      | CONTAINER | 1         |
+---------------------------+---------+----------------------+------+-----------+-----------+
| ubuntu-2004-lxd-dashboard | RUNNING | 10.101.10.174 (eth0) |      | CONTAINER | 0         |
+---------------------------+---------+----------------------+------+-----------+-----------+
  • Masuk ke dalam bash linux container yang barusan sudah dibuat
root@LXC:~/sys-ops.id# lxc exec ubuntu-2004-lxd-dashboard -- /bin/bash
root@ubuntu-2004-lxd-dashboard:~#
  • Install Nginx, PHP dan SQLite pada linux container ubuntu
root@ubuntu-2004-lxd-dashboard:~# apt update && apt install wget nginx php-fpm php-curl sqlite3 php-sqlite3 -y 
  • Download LXD dashboard v3.1.0, cek versi terbaru disini
root@ubuntu-2004-lxd-dashboard:~# wget https://github.com/lxdware/lxd-dashboard/archive/v3.1.0.tar.gz
root@ubuntu-2004-lxd-dashboard:~# tar -xzf v3.1.0.tar.gz
  • Copy file konfigurasi nginx dan file aplikasi lxd dashboard
root@ubuntu-2004-lxd-dashboard:~# cp -a lxd-dashboard-3.1.0/default /etc/nginx/sites-available/
root@ubuntu-2004-lxd-dashboard:~# cp -a lxd-dashboard-3.1.0/lxd-dashboard/ /var/www/html/
  • Buat directory lxdware untuk menyimpan data lxd dashboard
root@ubuntu-2004-lxd-dashboard:~# mkdir -p /var/lxdware/data/sqlite
root@ubuntu-2004-lxd-dashboard:~# mkdir -p /var/lxdware/data/lxd
root@ubuntu-2004-lxd-dashboard:~# mkdir -p /var/lxdware/backups
  • Edit permission directory lxdware dan html
root@ubuntu-2004-lxd-dashboard:~# chown -R www-data:www-data /var/lxdware/
root@ubuntu-2004-lxd-dashboard:~# chown -R www-data:www-data /var/www/html/
  • Restart service nginx
root@ubuntu-2004-lxd-dashboard:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@ubuntu-2004-lxd-dashboard:~# systemctl restart nginx
root@ubuntu-2004-lxd-dashboard:~# exit

  • Buat profile proxy-80-only, info lengkapnya cek disini
root@LXC:~/sys-ops.id# lxc profile create proxy-80-only
  • Konfigurasi port forwarding untuk port 9080 dari host lxd ke port 80 pada lxc container
root@LXC:~/sys-ops.id# lxc profile device add proxy-80-only hostport80 proxy connect="tcp:127.0.0.1:80" listen="tcp:0.0.0.0:9080"
  • Tambahkan profile proxy-80-only pada container ubuntu-2004-lxd-dashboard
root@LXC:~/sys-ops.id# lxc profile add ubuntu-2004-lxd-dashboard proxy-80-only

  • Konfigurasi ulang LXD agar bisa di akses oleh LXD dashboard lewat jaringan
root@LXC:~/sys-ops.id# lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: no
Do you want to configure a new storage pool? (yes/no) [default=yes]: no
Would you like to connect to a MAAS server? (yes/no) [default=no]: no
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: no
Would you like the LXD server to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]: all
Port to bind LXD to [default=8443]: 8443
Trust password for new clients:
Again:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes] yes
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: no

  • Akses LXD dashboard dengan url: http://ip_address_server_lxd:9080
  • Buat file lxdware.crt , lalu copy LXD client sertificate ke dalam file tersebut
root@LXC:~/sys-ops.id# nano lxdware.crt
  • Import LXD client sertificate ke dalam server LXD
root@LXC:~/sys-ops.id# lxc config trust add lxdware.crt
root@LXC:~/sys-ops.id# lxc config set core.https_address [::]
  • Tambahkan server LXD host, dengan ip local yang ada pada interface lxdbr0
  • Server LXD berhasil di tambahkan ke dalam LXD dashboard
  • Tampilan LXD dashboard

herdiana3389

A system administrator with skills in system administration, virtualization, linux, windows, networking, cloud computing, container, etc.