virtualization

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

Install LXC (Linux Containers) under Ubuntu

Installation
http://www.panticz.de/install_lxc

Create container
export LANG=en_US.UTF-8
export CONTAINER=wheezy

sudo sudo lxc-destroy -n ${CONTAINER}
sudo lxc-create -t debian -n ${CONTAINER}
sudo lxc-start -d -n ${CONTAINER}

echo 'Acquire::http::Proxy "http://apt-cacher:3142/";' | sudo tee /var/lib/lxc/${CONTAINER}/rootfs/etc/apt/apt.conf

sudo lxc-attach -n ${CONTAINER} -- apt-get clean
sudo lxc-attach -n ${CONTAINER} -- apt-get update
sudo lxc-attach -n ${CONTAINER} -- apt-get dist-upgrade -y

Create Debian Squeeze DomU

wget https://raw.githubusercontent.com/panticz/xen/master/domains/debian.squeeze.sh -O - | bash -

#!/bin/bash

# configure domU
DOMAIN_NAME=squeeze
DOMAIN_MAC=00:09:01:01:aa:bb
DOMAIN_RAM=2Gb
DOMAIN_HDD=8Gb
 
# create domU on LVM (for image file use --dir=/root)
xen-create-image \
 --hostname=${DOMAIN_NAME} \
 --dist=squeeze \
 --lvm=vg0 \
 --size=${DOMAIN_HDD} \
 --fs=ext4 \
 --role=udev \
 --memory=${DOMAIN_RAM} \
 --swap=${DOMAIN_RAM} \
 --dhcp \
 --mac=${DOMAIN_MAC} \ 
 --genpass=0 \
 --password=t00r \
 --apt_proxy=http://apt-cacher:3142/ \
 --vcpus $(cat /proc/cpuinfo | grep processor | wc -l)
 
# rename vm config
mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME}
 
# OPTIONAL: add to autostart
ln -s /etc/xen/${DOMAIN_NAME} /etc/xen/auto
 
# start domU
xm create -c ${DOMAIN_NAME}

# disable pc speaker
echo 'blacklist snd-pcsp' >> /etc/modprobe.d/blacklist.conf

# check for updates
touch /etc/apt/apt.conf.d/10periodic
if [ $(cat /etc/apt/apt.conf.d/10periodic | grep -c Update-Package-Lists) -eq 0 ]; then
 echo 'APT::Periodic::Update-Package-Lists "1";' >> /etc/apt/apt.conf.d/10periodic
fi

# fix FQDN
sed -i "s|$(hostname) $(hostname)|$(hostname -A)$(hostname)|g" /etc/hosts
 
user: root
password: t00r

Install VirtualBox

wget https://raw.githubusercontent.com/panticz/installit/master/install.virtualbox.sh -O - | bash -

#!/bin/sh

if [ ! -z $1 ]; then
    USER=$1
fi

# install debconf-utils
sudo apt-get install debconf-utils

# add debconf answer
sudo debconf-set-selections <<\EOF
virtualbox virtualbox/group-vboxusers note
EOF

# add key
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

# install repository key
wget -q -O - http://www.virtualbox.org/download/oracle_vbox_2016.asc | apt-key add -

# update repository list
echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update -qq

# install
sudo apt-get install -y virtualbox-5.1

# install extension pack
VERSION=$(dpkg-query -W -f='${Version}' "virtualbox*" | cut -d "-" -f1)
wget http://download.virtualbox.org/virtualbox/${VERSION}/Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack -P /tmp/
sudo VBoxManage extpack install /tmp/Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack

# add current user to vboxusers group
sudo adduser ${USER} vboxusers

--allow-unauthenticated

Fix kernel module
sudo /etc/init.d/vboxdrv setup

Links
http://wiki.ubuntuusers.de/VirtualBox/Installation
http://www.virtualbox.org/wiki/Linux_Downloads
http://www.panticz.de/node/143

Create c't Debian Server installation USB pen (ctsrv4stick)

sudo su
 
DEVICE=/dev/sdb
VOLUME=ctsrv4stick
 
# mount usb
umount ${DEVICE}1
 
# create filesystem on usb pen
mkfs.vfat -n ${VOLUME} ${DEVICE}1
 
# mount usb
mount ${DEVICE}1 /mnt/
 
# install syslinux and make stick bootable
install-mbr ${DEVICE}
syslinux -f ${DEVICE}1
 
# unzip support files from ct dvd
unzip /media/ctsw0905/support/stickins.zip -d /mnt/
 
# create exclude list
cat <<EOF> /tmp/exclude.lst
/media/ctsw0905/bilder
/media/ctsw0905/html
/media/ctsw0905/scrshots
/media/ctsw0905/software
/media/ctsw0905/tools
/media/ctsw0905/video2brain
EOF
 
# create iso fro

TS

# set domU name
DOMAIN_NAME=ts34
 
# create domU
xen-create-image --hostname=${DOMAIN_NAME} --dhcp --mac=00:00:00:00:00:34 \
--lvm=vg01 --dist=jaunty --mirror=http://archive.ubuntu.com/ubuntu/ --size=10Gb --memory=512Mb --swap=512Mb
 
