前一篇博客讲到了Centos6.5在线安装docker1.7的方式。由于docker官方推荐的内核版本是3.10以上,本文在上一篇基础上增加了升级内核的方法,然后再3.10内核基础上安装docker。
1. 安装EPEL
For CentOS-6.5, theDocker package is part of Extra Packages for EnterpriseLinux (EPEL) repository, a community effort to create and maintain additionalpackages for the RHEL distribution. Firstly, you need to ensure you have theEPEL repository enabled. Please follow theEPEL installation instructions.
1.1 安装yum优先级插件
# yum install yum-priorities
1.2 安装epel
# rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
1.3 查看是否安装成功
# rpm -q epel-release
1.4 导入key:
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
1.5 修改/etc/yum.repos.d/epel.repo文件,在[epel]最后添加一条属性 priority=11
# vi /etc/yum.repos.d/epel.repo
1.6 重建缓存
# yum makecache
安装完成之后,确保yum list能找到Docker的相关rpm包。
2. 升级内核
2.1 导入public key
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
2.2 安装ELRepo到CentOS-6.5中
# rpm -ivh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
这里可能会找不到,需改为
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
2.3 安装kernel-lt(lt=long-term)这个比较稳定,会持续更新,二选一。
# yum --enablerepo=elrepo-kernel install kernel-lt -y
可以装kernel-ml(ml=mainline)
# yum --enablerepo=elrepo-kernel install kernel-ml -y
2.4 修改Grub引导顺序
# vi /etc/grub.conf设置default=0
2.5 重启
2.6 uname -a检查
3. 安装docker
For CentOS-6, thereis a package name conflict with a system tray application and its executable,so the dockerRPM package was calleddocker-io.To proceed with docker-io installation on CentOS-6, you may need toremove thedocker package first. Next,let's install the docker-io package which willinstall Docker on our host.
3.1 remove docker
# yum remove docker
3.2 安装docker
# yum install docker-io
4.
更新
device-mapper-libs
# yum upgrade device-mapper-libs
5.
设置开机自启
# chkconfig docker on
6.
检查支持情况
# lxc-checkconfig
7.
启动cgroup
# service cgconfig start
8. 启动docker
# docker –d &
9.
测试
# docker ps -a