This repository has been archived by the owner on Jan 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OVS-Install.sh
63 lines (63 loc) · 2.41 KB
/
OVS-Install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
echo -e " OVS installation script\n"
echo -e "-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"
echo -e "1) EPEL repository\n"
echo -e "2) EL repository\n"
echo -e "P.S.: EL may have new kernels for CentOS 7\n"
echo -n "Which one? : "
read Repo
case "$Repo" in
1)
yum install epel-release -y > /dev/null
trap 'echo Error at about $LINENO' ERR
echo -e "Done: EPEL repo\n"
2)
yum install epel-release -y > /dev/null
yum install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm -y > /dev/null
trap 'echo Error at about $LINENO' ERR
echo -e "Done: EL Repo\n"
echo -e "Installing devel tools:\n"
yum group install "Development Tools" -y > /dev/null
trap 'echo Error at about $LINENO' ERR
echo -e "Done: Devel Tools\n"
echo -e "Installing necesaary & optional [but recommended] Libs/packages:\n"
case "$Repo" in
1)
yum install openssl-devel libcap-ng python36 python36-pip unbound-libs unbound-devel kernel \
kernel-headers kernel-devel wget nc curl net-tools git > /dev/null
2)
yum install openssl-devel libcap-ng python36 python36-pip unbound-libs unbound-devel kernel-el \
kernel-el-headers kernel-el-devel wget nc curl net-tools git > /dev/null
trap 'echo Error at about $LINENO' ERR
python3.6 -m pip install pyftpdlib tftpy > /dev/null
trap 'echo Error at about $LINENO' ERR
cd /opt/
echo -e "Cloning OVS source code from Git:\n"
git clone https://github.com/openvswitch/ovs.git > /dev/null
trap 'echo Error at about $LINENO' ERR
cd ovs*
echo -e "Compile OVS codes\n"
./boot.sh > /dev/null
trap 'echo Error at about $LINENO' ERR
./configure > /dev/null
trap 'echo Error at about $LINENO' ERR
make > /dev/null
trap 'echo Error at about $LINENO' ERR
make install > /dev/null
trap 'echo Error at about $LINENO' ERR
config_file="/etc/depmod.d/openvswitch.conf"
for module in datapath/linux/*.ko; do
modname="$(basename ${module})"
echo "override ${modname%.ko} * extra" >> "$config_file"
echo "override ${modname%.ko} * weak-updates" >> "$config_file"
done
depmod -a
echo -e "Loading the kernel module :\n"
/sbin/modprobe openvswitch
trap 'echo Error at about $LINENO' ERR
echo -e "Testing loaded moduled:\n"
/sbin/lsmod | grep openvswitch
echo -e "Additional actions:\n"
export PATH=$PATH:/usr/local/share/openvswitch/scripts
ovs-ctl start
trap 'echo Error at about $LINENO' ERR
echo -e "OVS is read to use\nPleaseead the manual."