mkdir /zone1/dnshp/etc/yum.repos.d/ -p
cat /etc/yum.repos.d/CentOS-Base.repo |sed s/’$releasever’/7/g > /zone1/dnshp/etc/yum.repos.d/CentOS-Base.repo
yum groupinstall core –installroot=/zone1/dnshp –nogpgcheck -y
yum install plymouth libselinux-python bind –installroot=/zone1/dnshp –nogpgcheck -y
# yum install bind –installroot=/zone1/dnshp –nogpgcheck -y
chroot /zone1/dnshp
echo pw |passwd root –stdin
# login console
echo „pts/0“ >>/etc/securetty
sed -i s/“session required pam_selinux.so close“/“#session required pam_selinux.so close“/g /etc/pam.d/login
sed -i s/“session required pam_selinux.so open“/“#session required pam_selinux.so open“/g /etc/pam.d/login
sed -i s/“session required pam_loginuid.so“/“#session required pam_loginuid.so“/g /etc/pam.d/login
# login ssh
sed -i s/“session required pam_selinux.so close“/“#session required pam_selinux.so close“/g /etc/pam.d/sshd
sed -i s/“session required pam_loginuid.so“/“#session required pam_loginuid.so“/g /etc/pam.d/sshd
sed -i s/“session required pam_selinux.so open env_params“/“#session required pam_selinux.so open env_params“/g /etc/pam.d/sshd
cat > /etc/sysconfig/network << EOF
NETWORKING=yes
HOSTNAME=lxc.der-linux-admin.de
EOF
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
EOF
systemctl enable sshd
systemctl disable avahi-daemon
systemctl disable auditd
exit
yum install virt-install
yum install libvirt libvirt-client
yum install libvirt-daemon-lxc.x86_64 libvirt-daemon-driver-lxc.x86_64
systemctl enable libvirt-guests
systemctl enable libvirtd
systemctl start libvirt-guests
systemctl start libvirtd
LXC setzt ein aktiviertes SE-Linux vorraus. Wir können dies aber etwas vereinfachen
indem wir SE-Linux in dem permissive Modus versetzten.
Dazu die Datei /etc/selinux/config wie folgt abändern.
SELINUX=permissive
Anschliessen muss das System einmal neu gestartet werden!
virt-install –connect lxc:/// –name dnshp –ram 1024 –vcpu 1 -b br0 –filesystem /zone1/dnshp,/ –noautoconsole
virsh –connect lxc:/// console dnshp
# start
virsh –connect lxc:/// start dnshp
# stop
virsh –connect lxc:/// destroy dnshp
# löschen
virsh –connect lxc:/// undefine dnshp
brctl addbr br0
brctl addif br0 enp2s0f1