# rename config file
mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME}
 
# set root password
mount /dev/vg01/${DOMAIN_NAME}-disk /mnt/
chroot /mnt/
echo root:terceS | chpasswd
apt-get install udev
exit
umount /mnt/
 
# start domU
xm create -c ${DOMAIN_NAME}

Default Debian DomU

# configure domU
[ -z $DOMAIN_NAME ] && DOMAIN_NAME=lenny
[ -z $DOMAIN_MAC ] && DOMAIN_MAC=00:00:00:00:aa:bb
[ -z $DOMAIN_RAM ] && DOMAIN_RAM=512Mb
[ -z $DOMAIN_HDD ] && DOMAIN_HDD=4Gb
 
# create domU
xen-create-image --hostname=${DOMAIN_NAME} --dhcp --mac=${DOMAIN_MAC} \
--lvm=vg01 --dist=lenny --role=udev --size=${DOMAIN_HDD} --memory=${DOMAIN_RAM} --swap=${DOMAIN_RAM}
 
# rename vm config
mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME}
 
# post config domU
mount /dev/vg01/${DOMAIN_NAME}-disk /mnt/
sed -i 's|tty1|hvc0|g' /mnt/etc/inittab
chroot /mnt/ sh -c "echo root:terc

Magento domU

# set domU parameter
[ -z $DOMAIN_NAME ] && DOMAIN_NAME=magento
[ -z $DOMAIN_MAC ] && DOMAIN_MAC=00:EE:EE:EE:EE:EE
[ -z $DOMAIN_RAM ] && DOMAIN_RAM=4Gb
[ -z $DOMAIN_HDD ] && DOMAIN_HDD=16Gb
 
# create domU (Local)
http://www.panticz.de/DomU-Debian-Squeeze
 
# create domU (Hoster)
http://www.panticz.de/Hetzner
 
# install magento
http://www.panticz.de/install_magento
 
 
#
# OPTIONAL
#
# create separate www patition
lvcreate --name ${DOMAIN_NAME}-www --size 128G vg0
mkfs.ext3 /dev/vg0/${DOMAIN_NAME}-www
 
vi /etc/xen/${DOMAIN_NAME}
(add)
'phy:/dev/vg0/mrwww-www,sda3,w',
 
#

Asterisk DomU

http://www.panticz.de/DomU-Debian-Wheezy
 
# hide your ISDN card in dom0 and reboot dom0
# sed -i 's|tty0|tty0 pciback.hide=(04:02.0)|g' /boot/grub/menu.lst
# reboot
 
# in domU
passwd
 
# install lspci
apt-get install -y pciutils
 
# OPTIONAL: Diva Server 4BRI-8M 2.0 PCI
http://www.panticz.de/node/342
 
 
 
# apt-get install -y linux-headers-$(uname -r) dpkg-dev
 
 
 
 
apt-get source linux-image-$(uname -r)
 
#cd /usr/src/
#tar xzf linux_2.6.24.orig.tar.gz
#ln -s /usr/src/linux-2.6.24.2/ /usr/src/linux
ln -s /usr/src/linux-$(uname -r)/ /usr/src/linux
 
#mv /etc/apt/sources.li

Create Xen DomU Mailserver

# set domU parameter
[ -z $DOMAIN_NAME ] && DOMAIN_NAME=mx
[ -z $DOMAIN_MAC ] && DOMAIN_MAC=00:11:22:7E:7E:7E
[ -z $DOMAIN_RAM ] && DOMAIN_RAM=512Mb
[ -z $DOMAIN_HDD ] && DOMAIN_HDD=4Gb
 
# create domU
##http://www.panticz.de/Xen-domU-ubuntu-jaunty
http://www.panticz.de/DomU-Debian-Wheezy
 
# add to autostart (optional)
ln -s /etc/xen/${DOMAIN_NAME} /etc/xen/auto
 
# create lvm for home
lvcreate --name ${DOMAIN_NAME}-home --size 128G vg0
mkfs.ext4 /dev/vg0/${DOMAIN_NAME}-home
 
# configure domU
vi /etc/xen/${DOMAIN_NAME}
(add)
'phy:/dev/vg0/mx-home,sda3,w'
 
# post config dom

Fileserver (Samba and DHCP)

#!/bin/bash
 
# set domU name
DOMAIN_NAME=srv
 
# install vm
xen-create-image --hostname=$DOMAIN_NAME --dhcp --mac=00:11:cc:ab:cd:ef \
--lvm=vg01 --dist=jaunty --mirror=http://archive.ubuntu.com/ubuntu/ --size=4Gb --memory=1Gb --swap=1Gb
 
# rename config file
mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME}
 
# add to autostart
ln -s /etc/xen/${DOMAIN_NAME} /etc/xen/auto
 
# create lvm for home
lvcreate --name ${DOMAIN_NAME}-media --size 200G vg01
mkfs.ext3 /dev/vg01/${DOMAIN_NAME}-media
 
# configure domU
vi /etc/xen/${DOMAIN_NAME}
(add)
'phy:/dev/vg01/srv-media,xvda3,
Syndicate content