Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ***On the Host, perform the following to set up apparmor profile allowing NFS in an LXC***
- nano /etc/apparmor.d/lxc/lxc-default-with-nfs
- # Paste this all in the file
- # Do not load this file. Rather, load /etc/apparmor.d/lxc-containers, which
- # will source all profiles under /etc/apparmor.d/lxc
- profile lxc-container-default-with-nfs flags=(attach_disconnected,mediate_deleted) { #include <abstractions/lxc/container-base>
- # allow NFS (nfs/nfs4) mounts.
- mount fstype=nfs*,
- mount fstype=rpc_pipefs,
- }
- apparmor_parser -r /etc/apparmor.d/lxc-containers
- [Build container, privileged and NFS flags, Debian 12, specify network interface and IP]
- Add the following to LXC configuration file (nano /etc/pve/lxc/100.conf) to bind mount folder (if desired)
- lxc.mount.entry: /path/to/host/folder path/to/lxc/folder none bind 0 0
- lxc.apparmor.profile: lxc-container-default-with-nfs
- [start the LXC]
- ***Inside the LXC, perform the following***
- systmctl mask system-logind #only do this if there is a delay in the LXC after logging in
- apt update && apt upgrade
- apt install nfs-common nfs-kernel-server unattended-upgrades
- nano /etc/exports
- [update with folders you want to share]
- exportfs -rv
Advertisement
Add Comment
Please, Sign In to add comment