These are my notes for installing KVM on Centos 6.3 minimal.
====================================================================
# Install Centos 6.3 minimal x86_64 on a server## Disable selinuxsed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux## Set the hostnamevi /etc/sysconfig/networkHOSTNAME=whatevername## Install basic toolsyum -y install screen sudo wget mlocate ntpdate git links## (Optional) Install EPELwget http://mirror.chpc.utah.edu/pub/epel/6/x86_64/epel-release-6-7.noarch.rpmrpm -ivh epel-release-6-7.noarch.rpm## Update the systemyum -y update## Disable services not usedchkconfig fcoe offchkconfig ip6tables offchkconfig iscsi offchkconfig iscsid offchkconfig lldpad offchkconfig netfs offchkconfig rpcbind offchkconfig rpcgssd offchkconfig rpcidmapd offchkconfig nfslock off## Install virtualization groupsyum groupinstall Virtualization "Virtualization Client" "Virtualization Platform" "Virtualization Tools"## Install additional stuff neededyum install avahi gcc make libxml2-devel
gnutls-devel device-mapper-devel python-devel libnl-devel
dejavu-lgc-sans-fonts openssl-devel yajl-devel avahi-devel libssh2-devel
libcurl-devel kernel-devel## Remove ebtablesyum -y remove ebtables## Get and install libvirt sources (needed for openvswitch support)wget http://libvirt.org/sources/libvirt-0.10.1.tar.gztar zxvf libvirt-0.10.1.tar.gzcd libvirt-0.10.1./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etcmake; make install; ldconfig### (Optional) Setup unsecured access to libvirtdsed -i 's/#listen_tls = 0/listen_tls = 0/' /etc/libvirt/libvirtd.confsed -i 's/#auth_unix_rw = "none"/auth_unix_rw = "none"/' /etc/libvirt/libvirtd.conf## Start libvirtd serviceservice messagebus startservice avahi-daemon startservice libvirtd start## Set libvirtd to start on bootschkconfig libvirtd on## Disabled libvirt networkvirsh net-destroy defaultvirsh net-undefine default## Get and install openvswitchwget http://openvswitch.org/releases/openvswitch-1.7.1.tar.gztar zxvf openvswitch-1.7.1.tar.gzcd openvswitch-1.7.1./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --with-linux=/lib/modules/`uname -r`/build####
There seems to be an issue with skbuff.h, so here's what I do to get
around it, not 100% is this is right or what impact it might have, so
use at your own risksed -i 's/#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)/#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)/' datapath/linux/compat/include/linux/skbuff.h## Build and install openvswitchmake; make install; ldconfig## Build and install the kernel modules<code>make -C /usr/src/kernels/`uname -r` modules_install M=~/openvswitch-1.7.1/datapath/linux## Copy over sysconfig filescp rhel/etc_init.d_openvswitch /etc/init.d/openvswitchcp rhel/etc_logrotate.d_openvswitch /etc/logrotate.d/openvswitchcp rhel/etc_sysconfig_network-scripts_ifup-ovs /etc/sysconfig/network-scripts/ifup-ovscp rhel/etc_sysconfig_network-scripts_ifdown-ovs /etc/sysconfig/network-scripts/ifdown-ovscp rhel/usr_share_openvswitch_scripts_sysconfig.template /etc/sysconfig/openvswitch## Edit sysconfig file for BRCOMPATsed -i 's/# BRCOMPAT=yes/BRCOMPAT=yes/' /etc/sysconfig/openvswitch## Create bridge filevi /etc/sysconfig/network-scripts/ifcfg-ovsbr1DEVICE=ovsbr1ONBOOT=yesDEVICETYPE=ovsTYPE=OVSBridgeBOOTPROTO=staticIPADDR=10.0.0.1NETMASK=255.255.255.0HOTPLUG=no## Remove bridge modulermmod bridge## Blacklist the bridge moduleecho >> /etc/modprobe.d/blacklist.conf <# Bridge, using openvswitch insteadblacklist bridgeEOT## Start openvswitchservice openvswitch start### This next part is not needed if using OpenStack ##### (Optional) Add Iptables NAT and Rulesiptables -A POSTROUTING -o eth0 -j MASQUERADEiptables -A INPUT -i ovsbr1 -j ACCEPTiptables -A FORWARD -i ovsbr1 -j ACCEPT## Save iptables rulesservice iptables save## Edit the saved iptables file, remove the FORWARD REJECTvi /etc/sysconfig/iptables#-A FORWARD -j REJECT --reject-with icmp-host-prohibited## Restart iptablesservice iptables restart
沒有留言:
張貼留言