Lxc: Unterschied zwischen den Versionen
Aus Vosp.info
V (Diskussion | Beiträge) (→LXC Notizen) |
F (Diskussion | Beiträge) |
||
Zeile 99: | Zeile 99: | ||
a2enmod ssl | a2enmod ssl | ||
systemctl restart apache2 | systemctl restart apache2 | ||
+ | |||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | == LXC Probleme == | ||
+ | |||
+ | === apache === | ||
+ | |||
+ | * Fehlermeldung | ||
+ | <source lang=bash> | ||
+ | systemctl status apache2.service | ||
+ | ● apache2.service - The Apache HTTP Server | ||
+ | Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) | ||
+ | Active: failed (Result: exit-code) since Wed 2019-12-18 14:58:03 UTC; 1min 19s ago | ||
+ | Docs: https://httpd.apache.org/docs/2.4/ | ||
+ | Process: 204 ExecStart=/usr/sbin/apachectl start (code=exited, status=226/NAMESPACE) | ||
+ | |||
+ | Dec 18 14:58:03 ancox systemd[1]: Starting The Apache HTTP Server... | ||
+ | Dec 18 14:58:03 ancox systemd[204]: apache2.service: Failed to set up mount namespacing: Perm | ||
+ | ission denied | ||
+ | Dec 18 14:58:03 ancox systemd[204]: apache2.service: Failed at step NAMESPACE spawning /usr/s | ||
+ | bin/apachectl: Permission denied | ||
+ | Dec 18 14:58:03 ancox systemd[1]: apache2.service: Control process exited, code=exited, statu | ||
+ | s=226/NAMESPACE | ||
+ | Dec 18 14:58:03 ancox systemd[1]: apache2.service: Failed with result 'exit-code'. | ||
+ | Dec 18 14:58:03 ancox systemd[1]: Failed to start The Apache HTTP Server. | ||
</source> | </source> |
Version vom 18. Dezember 2019, 15:00 Uhr
Inhaltsverzeichnis
LXC Notizen
Host Allgemein
Passwort im Container setzen
Passwörter können vom Host aus bequem mit chroot gesetzt werden
cd /var/lib/lxc/CONTAINER
chroot rootfs /bin/bash
passwd
Container Allgemein
Die Netzwerkeinstellungen und der Hostname des Containers können automatischüber die config erzeugt werden Im Container:
rm /etc/network/interfaces
rm /etc/hostname
In der Containerconfig:
vim /var/lib/lxc/CONTAINER/config
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0 # Unter Debian benutzen wir br0
lxc.network.hwaddr = XX:XX:XX:XX:XX:XX
lxc.network.ipv4 = XXX.XXX.XXX.XXX/32 # IP des Containers
lxc.network.ipv4.gateway = XXX.XXX.XXX.XXX # IP des Hosts
Host Debian
Host Ubuntu 14.04
Container mit Systemd starten
Anpassen der Config des Containers
Fehlermeldung verursacht von Apparmor:
Failed to mount cgroup at /sys/fs/cgroup/systemd: Permission denied
vim /var/lib/lxc/CONTAINER/config
lxc.kmsg = 0
lxc.aa_profile = unconfined
Installation eines Containers
cd /var/lib/lxc
lxc-create -t download -n ncphp73 -- --dist ubuntu --release bionic --arch amd64
cp /var/lib/lxc/ncphp73/config /var/lib/lxc/ncphp73/config.original20190418
vim /var/lib/lxc/ncphp73/config
lxc-ls -f
lxc-start -n ncphp73
lxc-ls -f
lxc-attach -n ncphp73
Konfiguration
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
vim /etc/bash.bashrc
# bash-completion auskommentieren
Installation von Software
apt-get update
apt-get install wget bash-completion zip unzip rsync openssh-server openssh-sftp-server
Ex-Kurs apache mit php 7.3
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
add-apt-repository ppa:ondrej/apache2
apt-get update
apt-get install php7.3 php7.3-cli php7.3-common
apt-get install imagemagick apache2 libapache2-mod-php7.3 php7.3-cli php7.3 php7.3-common php7.3-imap php7.3-intl php7.3-mysql php7.3-readline php7.3-soap php7.3-zip php7.3-zip php7.3-gd php7.3-xml php7.3-gd php7.3-json php7.3-opcache php-imagick php7.3-curl php7.3-mbstring php7.3-bcmath php7.3-gmp php7.3-zip composer php7.3-curl php7.3-dev php7.3-gd php7.3-mbstring php7.3-zip php7.3-mysql php7.3-xml php7.3-fpm libapache2-mod-php7.3 php7.3-imagick php7.3-recode php7.3-tidy php7.3-xmlrpc php7.3-intl mysql-server-5.7 phpmyadmin apache2-utils
Konfiguration von Software
a2enmod ssl
systemctl restart apache2
LXC Probleme
apache
- Fehlermeldung
systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-12-18 14:58:03 UTC; 1min 19s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 204 ExecStart=/usr/sbin/apachectl start (code=exited, status=226/NAMESPACE)
Dec 18 14:58:03 ancox systemd[1]: Starting The Apache HTTP Server...
Dec 18 14:58:03 ancox systemd[204]: apache2.service: Failed to set up mount namespacing: Perm
ission denied
Dec 18 14:58:03 ancox systemd[204]: apache2.service: Failed at step NAMESPACE spawning /usr/s
bin/apachectl: Permission denied
Dec 18 14:58:03 ancox systemd[1]: apache2.service: Control process exited, code=exited, statu
s=226/NAMESPACE
Dec 18 14:58:03 ancox systemd[1]: apache2.service: Failed with result 'exit-code'.
Dec 18 14:58:03 ancox systemd[1]: Failed to start The Apache HTTP Server.