Thursday, January 17, 2013

Installing Openvswitch and KVM on CentOS 6.2


Please see the updated how-to on Installing OpenvSwitch on CentOS.
This is all (mostly) covered in the INSTALL.Linux inside the tar. This might help folks with some of the

Download the following tars and packages to resolve dependencies or packages not in the Yum repositories.
DL Openvswitch tar
$ wget http://openvswitch.org/releases/openvswitch-1.3.0.tar.gz
$ wget http://www.graphviz.org/pub/graphviz/stable/SRPMS/graphviz-2.28.0-1.src.rpm
$ wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/i386/os/webdot-2.26-1.el6.noarch.rpm
wget http://download.fedoraproject.org/pub/fedora/linux/releases/16/Everything/source/SRPMS/autoconf-2.68-2.fc15.src.rpm
$rpm -ivh graphviz-2.28.0-1.src.rpm
$rpm -ivh webdot-2.26-1.el6.noarch.rpm
$yum -y install graphviz-devel
$rpm -ivh webdot-2.26-1.el6.noarch.rpm
$yum -y install graphviz-tcl
$yum -y install python-zope-filesystem
$yum -y install python-zope-interface
$yum -y install automake
$yum -y install autoconf
add yum -y install openssl-devel this package is necessary if you use SSL with OpenVSWitch. (Thanks for input Marcos)
$yum –y install gcc
The Open vSwitch datapath requires bridging support
(CONFIG_BRIDGE) to be built as a kernel module.  (This is common
in kernels provided by Linux distributions.)  The bridge module
must not be loaded or in use.  If the bridge module is running
(check with “lsmod | grep bridge”), you must remove it (“rmmod
bridge”) before starting the datapath.
To build the Linux kernel module, so that you can run the
kernel-based switch, pass the location of the kernel build
directory on –with-linux.  For example, to build for a running
instance of Linux:
./configure –with-linux=/lib/modules/`uname -r`/build
$make
$make install
Load the built kernel module
insmod datapath/linux/openvswitch_mod.ko
insmod datapath/linux/brcompat_mod.ko
Verify the kernel mod loaded
[root@localhost openvswitch-1.3.0]# lsmod
openvswitch_mod        82086  0
If everything compiles and install create the sockets and db.
$mkdir -p /usr/local/etc/openvswitch
$ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
Start the configuration DB
$
ovsdb-server /usr/local/etc/openvswitch/conf.db
–remote=punix:/usr/local/var/run/openvswitch/db.sock
–remote=db:Open_vSwitch,manager_options
–private-key=db:SSL,private_key
–certificate=db:SSL,certificate
–bootstrap-ca-cert=db:SSL,ca_cert –pidfile –detach –log-file
Initialize the DB
$ovs-vsctl –no-wait init
Then start the main Open vSwitch daemon, telling it to connect to the
same Unix domain socket
$ovs-vswitchd –pidfile –detach
$sudo ovs-vswitchd –pidfile –log-file –detach -v
$ovs-vswitchd –pidfile –detach

$ifconfig eth0 0
$ifconfig br0 192.168.1.25 netmask 255.255.255.0 up
$ifconfig eth0 up
$ifconfig eth0 0.0.0.0
$sudo ovs-vsctl add-br br0
$sudo ovs-vsctl add-port br0 eth0
$route add default gw 192.168.1.1 br0
$route add default gw 192.168.1.1 br0
Looks at your empty but functional tables
ovsdb-client dump
Installing KVM
*Note* KVM is no longer supported on 32-bit HW.
KVM uses ‘tunctl’ to provision the bridging mechanisms. To install this on CentOS via a repository add the RPMforge repository which is not installed by default.
$wget rpmforge-release-0.5.2-2.el6.rf.i686.rpm
$rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Install DAG’s GPG key
Install and load tunctl (only if having issues. brcompat module should take care)
$yum –y install tunctl
$modprobe tun
$yum -y install qemu-kvm qemu-kvm-tools libvert
KVM GUI management tool
$yum –y install virt-manager
$yum install dejavu-lgc-sans-fonts
$Start the libvert daemon or reboot the system.
$ Service libvertd start
Start the KVM GUI
$ Virt-manager









No comments:

Post a Comment