meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ubiquiti:controller [2020/07/20 16:33] – niziak | ubiquiti:controller [2021/03/20 21:41] (current) – niziak | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| * Works correctly only with host type networking = no network separation | * Works correctly only with host type networking = no network separation | ||
| - | ===== In unprivileged LXC ===== | ||
| - | ==== Preparation ==== | ||
| - | [[https://wiki.debian.org/LXC]] | + | ==== Install MongoDB < 4.0.0 ==== |
| + | [[https://docs.mongodb.com/ | ||
| <code bash> | <code bash> | ||
| - | apt-get install | + | apt install gnupg2 |
| + | wget -qO - https:// | ||
| + | echo "deb http:// | ||
| + | apt-get | ||
| + | sudo apt install | ||
| + | sudo systemctl start mongod | ||
| </ | </ | ||
| - | Create user: | + | ==== Installing |
| - | <code bash> | + | |
| - | <code bash> | + | |
| - | Find subuids and subgids for created user | + | Inside container: |
| - | <code bash> | + | |
| - | < | + | |
| - | / | + | |
| - | / | + | |
| - | </ | + | |
| - | + | ||
| - | Allow new user create network interfaces: | + | |
| - | <file | / | + | |
| - | lxcgitlab veth br-lan 10 | + | |
| - | </ | + | |
| - | [[https:// | + | |
| - | + | ||
| - | Now login as new user (using ssh or su). | + | |
| - | Create default lxc configureation in user directory: | + | |
| <code bash> | <code bash> | ||
| - | mkdir -p ~/.config/lxc | + | sudo apt-get update && sudo apt-get install ca-certificates apt-transport-https wget |
| - | cp /etc/lxc/default.conf ~/.config/lxc/default.conf | + | echo 'deb https://www.ui.com/downloads/ |
| - | </code> | + | sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/ |
| + | sudo apt update | ||
| + | sudo apt install unifi | ||
| - | Edit file below and put subuid and subgid: | ||
| - | <file | ~/ | ||
| - | lxc.include = / | ||
| - | |||
| - | lxc.idmap = u 0 1738400 65536 | ||
| - | lxc.idmap = g 0 1738400 65536 | ||
| - | |||
| - | # " | ||
| - | lxc.mount.auto = proc:mixed sys:ro cgroup: | ||
| - | |||
| - | lxc.net.0.type = veth | ||
| - | lxc.net.0.link = br-lan | ||
| - | lxc.net.0.flags = up | ||
| - | lxc.net.0.hwaddr = 00: | ||
| - | |||
| - | # Disable AppArmor confinement for containers started by non-root | ||
| - | # See https:// | ||
| - | # https:// | ||
| - | |||
| - | lxc.apparmor.profile = unconfined | ||
| - | # Unprivileged containers started by ROOT can use lxc.apparmor.profile = generated | ||
| - | |||
| - | / | ||
| - | / | ||
| - | </ | ||
| - | |||
| - | Create container: | ||
| - | <code bash> | ||
| - | * Distribution: | ||
| - | * Release: '' | ||
| - | * Architecture: | ||
| - | |||
| - | <code bash> | ||
| - | lxc-start -n unifi | ||
| - | lxc-ls -f | ||
| - | NAME STATE | ||
| - | unifi RUNNING 0 | ||
| </ | </ | ||
| + | Access running controller on: [[https://< | ||
| - | <code bash> | + | Unifi controller log location: |
| - | lxc-attach -n unifi | + | * '' |
| - | + | * '' | |
| - | apt install openssh-server | + | |
| - | < | + | |
| - | </ | + | |
| - | + | ||
| - | Add autostarting: | + | |
| - | <file ini ~/.local/share/lxc/unifi/config> | + | |
| - | lxc.start.auto = 1 | + | |
| - | lxc.start.delay = 5 | + | |
| - | lxc.start.order = 100 | + | |
| - | lxc.group = onboot | + | |
| - | </code> | + | |
| - | + | ||
| - | + | ||
| - | Edit cron <code bash> | + | |
| - | < | + | |
| - | @reboot lxc-autostart | + | |
| - | </file> | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | === Issues === | + | |
| - | + | ||
| - | === lxc-start: | + | |
| + | ==== Configure mail agent ==== | ||
| <code bash> | <code bash> | ||
| - | lxc-start -n unifi -l DEBUG -o debug.log | + | sudo apt-get install msmtp-mta |
| - | cat debug.log | + | |
| - | + | ||
| - | ... | + | |
| - | lxc-start unifi 20200720135645.187 ERROR start - start.c: | + | |
| - | ... | + | |
| - | + | ||
| - | sudo setfacl | + | |
| </ | </ | ||
| + | See how to configure: [[linux: | ||
| - | === Error: lxc-create: unifi: confile.c: set_config_net: | + | === adding own CA cert to controller |
| + | To send e-mails to own SMTP server with self-signed cert. | ||
| + | It is enough to add cert to Debian certifcate store and restart unifi controller. | ||
| - | LXC3 is using different config keys. Easiest way is to convert config file: | ||
| - | <code bash> | ||
| - | === lxc-create: unifi: conf.c: chown_mapped_root: | + | To add certificate directly to JVM store: |
| - | <code bash> | + | |
| - | sysctl kernel.unprivileged_userns_clone | + | |
| - | kernel.unprivileged_userns_clone = 0 | + | |
| - | + | ||
| - | sudo echo " | + | |
| - | sysctl -p | + | |
| - | </ | + | |
| - | ==== Install MongoDB ==== | + | [[https://stackoverflow.com/questions/373295/digital-certificate-how-to-import-cer-file-in-to-truststore-file-using|Digital Certificate: |
| - | [[https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-debian/]] | + | |
| - | For Debian Buster: | ||
| <code bash> | <code bash> | ||
| - | apt install gnupg | + | sudo cp cacert.crt |
| - | wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - | + | cd /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security |
| - | echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list | + | keytool -v -import |
| - | apt update | + | |
| - | sudo apt install mongodb-org | + | |
| </ | </ | ||
| - | DRAFT: | + | < |
| - | < | + | |
| - | apt install gnupg | + | |
| - | wget -qO - https:// | + | |
| - | echo "deb http:// | + | |
| - | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9ECBEC467F0CEB10 | + | |
| - | sudo apt update | + | |
| - | sudo apt install mongodb-org | + | |
| - | </ | + | |
| - | ==== Installing Unifi controller ==== | ||
| - | |||
| - | Inside container: | ||
| - | <code bash> | ||
| - | sudo apt-get update && sudo apt-get install ca-certificates apt-transport-https wget | ||
| - | echo 'deb https:// | ||
| - | sudo wget -O / | ||
| - | sudo apt update | ||
| - | sudo apt install unifi | ||
| - | |||
| - | </ | ||