Install Openvswitch 2.3.0 LTS on CentOS7
I. Environment:
HOST: mac OS 10.10
Virtual Machine: virtualbox 4.3.20
Virtual Machine Operating System: CentOS7-1406
Openvswitch 2.3.0
Ii. Installation
1. install the dependency package: yum-y install openssl-devel wget kernel-devel
2. Install the Development tool: yum groupinstall "Development Tools"
3. Add a user: adduser ovswitch. Switch the user and jump to the user folder: su-ovswitch.
4, download source code: wget http://openvswitch.org/releases/openvswitch-2.3.0.tar.gz
5. Unzip: tar xfz openvswitch-2.3.0.tar.gz
6. Create a compilation Directory: mkdir-p ~ /Rpmbuild/SOURCES
7. Delete the dependency package of openvswitch-kmod from the spec file and create a new spec file:
Sed's/openvswitch-kmod, // G' openvswitch-2.3.0/rhel/openvswitch. spec> openvswitch-2.3.0/rhel/openvswitch_no_kmod.spec
8. Start Compilation: rpmbuild-bb -- without check ~ /Openvswitch-2.3.0/rhel/openvswitch_no_kmod.spec
The following error may occur:
Error: File/home/ovswitch/rpmbuild/SOURCES/openvswitch-2.3.0.tar.gz: No such file or directory
Solution: cp openvswitch-2.3.0.tar.gz rpmbuild/SOURCES
9. exit the current user using root: exit
10. Install the compiled rpm file:
Yum localinstall/home/ovswitch/rpmbuild/RPMS/x86_64/openvswitch-2.3.0-1.x86_64.rpm
11. start the service: systemctl start openvswitch. service
12. view the service status: systemctl-l status openvswitch. service
The following error may occur:
Openvswitch. service-LSB: Open vSwitch switch
Loaded: loaded (/etc/rc. d/init. d/openvswitch)
Active: activating (start) since 42014-12-04 18:35:32 CST; 1 min 30 s ago
Control: 13694 (openvswitch)
CGroup:/system. slice/openvswitch. service
Expose-13694/bin/sh/etc/rc. d/init. d/openvswitch start
Expose-13696/bin/sh/usr/share/openvswitch/scripts/ovs-ctl start -- system-id = random
California-13697 tee-a/var/log/openvswitch/ovs-ctl.log
Except-13723 ovs-vswitchd unix:/var/run/openvswitch/db. sock-vconsole: emer-vsyslog: err-vfile: info -- mlockall -- no-chdir -- log-file =/var/log/openvswitch/ovs-vswitchd.log -- pidfile =/var/run/openvswitch/ovs-vswitchd.pid -- detach -- monitor
Except-13724 ovs-vswitchd unix:/var/run/openvswitch/db. sock-vconsole: emer-vsyslog: err-vfile: info -- mlockall -- no-chdir -- log-file =/var/log/openvswitch/ovs-vswitchd.log -- pidfile =/var/run/openvswitch/ovs-vswitchd.pid -- detach -- monitor
Except-13725 ovs-vswitchd unix:/var/run/openvswitch/db. sock-vconsole: emer-vsyslog: err-vfile: info -- mlockall -- no-chdir -- log-file =/var/log/openvswitch/ovs-vswitchd.log -- pidfile =/var/run/openvswitch/ovs-vswitchd.pid -- detach -- monitor
December 04 18:35:33 localhost. localdomain openvswitch [13694]:/etc/openvswitch/conf. db does not exist... (warning ).
December 04 18:35:33 localhost. localdomain openvswitch [13694]: Creating empty database/etc/openvswitch/conf. db ovsdb-tool: I/O error:/etc/openvswitch/conf. db: failed to lock lockfile (Resource temporarily unavailable)
December 04 18:35:33 localhost. localdomain openvswitch [13694]: [FAILED]
December 04 18:35:33 localhost. localdomain openvswitch [13694]: Inserting openvswitch module [OK]
Solution:
Yum install policycoreutils-python.x86_64. 2.5-11. el7
Mkdir/etc/openvswitch
Semanage fcontext-a-t openvswitch_rw_t "/etc/openvswitch (/.*)? "
Restorecon-Rv/etc/openvswitch
Reuse:
Systemctl stop openvswitch. service
Systemctl start openvswitch. service
Check the service status again: systemctl-l status openvswitch. service
Openvswitch. service-LSB: Open vSwitch switch
Loaded: loaded (/etc/rc. d/init. d/openvswitch)
Active: active (running) since 42014-12-04 18:38:52 CST; 6 s ago
Process: 13741 ExecStart =/etc/rc. d/init. d/openvswitch start (code = exited, status = 0/SUCCESS)
CGroup:/system. slice/openvswitch. service
2017-13724 ovs-vswitchd: monitoring pid 13725 (healthy)
Except-13725 ovs-vswitchd unix:/var/run/openvswitch/db. sock-vconsole: emer-vsyslog: err-vfile: info -- mlockall -- no-chdir -- log-file =/var/log/openvswitch/ovs-vswitchd.log -- pidfile =/var/run/openvswitch/ovs-vswitchd.pid -- detach -- monitor
Listen-13764 ovsdb-server: monitoring pid 13765 (healthy)
Ipv── 13765 ovsdb-server/etc/openvswitch/conf. db-vconsole: emer-vsyslog: err-vfile: info -- remote = punix:/var/run/openvswitch/db. sock -- private-key = db: Open_vSwitch, SSL, private_key -- certificate = db: Open_vSwitch, SSL, certificate -- bootstrap-ca-cert = db: Open_vSwitch, SSL, ca_cert -- no-chdir -- log-file =/var/log/openvswitch/ovsdb-server.log -- pidfile =/var/run/openvswitch/ovsdb-server.pid -- detach -- monitor
December 04 18:38:51 localhost. localdomain systemd [1]: Starting LSB: Open vSwitch switch...
December 04 18:38:51 localhost. localdomain openvswitch [13741]:/etc/openvswitch/conf. db does not exist... (warning ).
December 04 18:38:51 localhost. localdomain openvswitch [13741]: Creating empty database/etc/openvswitch/conf. db [OK]
December 04 18:38:52 localhost. localdomain openvswitch [13741]: Starting ovsdb-server [OK]
December 04 18:38:52 localhost. localdomain openvswitch [13741]: Refreshing ing Open vSwitch system IDs [OK]
December 04 18:38:52 localhost. localdomain openvswitch [13741]: ovs-vswitchd is already running.
December 04 18:38:52 localhost. localdomain openvswitch [13741]: Enabling remote OVSDB managers [OK]
December 04 18:38:52 localhost. localdomain systemd [1]: Started LSB: Open vSwitch switch.
December 04 18:38:52 localhost. localdomain openvswitch [13694]: Starting ovs-vswitchd [OK]
December 04 18:38:52 localhost. localdomain openvswitch [13694]: Enabling remote OVSDB managers [OK]
Installation is complete.
Abstract hierarchical structure of ports in OpenvSwitch
Start and Stop the shell script after OpenvSwitch 2.1.2 is installed.