Lxc: Unterschied zwischen den Versionen

Aus Vosp.info
Wechseln zu:Navigation, Suche
(Installation eines Containers)
Zeile 69: Zeile 69:
 
lxc-attach -n ncphp73  
 
lxc-attach -n ncphp73  
  
 +
=== Konfiguration ===
 
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
 
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
 
apt-get update
 
apt-get update
Zeile 74: Zeile 75:
 
vim /etc/bash.bashrc  
 
vim /etc/bash.bashrc  
 
# bash-completion auskommentieren
 
# bash-completion auskommentieren
 +
</source>
 +
 +
=== Installation von Software ===
 +
<source lang="bash">
 +
apt-get install wget bash-completion zip unzip rsync
 +
 +
==== Ex-Kurs apache mit php 7.3 ====
 +
<source lang="bash">
 +
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
 +
</source>
 +
 +
===
 +
<source lang="bash">
 
</source>
 
</source>

Version vom 20. April 2019, 07:35 Uhr


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
apt-get update
apt-get install bash-completion
vim /etc/bash.bashrc 
# bash-completion auskommentieren

Installation von Software

apt-get install wget bash-completion zip unzip rsync

==== Ex-Kurs apache mit php 7.3 ====
<source lang="bash">
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

=