User Tools

Site Tools


virtualization:openvz

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
virtualization:openvz [2012/08/25 14:25]
gcooper
virtualization:openvz [2012/08/31 14:46] (current)
gcooper
Line 1: Line 1:
 ====== OpenVZ Virtualization ====== ====== OpenVZ Virtualization ======
 +
 +http://wiki.openvz.org
 +
 +http://wiki.centos.org/HowTos/Virtualization/OpenVZ
  
 OpenVZ is a form of OS virtualization based on 'containers'. OpenVZ is a form of OS virtualization based on 'containers'.
Line 20: Line 24:
  
 ===== PBX ===== ===== PBX =====
 +
 +http://tutorialsbay.com/how-to-isntall-asterisk-freepbx-on-a-vps/
  
 See [[voice:pbx:piaf_virtual|PiaF]]. See [[voice:pbx:piaf_virtual|PiaF]].
  
 http://pve.proxmox.com/wiki/PBX_in_a_Flash http://pve.proxmox.com/wiki/PBX_in_a_Flash
 +
 +http://www.pbxinaflash.com/community/index.php?threads/best-timing-source.9084/
 +
 +http://www.cadvision.com/blanchas/Asterisk/ZaptelPerformanceTesting.html
 +
 +==== Firewall ====
 +
 +We run the firewall on the Host Node (HN).
 +
 +Stop all running VMs.
 +
 +<file>
 +sed -i 's|ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length|ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp|' /etc/vz/vz.conf
 +
 +/etc/init.d/vz restart
 +</file>
 +
 +==== DAHDI ====
 +
 +Sangoma USB hardware timing source (internal UT50 and external UT51): 
 +
 +http://sangoma.com/products/accessories/tools.html
 +
 +:!: Note that DAHDI will only work if the Host Node and the VE are the same $ARCH (32/32 or 64/64).
 +
 +:!: HPET or hardware timing source is important.
 +
 +Is HN kernel compiled with HPET and am I using it?
 +
 +<file>
 +grep HPET /boot/config-2.6.32-11-pve
 +
 +cat /sys/devices/system/clocksource/clocksource0/available_clocksource
 +
 +cat /sys/devices/system/clocksource/clocksource0/current_clocksource
 +</file>
 +
 +Change the current clock source, test then add to ''rc.local'':
 +
 +<file>
 +echo hpet > /sys/devices/system/clocksource/clocksource0/current_clocksource
 +</file>
 +
 +
 +See also 'res_timing_timerfd'.
 +
 +<file>
 +dmesg | grep dahdi
 +
 +dahdi_test
 +</file>
 +
 +Acceptable score: >99.975
 +
 +=== Make DAHDI Timing Available to CTs ===
 +
 +This assumes Asterisk is running as the user 'asterisk'.
 +
 +<file>
 +CTID=100
 +vzctl stop $CTID
 +vzctl set $CTID --devnodes dahdi/pseudo:rw --save
 +vzctl start $CTID
 +vzctl exec $CTID chown -R asterisk.asterisk /dev/dahdi /lib/udev/devices/dahdi
 +</file>
 +
 +=== Alternate Method? ===
 +
 +You can export devices from the Hardware Node (HN) to the container (CT) by using the devnodes flag.
 +
 +You may need a line like this in the /etc/vz/conf/VEID.conf for the Asterisk VE:
 +
 +<file>
 +DEVNODES="dahdi/pseudo:rw dahdi/ctl:rw dahdi/channel:rw dahdi/timer:rw "
 +</file>
  
 ===== Templates ===== ===== Templates =====
  
-OpenVZ containers are created from templates.  Since containers are not fully virtualized environments, there is no booting to CD/DVD drives or ISO images.+OpenVZ containers are created from templates.  Since containers are not fully virtualized environments.  There is no booting to CD/DVD drives or ISO images.
  
 ==== Creating Templates ==== ==== Creating Templates ====
  
-http://www.elastix.org/component/kunena/25-newbies-corner-/57615-elastix-20-and-openvz--proxmox-template.html+http://wiki.openvz.org/Physical_to_container
  
 http://www.powerpbx.org/content/are-you-sure-you-want-revert-revision-sat-12102011-1203 http://www.powerpbx.org/content/are-you-sure-you-want-revert-revision-sat-12102011-1203
Line 39: Line 120:
 ==== Create a FreePBX (Centos 5) Template on Proxmox ==== ==== Create a FreePBX (Centos 5) Template on Proxmox ====
  
-Install your Centos server and application to a physical machine.+  - Install your Centos server and application to a physical machine
 +  - Create a Centos 5 container using an existing Centos template and shut it down.
  
-Create a Centos 5 container using an existing Centos template and shut it down.+=== Physical Machine (Source) ===
  
-Log into the Proxmox host.+Clean out the YUM database and stop running applications: 
 + 
 +<file> 
 +yum clean all 
 + 
 +amportal stop 
 +service dnsmasq stop 
 +service httpd stop 
 +service mysqld stop 
 +</file> 
 + 
 +=== Proxmox Host ===
  
 <file> <file>
Line 52: Line 145:
 mkdir /var/lib/vz/private/$CTID mkdir /var/lib/vz/private/$CTID
  
-rsync -arvpz --exclude=/dev --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/tmp -e ssh root@xx.xx.xx.xx:/ /var/lib/vz/private/$CTID/+rsync -arvpz --exclude=/dev --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/tmp 
 +-e ssh root@xx.xx.xx.xx:/ /var/lib/vz/private/$CTID/
  
 sed -i -e 's/^[0-9].*getty.*tty/#&/g' /var/lib/vz/private/$CTID/etc/inittab sed -i -e 's/^[0-9].*getty.*tty/#&/g' /var/lib/vz/private/$CTID/etc/inittab
