3 # Copyright (c) 2016-2017 Intel Corporation
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 INSTALL_NSB_BIN="/opt/nsb_bin"
20 if [ "$(whoami)" != "root" ]; then
21 echo "Must be root to run $0"
28 if [[ "$http_proxy" != "" ]]; then
29 export http_proxy=$http_proxy
30 export https_proxy=$http_proxy
33 if [[ "$https_proxy" != "" ]]; then
34 export https_proxy=$https_proxy
37 echo "Install required libraries to run collectd..."
38 pkg=(git flex bison build-essential pkg-config automake autotools-dev libltdl-dev librabbitmq-dev rabbitmq-server cmake)
39 for i in "${pkg[@]}"; do
40 dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed"
41 if [ "$?" -eq "1" ]; then
42 apt-get -y install "${i}";
47 ldconfig -p | grep libpqos >/dev/null
50 echo "Intel RDT library already installed. Done"
54 echo "Get intel_rdt repo and install..."
55 rm -rf intel-cmt-cat >/dev/null
56 git clone https://github.com/01org/intel-cmt-cat.git
58 make install PREFIX=/usr
65 ls /usr/lib/libdpdk.so >/dev/null
68 echo "DPDK already installed. Done"
72 echo "Get dpdk and install..."
73 mkdir -p $INSTALL_NSB_BIN
74 rm -rf "$INSTALL_NSB_BIN"/dpdk >/dev/null
75 git clone http://dpdk.org/git/dpdk
78 mount -t hugetlbfs nodev /mnt/huge
79 sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g' config/common_base
80 sed -i 's/CONFIG_RTE_EAL_PMD_PATH=""/CONFIG_RTE_EAL_PMD_PATH="\/usr\/lib\/dpdk-pmd\/"/g' config/common_base
82 echo "Build dpdk v16.04"
83 make config T=x86_64-native-linuxapp-gcc
85 sudo make install prefix=/usr
86 mkdir -p /usr/lib/dpdk-pmd
87 find /usr/lib -type f -name 'librte_pmd*' | while read path ; do ln -s $path /usr/lib/dpdk-pmd/`echo $path | grep -o 'librte_.*so'` ; done
90 echo 0 > /proc/sys/kernel/randomize_va_space
91 make install PREFIX=/usr
98 which $INSTALL_NSB_BIN/yajl > /dev/null
99 if [ -f "/usr/local/lib/libyajl.so.2.1.1" ]
101 echo "ovs stats libs already installed."
103 echo "installing ovs stats libraries"
107 git clone https://github.com/lloyd/yajl.git
117 which $INSTALL_NSB_BIN/collectd/collectd >/dev/null
120 echo "Collectd already installed. Done"
123 echo "Get collectd from repository and install..."
124 rm -rf collectd >/dev/null
125 git clone https://github.com/collectd/collectd.git
128 git checkout -n nfvi 47c86ace348a1d7a5352a83d10935209f89aa4f5
130 ./configure --with-libpqos=/usr/ --with-libdpdk=/usr --with-libyajl=/usr/local --enable-debug --enable-dpdkstat --enable-virt --enable-ovs_stats
131 make install > /dev/null
138 cp $INSTALL_NSB_BIN/collectd.conf /opt/collectd/etc/
140 echo "Check if admin user already created"
141 rabbitmqctl list_users | grep '^admin$' > /dev/null
144 echo "'admin' user already created..."
146 echo "Creating 'admin' user for collectd data export..."
147 rabbitmqctl delete_user guest
148 rabbitmqctl add_user admin admin
149 rabbitmqctl authenticate_user admin admin
150 rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"