| #!/usr/bin/env python |
| # -*- coding: utf-8 -*- |
| |
| # Copyright 2017 Intel Research and Development Ireland Limited |
| # ************************************************************* |
| |
| # This file is part of OSM Monitoring module |
| # All Rights Reserved to Intel Corporation |
| |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| # not use this file except in compliance with the License. You may obtain |
| # a copy of the License at |
| |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations |
| # under the License. |
| |
| # For those usages not covered by the Apache License, Version 2.0 please |
| # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com |
| |
| #__author__ = "Prithiv Mohan" |
| #__date__ = "25/Sep/2017" |
| |
| import os |
| import subprocess |
| import urllib |
| packages = ['default-jre', 'python-all'] |
| for package in packages: |
| subprocess.call(['apt-get', 'install', '--yes', package]) |
| urllib.urlretrieve("http://www-eu.apache.org/dist/kafka/0.11.0.2/kafka_2.11-0.11.0.2.tgz", filename="kafka.tgz") |
| os.popen("mkdir /opt/kafka && tar -xf /root/kafka.tgz -C /opt/kafka --strip-components 1") |
| os.popen("sed -i 's|zookeeper.connect=localhost:2181|zookeeper.connect=SO-ub.lxd:2181 |g' /opt/kafka/config/server.properties") |
| os.popen("/opt/kafka/bin/kafka-server-start.sh kafka/config/server.properties &") |