Line 74: Line 168:
 chroot . chroot .
  
-MAKEDEV -d /dev -x {p,t}ty{a,p}{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} console core full kmem kmsg mem null port ptmx random urandom zero ram0+MAKEDEV -d /dev -x {p,t}ty{a,p}{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} console core full kmem kmsg mem null 
 +port ptmx random urandom zero ram0
  
-MAKEDEV -d /etc/udev/devices -x {p,t}ty{a,p}{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} console core full kmem kmsg mem null port ptmx random urandom zero ram0+MAKEDEV -d /etc/udev/devices -x {p,t}ty{a,p}{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} console core full kmem 
 +kmsg mem null port ptmx random urandom zero ram0
  
 chmod 1777 /tmp chmod 1777 /tmp
 chmod 1777 /var/tmp chmod 1777 /var/tmp
 +
 +# Disable any physical NICs by modifying the etc/sysconfig/network-scripts/ifcfg-ethX files
 +# (where X is the interface number starting from 0) and setting ONBOOT to no.
  
 vi /etc/sysconfig/network-scripts/ifcfg-eth0 vi /etc/sysconfig/network-scripts/ifcfg-eth0
  
 ONBOOT=no ONBOOT=no
 +
 +vi /etc/sysconfig/network
 +
 +NETWORKING_IPV6="no"
 +
 +vim /etc/rc.d/rc.sysinit
 +
 +#/sbin/start_udev
 +
 +vi /etc/sysconfig/init
 +
 +PROMPT=no
 +
 +vi /etc/sysconfig/selinux
 +
 +SELINUX=disabled
  
 # For RHEL 6 and clone distributions, you must comment out "console" in /vz/private/$CTID/etc/init/rc.conf # For RHEL 6 and clone distributions, you must comment out "console" in /vz/private/$CTID/etc/init/rc.conf
Line 91: Line 206:
 # #
 # If you do not the container will not boot up. # If you do not the container will not boot up.
- 
-# Change 'el5' to 'el6' for EL6 repos 
  
 cat << EOF >> /etc/yum.repos.d/vz.repo cat << EOF >> /etc/yum.repos.d/vz.repo
Line 98: Line 211:
 name=vz-base name=vz-base
 mirrorlist=http://vzdownload.swsoft.com/download/mirrors/redhat-el5 mirrorlist=http://vzdownload.swsoft.com/download/mirrors/redhat-el5
 +#mirrorlist=http://vzdownload.swsoft.com/download/mirrors/redhat-el6
 gpgcheck=0  gpgcheck=0 
  
Line 103: Line 217:
 name=vz-updates name=vz-updates
 mirrorlist=http://vzdownload.swsoft.com/download/mirrors/updates-released-rhel5 mirrorlist=http://vzdownload.swsoft.com/download/mirrors/updates-released-rhel5
 +#mirrorlist=http://vzdownload.swsoft.com/download/mirrors/updates-released-rhel6
 gpgcheck=0 gpgcheck=0
 EOF EOF
 +
 +cat >> ~/.bash_profile << EOF
 +
 +alias ll='ls -l'
 +alias la='ls -A'
 +alias l='ls -CF'
 +alias ls="BLOCK_SIZE=\'1 ls --color=auto"
 +alias free="free -m"
 +export GREP_OPTIONS='--color=auto'
 +PS1='\[\033[00;36m\]\u\[\033[00m\]@\h:\[\033[05;33m\]\w\[\033[00m\] \$ '
 +export HISTCONTROL=ignoredups
 +EOF
 +
 +mkdir /var/lock/rpm
 +
 +echo "
 +# IPv6
 +blacklist ipv6
 +blacklist net-pf-10" >> /etc/modprobe.d/blacklist.conf
 +
  
 exit # from chroot exit # from chroot
 +
 +
 +vzctl start $CTID
 +vzctl enter $CTID
 +
 +# For services info, see http://wiki.openvz.org/Physical_to_container
 +
 +chkconfig --list | grep :on
 +
 +for i in acpid apmd auditd bluetooth clock cupsd consolefont cpuspeed dnsmasq gpm hdparm iptables ip6tables isdn \
 +irqbalance kudzu lm_sensors lvm2-monitor mcstrans mdmonitor microcode_ctl netfs netplugd smartd netfs nfslock ntpd \
 +openibd pcmcia portmap postfix restorecond rpcidmapd rpcgssd sendmail wanrouter xfs; do chkconfig $i off; done
 +
 +
 +
 </file> </file>
  
  
 +Using ''tar'' instead of ''rsync'':
  
 +<file>
 +vim /etc/exclude
 +
 +.bash_history 
 +lost+found 
 +/dev/
 +/mnt/
 +/tmp/
 +/proc/
 +/sys/
 +/usr/src/*
 +</file>
 +
 +<file>
 +tar --numeric-owner -czvf /tmp/centos-5.0-x86_64-FreePBX-image.tar.gz -X /tmp/exclude /
 +
 +scp /tmp/centos-5.0-x86_64-FreePBX-image.tar.gz root@192.168.1.30:/var/lib/vz/template/cache/
 +</file>
  
  
virtualization/openvz.1345926344.txt.gz · Last modified: 2012/08/25 14:25 by gcooper