X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=blueprints%2Fiotgateway%2Fscripts%2Fcommon_centos.sh;fp=blueprints%2Fiotgateway%2Fscripts%2Fcommon_centos.sh;h=1fb51b3af2102e2d84ddc3ed4d2d3bc6aa7f9efb;hb=f7a1ce6ba152e040f3c7122e32270645f605ebd2;hp=0000000000000000000000000000000000000000;hpb=a25e2c6b61cefe449f53a81e1a9f0b39a0a6208c;p=eliot.git diff --git a/blueprints/iotgateway/scripts/common_centos.sh b/blueprints/iotgateway/scripts/common_centos.sh new file mode 100755 index 0000000..1fb51b3 --- /dev/null +++ b/blueprints/iotgateway/scripts/common_centos.sh @@ -0,0 +1,65 @@ +#!/bin/bash -ex + +############################################################################## +# Copyright (c) 2019 Huawei Tech and others. # +# # +# All rights reserved. This program and the accompanying materials # +# are made available under the terms of the Apache License, Version 2.0 # +# which accompanies this distribution, and is available at # +# http://www.apache.org/licenses/LICENSE-2.0 # +############################################################################## + +# constants + +DOCKER_VERSION=18.09.6 +KUBE_VERSION=1.15.0-0 +MACHINE=$(uname -m) + +# start + +# This script will install docker, kubeadm on both Eliot Master and Edge nodes + +sudo sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' \ +/etc/sysconfig/selinux + +sudo modprobe br_netfilter +_conf='/etc/sysctl.d/99-akraino-eliot.conf' +echo 'net.bridge.bridge-nf-call-iptables = 1' |& sudo tee "${_conf}" +sudo sysctl -q -p "${_conf}" + +#echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables + +swapoff -a + +sudo yum install -y yum-utils device-mapper-persistent-data lvm2 + +sudo yum-config-manager \ +--add-repo https://download.docker.com/linux/centos/docker-ce.repo + +sudo yum install docker-ce-${DOCKER_VERSION} docker-ce-cli-${DOCKER_VERSION} \ +containerd.io + +# Kubernetes repository set + +cat <<-EOF | sudo tee /etc/yum.repos.d/kubernetes.repo +[kubernetes] +name=Kubernetes +baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-${MACHINE} +enabled=1 +gpgcheck=1 +repo_gpgcheck=1 +gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg + https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg +EOF + +# Set SELinux in permissive mode (effectively disabling it) +setenforce 0 +sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config + +yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes +systemctl enable --now kubelet + +sudo yum install -y kubeadm-${KUBE_VERSION} +sudo systemctl start docker && sudo systemctl enable docker + +sudo systemctl daemon-reload