LXD (Linux Containers) for Nextcloud
LXD is a next generation system container manager. It offers a user experience similar to virtual machines but using Linux containers instead. LXD isn’t a rewrite of LXC, in fact it’s building on top of LXC to provide a new, better user experience. Under the hood, LXD uses LXC through liblxc and its Go binding to create and manage the containers. It’s basically an alternative to LXC’s tools and distribution template system with the added features that come from being controllable over the network.
And your are only four steps away from your LXD environment running your Nextcloud instance virtualized.
- First – install lxd on your Ubuntu OS
- Second – setup and configure LXD (LAN and storage)
- Third – create your Nextcloud container (Ubuntu 18.04)
- Fourth – launch the container and install Nextcloud using the shell script
(1) First install lxd on your Ubuntu OS
Update your environment and install lxd
apt update && apt upgrade -y && apt install lxd -y
Add your operating user to the lxd group
adduser <username> lxd
To apply these changes issue
or restart your ssh session. Verify your changes by issuing
as your normal user. Your users membership should consist of 999(lxd).
(2) Setup and configure LXD (LAN and storage)
(Optionally) You may install ZFS what offers more and quick options for creating snapshots and other features.
apt install zfsutils-linux -y
Configure your LXD
To operate with LXD as a normal user modify two files:
sudo vi /etc/subuid
sudo vi /etc/subgid
From now your LXD is configured properly and you can find e.g. Ubuntu images by issuing
lxc image list images: | grep -i ubuntu
(3) Create your Nextcloud container (Ubuntu 18.04)
To launch your first Ubuntu 18.04 container issue
lxc launch images:ubuntu/bionic/amd64 crieger
(4) Launch the container and install Nextcloud using the shell script
If created just connect to that container by issuing
lxc exec crieger bash
Finally build your Nextcloud server using my installer script.
apt install git -y
git clone https://github.com/riegercloud/install-nextcloud.git cd install-nextcloud
chmod +x *.sh
Wait a few minutes … fill in few parameters …
and you will enjoy your new Nextcloud (test-)environment
in your preferred Browser using the IP or DNS. It might become necessary to amend Nextclouds trusted urls by issuing
sudo -u www-data php /var/www/nextcloud/occ config:system:set trusted_domains 1 --value=<LXD Container-IP>
Enjoy your Nextcloud within your own LXD container.
Useful LXD things:
START: lxc start container-name
lxc start crieger
STOP: lxc stop container-name
lxc stop crieger
DELETE: lxc delete container-name
lxc delete crieger
INFORMATION: lxc info container-name
lxc info crieger
Find out more: here
Enjoy your personal data in your secured and hardened Nextcloud-Server!
Don’t forget to backup your Nextcloud
Find more instructions here: Nextcloud backup and restore