在Centos6.5 安装Docker 安装Elasticsearch 6.3 一

由于公司需要安装Elasticsearch,为了安装方便就想到直接在Docker上安装了,在查询网上资料后,进行了安装,踩了比较多的坑,记录一下过程,由于原来网络上的资料比较旧,现根据自己的操作重新整理步骤

1.安装Docker

1、查看当前本机的内核,如果内核小于3.10 需要升级当前内核
$ uname -r
# 结果:2.6.32-431.el6.x86_64,不满足上文的需求,故此需要升级内核。
2、导入公钥数字证书
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
3、安装ELRepo到CentOS
rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
4、安装kernel长期版本
yum --enablerepo=elrepo-kernel install kernel-lt -y
5、编辑grub.conf文件,修改Grub引导顺序 确认刚安装好的内核在哪个位置,然后设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0。
vim /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.10.28-1.el6.elrepo.x86_64)
        root (hd0,0)
        kernel /boot/vmlinuz-3.10.28-1.el6.elrepo.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=en_US.UTF-8
 rd_NO_LVM rd_NO_DM rhgb quiet
        initrd /boot/initramfs-3.10.28-1.el6.elrepo.x86_64.img
title CentOS (2.6.32-431.3.1.el6.x86_64)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.32-431.3.1.el6.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=en_US.UTF-8 r
d_NO_LVM rd_NO_DM rhgb quiet
        initrd /boot/initramfs-2.6.32-431.3.1.el6.x86_64.img
title CentOS (2.6.32-431.el6.x86_64)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO
_LVM rd_NO_DM rhgb quiet
        initrd /boot/initramfs-2.6.32-431.el6.x86_64.img
6、重启,查看内核版本号
$ uname -r
3.10.28-1.el6.elrepo.x86_64
7、禁用selinux
vim /etc/selinux/config的内容
# 以下是/etc/selinux/config的内容
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled  # 将SELINUX设为disabled,注意修改后最好重启下机器。
8、安装 Fedora EPEL
$ yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
9、安装Docker
yum install -y docker-io
10、以守护模式运行Docker
$ docker -d
如果出现以下错误
docker: relocation error: docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
执行一下:yum upgrade device-mapper-libs
11、将Docker开机启动 后重启机器
$ chkconfig docker on
12、Docker的操作命令
启动命令:service docker start 
停止命令:service docker stop
重启命令:service docker restart 
13、配置Docker的国内镜像
vi /etc/sysconfig/docker
# /etc/sysconfig/docker
#
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker -d

other_args="--registry-mirror=http://hub-mirror.c.163.com"

OPTIONS="--registry-mirror=http://hub-mirror.c.163.com"

DOCKER_CERT_PATH=/etc/docker

# Resolves: rhbz#1176302 (docker issue #407)
DOCKER_NOWARN_KERNEL_VERSION=1

# Location used for temporary files, such as those created by
# # docker load and build operations. Default is /var/lib/docker/tmp
# # Can be overriden by setting the following environment variable.
# # DOCKER_TMPDIR=/var/tmp
重启 service docker restart 

你可能感兴趣的:(在Centos6.5 安装Docker 安装Elasticsearch 6.3 一)