代码语言:javascript复制
#!/bin/bash
#filename: install_docker.sh
#Description: Centos7下安装docker
#Usage: sudo sh install_docker.sh
#卸载原有版本
yum remove docker
docker-common
docker-selinux
docker-engine
#设置Docker的镜像仓库并从中进行安装(推荐使用从镜像仓库安装)
#安装所需的依赖包
yum install -y yum-utils
device-mapper-persistent-data
lvm2
yum-config-manager
--add-repo
https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum install docker-ce -y
systemctl start docker
echo "vm.max_map_count=262144" > /etc/sysctl.conf
sysctl -p
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.7.1
docker tag docker pull docker.elastic.co/elasticsearch/elasticsearch:6.7.1 es:6.7.1
docker run -d --name elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" es
docker pull docker.elastic.co/kibana/kibana:6.7.1
docker tag docker.elastic.co/kibana/kibana:6.7.1 kibana:6.7.1
docker run -it -d --name kibana -p 5601:5601 kibana:6.7.1
sed -i 's/"0"/"0.0.0.0"/g' `find /var/lib/ -name kibana.yml|grep merged`
sed -i 's/"elasticsearch"/"IP"/g' `find /var/lib/ -name kibana.yml|grep merged`