diff --git a/how-to/How-To-Setup-Nc-Env-In-Ubuntu-Desktop-20.04.md b/how-to/How-To-Setup-Nc-Env-In-Ubuntu-Desktop-20.04.md index 8dec9f1..77c8b80 100644 --- a/how-to/How-To-Setup-Nc-Env-In-Ubuntu-Desktop-20.04.md +++ b/how-to/How-To-Setup-Nc-Env-In-Ubuntu-Desktop-20.04.md @@ -33,7 +33,7 @@ ### Check the storage -You should have a disk or unformatted partition, of 20GB or more, that we can use as LXD ZFS-based storage pool. If you don’t have any, you can use the directory storage backend and change your answers below accordingly. +You should have a disk or unformatted partition, of 20GB or more, that we can use as LXD ZFS-based storage pool. If you don’t have any, you can use the directory storage backend and change your answers in section "LXD Configuration" below accordingly. ### LXD Installation @@ -139,13 +139,20 @@ Go through the LXD initialization process: +--- -| :memo: The process below assumes you have a free local block device that we can use as a storage pool. If you don’t have one, you can use the `dir` backend| -|----------------------------------------------------------------------------------------------------| +:memo: The process below assumes you have a free local block device that we can use as a storage pool. If you don’t have one, you can use the `dir` backend +--- + +--- + +:memo: Make sure the user is in group `lxd` + +--- ``` -$ sudo lxd init +$ 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]: yes Name of the new storage pool [default=default]: pool01 @@ -177,8 +184,9 @@ Create a LXD profile for the containers created in nc-env: ``` -$ lxc profile add nc-env-profile +$ lxc profile create nc-env-profile $ lxc profile device add nc-env-profile root disk path=/ pool=pool01 size=5GB +$ lxc profile device add nc-env-profile eth0 nic nictype=bridged name=eth0 parent=lxdbr0 $ lxc profile list +----------------+---------------------+---------+ | NAME | DESCRIPTION | USED BY | @@ -205,27 +213,37 @@ [Service] Type=oneshot -ExecStart=/usr/bin/resolvectl dns lxdbr0 +ExecStart=/usr/bin/resolvectl dns lxdbr0 ExecStart=/usr/bin/resolvectl domain lxdbr0 '' [Install] -WantedBy=sys-subsystem-net-devices-lxdbr0 .device +WantedBy=sys-subsystem-net-devices-lxdbr0.device +``` +Now you can reload the systemd daemons and enable and start the service: + + +--- + +:memo: In Debian environments, you should enable at this point the `systemd-resolved` service (`sudo systemctl enable systemd-resolved.service`), then reboot. + +--- + + +``` $ sudo systemctl daemon-reload + $ sudo systemctl enable lxd-dns-lxdbr0.service + $ sudo systemctl start lxd-dns-lxdbr0.service + $ sudo resolvectl status lxdbr0 -Link 4 (lxdbr0) - Current Scopes: DNS -DefaultRoute setting: no - LLMNR setting: yes -MulticastDNS setting: no - DNSOverTLS setting: no - DNSSEC setting: no - DNSSEC supported: no - Current DNS Server: - DNS Servers: - DNS Domain: +Link 3 (lxdbr0) + Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 + Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported +Current DNS Server: + DNS Servers: + DNS Domain: ``` @@ -352,15 +370,41 @@ ``` +If this is your first container created with vagrant-lxd you'll need to add a certificate in LXD trust store allowing vagrant to interact with it. To do that, just issue the following command: + +``` +$ vagrant up +The LXD provider could not authenticate to the daemon at https://127.0.0.1:8443. + +You may need configure LXD to allow requests from this machine. The +easiest way to do this is to add your LXC client certificate to LXD's +list of trusted certificates. This can typically be done with the +following command: + + $ lxc config trust add /home/ubuntu/.vagrant.d/data/lxd/client.crt + +You can find more information about configuring LXD at: + + https://linuxcontainers.org/lxd/getting-started-cli/#initial-configuration +``` + +As suggested in the helper, issue the following command (change the name of the user according to your setup): + +``` +$ lxc config trust add /home/ubuntu/.vagrant.d/data/lxd/client.crt +``` + Then, issue the following command: ``` $ vagrant up > log/provision.log ``` -| :memo: You can safely ignore the warning: `==> default: The host machine does not support LXD synced folders.`| -|----------------------------------------------------------------------------------------------------| +--- +:memo: You can safely ignore the warning: `==> default: The host machine does not support LXD synced folders.` + +--- You may to want to follow the provisioning progress with the following command: @@ -380,10 +424,14 @@ +------+---------+---------------------+------+-----------+-----------+ ``` -Assign nc01 to profile nc-env-profile: +Assign `nc01` the profile `nc-env-profile`: -| :memo: This result could have been achieved also by setting the parameter lxd.profiles in Vagrantfile.| -|----------------------------------------------------------------------------------------------------| + +--- + +:memo: This result could have been achieved also by setting the parameter `lxd.profiles` in `Vagrantfile`. + +--- ``` $ lxc profile add nc01 nc-env-profile @@ -391,6 +439,6 @@ ## Conclusion -You can now start using your brand-new Nextcloud instance by opening the instance url in your browser. The instance url and the admin suer login credentials are displayed at the end of the log. For example if you set MACHINE_HOSTNAME=nc01.localenv.com in provision.sh, you will be able to access the instance with the following url: https://nc01.localenv.com. +You can now start using your brand-new Nextcloud instance by opening the instance url in your browser. The instance url and the admin user login credentials are displayed at the end of the log. For example if you set `MACHINE_HOSTNAME=nc01.localenv.com` in `provision.sh`, you will be able to access the instance with the following url: `https://nc01.localenv.com`. -To build up more complex environments please check the list of templates available and pick the ones that fit your needs! \ No newline at end of file +To build up more complex environments please check the list of templates available and pick the ones that fit your needs! diff --git a/how-to/How-To-Setup-Nc-Env-in-Debian-Bullseye.md b/how-to/How-To-Setup-Nc-Env-in-Debian-Bullseye.md new file mode 100644 index 0000000..1303f51 --- /dev/null +++ b/how-to/How-To-Setup-Nc-Env-in-Debian-Bullseye.md @@ -0,0 +1,180 @@ +# Initial Setup of nc-env in Debian 11 + +## Introduction + +This document describes the step-by-step procedure for the initial setup of nc-env in a Debian 11 system. + +Check the [project homepage](https://codeberg.org/pmarini/nc-env) to know more about nc-env. + +## Software Environment + + + +| Component |Version | +|----------------|--------------------------------| +|Operating System|Debian GNU/Linux 11 (bullseye)| +|LXD |5.0.0 | +|vagrant |2.2.19 | +|vagrant-lxd |0.5.6 | + + + +## Procedure + +Install all the software needed for the project, starting by updating the package repositories: + +``` +$ sudo apt update +``` + +The following packages are not strictly needed, but may make the following operations more agile, depending on the user tooling preferences. + +``` +$ sudo apt install vim tree +``` + +### Check the storage + +You should have a disk or unformatted partition, of 20GB or more, that we can use as LXD ZFS-based storage pool. If you don’t have any, you can use the directory storage backend and change your answers in section "LXD Configuration" below accordingly. + + +### LXD Installation + +LXD will be installed as a snap, and snap is not pre-installed in the system. So let's install snap first, then install the required snap `core`. + + +``` +$ sudo apt install snapd +``` + + +``` +$ sudo snap install core + +``` + + +Now you can install LXD using snap: + +``` +$ sudo snap install lxd --channel=5.0/stable +lxd 5.0.0-b0287c1 from Canonical✓ installed +``` + +Verify that LXD has been correctly installed: + +``` +$ snap list lxd +Name Version Rev Tracking Publisher Notes +lxd 5.0.0-b0287c1 22923 latest/stable canonical✓ - +``` + +### ZFS Utilities Installation + +--- + + +:memo: You can find more extensive ZFS setup instructions [here](https://linuxhint.com/install-zfs-debian/). + +--- + +Add the repository where the ZFS packages live: + +``` +$ sudo apt-add-repository contrib +``` + +Then install the package `zfsutils-linux`: + +``` +$ sudo apt update + +$ sudo apt install zfsutils-linux +``` + +You can check the the package has been successfully installed by running the following command: + +``` +$ sudo zpool --version +zfs-2.0.3-9 +zfs-kmod-2.0.3-9 +``` + +### Vagrant Installation + +Install `curl`: + +``` +$ sudo apt install curl +``` + +Get the Hashicorp signing key into the system (instructions taken from the official [Hashicorp Vagrant download page](https://www.vagrantup.com/downloads)): + +``` +$ sudo curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - +``` + +Add the official repository for `vagrant`: + +``` +$ sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" +$ sudo apt update +``` + + +Install the vagrant package: + +``` +$ sudo apt install vagrant + +``` + +Verify that it has been correctly installed: + +``` +$ vagrant --version +Vagrant 2.2.19 +``` + +### Vagrant LXD plugin Installation + +Vagrant plugins are installed by using the `plugin` switch, so let's install the `vagrant-lxd` plugin by issuing the following command: + +``` +$ vagrant plugin install vagrant-lxd +Installing the 'vagrant-lxd' plugin. This can take a few minutes... +Fetching thread_safe-0.3.6.gem +Fetching tzinfo-1.2.9.gem +Fetching minitest-5.15.0.gem +Fetching activesupport-5.2.7.gem +Fetching multipart-post-2.1.1.gem +Fetching faraday-0.17.5.gem +Fetching public_suffix-4.0.7.gem +Fetching addressable-2.8.0.gem +Fetching sawyer-0.9.1.gem +Fetching hyperkit-1.3.0.gem +Fetching vagrant-lxd-0.5.6.gem +Installed the plugin 'vagrant-lxd (0.5.6)'! +``` + +Verify the successful installation of the package with the following command: + +``` +$ vagrant plugin list +vagrant-lxd (0.5.6, global) +``` + +### nc-env Installation + +Pick the latest release of the project from [here](https://codeberg.org/pmarini/nc-env/releases), in this example `v20220421`: + +``` +$ wget https://codeberg.org/pmarini/nc-env/archive/v20220421.tar.gz +$ gzip -d v20220421.tar.gz +$ tar -xf v20220421.tar +$ cd nc-env/ +``` + +### Next steps + +Please refer to section "LXD Configuration" in guide How-To-Setup-Nc-Env-In-Ubuntu-Desktop-20.04 for the following steps