CentOS是目前企业里面用的相对较多的版本,随着技术的成熟,越来越多的用户选择使用docker环境。但是,如果直接在CentOS6.5中通过yum安装,安装完成后我无法启动docker服务的,因为Linux内核版本太低,我们需要先进行升级再安装。下面我们简单介绍一下具体的安装步骤:
1.查看当前版本
[root@localhost ~]# more /etc/issue
CentOS release 6.5 (Final)
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86\_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86\_64 x86\_64 x86\_64 GNU/Linux
2.升级内核
a.导入public key
rpm --import http://www.elrepo.org/RPM-GPG-KEY-elrepo.org
b,安装ELRepo到CentOS-6.5中
rpm -ivh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
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
4.编辑grub.conf文件,修改Grub引导顺序
vim /etc/grub.conf
\#grub.conf generated by anaconda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (4.4.121-1.el6.elrepo.x86\_64)
root (hd0,0)
kernel /vmlinuz-4.4.121-1.el6.elrepo.x86\_64 ro root=UUID=9955fe5f-5015-4582-a9d5-60fedd85d282 rd\_NO\_LUKS rd\_NO\_LVM LANG=zh\_CN.UTF-8 rd\_NO\_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd\_NO\_DM rhgb quiet
initrd /initramfs-4.4.121-1.el6.elrepo.x86\_64.img
title CentOS (2.6.32-431.el6.x86\_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-431.el6.x86\_64 ro root=UUID=9955fe5f-5015-4582-a9d5-60fedd85d282 rd\_NO\_LUKS rd\_NO\_LVM LANG=en\_US.UTF-8 rd\_NO\_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd\_NO\_DM rhgb quiet
initrd /initramfs-2.6.32-431.el6.x86\_64.img
确认刚安装好的内核在哪个位置,然后设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0。
5.重启,查看内核版本号.
[root@localhost ~]# reboot
[root@localhost ~]# uname -r
4.4.121-1.el6.elrepo.x86\_64
至此,CentOS6.5的内核升级完成,下面就可以安装docker了.

二.安装docker
直接使用命令: yum install docker-io是会报错的!!!
提示:No package docker-io available.
需要先安装yum 源.
yum -y install http://dl.fedoraproject.org/pub/epel/6/x86\_64/epel-release-6-8.noarch.rpm
再执行yum install docker-io
就可以正常安装了!!
启动docker
service docker start
查看docker版本:
[root@localhost ]# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64
查看docker日志.
cat /var/log/docker
至此,docker安装完成!!!
三.卸载docker
列出你安装过的包
[root@localhost ~]# yum list installed | grep docker
docker-io.x86\_64 1.7.1-2.el6 @epel
删除软件包
yum -y remove docker-io.x86\_64
(为了速度更快,建议修改使用国内源!)

标签: none

相关文章推荐

添加新评论,含*的栏目为必填