基本docker版本的更新,本次推出1.9.1版本的一键式安装方法:
从centos的yum安装我们就能看到1.9.1版本的docker更新了多个组件,所以在准备rpm资源时就需要准备得更充分了,以免因为缺少组件而中断安装;
1、准备iso文件:
将rpm包及sh脚本放在同一大目录中,使用UltrISO软件制作iso,名称可自定义;
此处我们按照UltrISO默认:得到 20151209_142011.iso
目录结构:以下有安装顺序,此处不讨论,有耐心的朋友可以按照rpm测试
/dockerstart.sh
/yzdocker/audit-libs-python-2.4.1-5.el7.x86_64.rpm
/yzdocker/checkpolicy-2.1.12-6.el7.x86_64.rpm
/yzdocker/libcgroup-0.41-8.el7.x86_64.rpm
/yzdocker/libcgroup-devel-0.41-8.el7.x86_64.rpm
/yzdocker/libcgroup-pam-0.41-8.el7.x86_64.rpm
/yzdocker/libcgroup-tools-0.41-8.el7.x86_64.rpm
/yzdocker/libsemanage-python-2.1.10-16.el7.x86_64.rpm
/yzdocker/net-tools-2.0-0.17.20131004git.el7.x86_64.rpm
/yzdocker/policycoreutils-python-2.2.5-15.el7.x86_64.rpm
/yzdocker/python-IPy-0.75-6.el7.noarch.rpm
/yzdocker/setools-libs-3.3.7-46.el7.x86_64.rpm
/yzdocker/docker-engine-1.9.1-1.el7.centos.x86_64.rpm
/yzdocker/docker-engine-selinux-1.9.1-1.el7.centos.noarch.rpm
rpm下载参考
docker:https://yum.dockerproject.org/repo/main/centos/7/Packages/
其它:http://mirrors.163.com/centos/7/os/x86_64/Packages/
2、编写dockerstart.sh脚本
#! /bin/bash date "+%Y%m%d %H:%M:%S" cd /mnt/cdrom/ cp -r /mnt/cdrom/yzdocker/ /tmp/yzdocker/ echo "Copy right,Start install..." cd /tmp/yzdocker/ ls rpm -ivh libcgroup-* audit-libs-python-2.4.1-5.el7.x86_64.rpm checkpolicy-2.1.12-6.el7.x86_64.rpm libsemanage-python-2.1.10-16.el7.x86_64.rpm python-IPy-0.75-6.el7.noarch.rpm setools-libs-3.3.7-46.el7.x86_64.rpm rpm -ivh policycoreutils-python-2.2.5-15.el7.x86_64.rpm docker-engine-selinux-1.9.1-1.el7.centos.noarch.rpm rpm -ivh docker-engine-1.9.1-1.el7.centos.x86_64.rpm service docker start docker -v
注:mount由一键式命令已经完成,此脚本即直接复制并自动化安装,最后启动docker服务并显示版本等!需使用UFT-8无BOM格式编写!
3、编写一键式安装命令:
光驱加载后需要执行如下操作:挂载、复制、给予执行权限、执行sh脚本,一键式命令如下:
与1.7.1不同的是我们直接在linux中编写sh脚本,无需去除'/r'
mkdir /mnt/cdrom;mount -t auto /dev/cdrom /mnt/cdrom;cd /mnt/cdrom/;cp startdocker.sh /tmp;cd /tmp;sh startdocker.sh
4、实践过程:以virtual box为例,以下简称vb
①、vb启动centos(默认最小化安装版本)
②、加载iso,vb中选择设备--分配光驱--虚拟盘,选择20151209_142011.iso,确定后即加载
③、Xshell登录centos7或在vb界面执行(Xshell可以复制命令,较为简便)
# mkdir /mnt/cdrom;mount -t auto /dev/cdrom /mnt/cdrom;cd /mnt/cdrom/;cp startdocker.sh /tmp;cd /tmp;sh startdocker.sh mount: /dev/sr0 is write-protected, mounting read-only 20151209 16:07:20 Start copy yzdocker server installation files...please wait 2-3 mibutes Copy right,Start install... ************************************************************************************************************************ audit-libs-python-2.4.1-5.el7.x86_64.rpm libcgroup-devel-0.41-8.el7.x86_64.rpm policycoreutils-python-2.2.5-15.el7.x86_64.rpm checkpolicy-2.1.12-6.el7.x86_64.rpm libcgroup-pam-0.41-8.el7.x86_64.rpm python-IPy-0.75-6.el7.noarch.rpm docker-engine-1.9.1-1.el7.centos.x86_64.rpm libcgroup-tools-0.41-8.el7.x86_64.rpm setools-libs-3.3.7-46.el7.x86_64.rpm docker-engine-selinux-1.9.1-1.el7.centos.noarch.rpm libsemanage-python-2.1.10-16.el7.x86_64.rpm tomcat.tar libcgroup-0.41-8.el7.x86_64.rpm net-tools-2.0-0.17.20131004git.el7.x86_64.rpm warning: libcgroup-0.41-8.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:libcgroup-0.41-8.el7 ################################# [ 11%] 2:libcgroup-devel-0.41-8.el7 ################################# [ 22%] 3:libcgroup-pam-0.41-8.el7 ################################# [ 33%] 4:libcgroup-tools-0.41-8.el7 ################################# [ 44%] 5:setools-libs-3.3.7-46.el7 ################################# [ 56%] 6:python-IPy-0.75-6.el7 ################################# [ 67%] 7:libsemanage-python-2.1.10-16.el7 ################################# [ 78%] 8:checkpolicy-2.1.12-6.el7 ################################# [ 89%] 9:audit-libs-python-2.4.1-5.el7 ################################# [100%] warning: policycoreutils-python-2.2.5-15.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY warning: docker-engine-selinux-1.9.1-1.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY Preparing... ################################# [100%] Updating / installing... 1:policycoreutils-python-2.2.5-15.e################################# [ 50%] 2:docker-engine-selinux-1.9.1-1.el7################################# [100%] warning: docker-engine-1.9.1-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY Preparing... ################################# [100%] Updating / installing... 1:docker-engine-1.9.1-1.el7.centos ################################# [100%] Redirecting to /bin/systemctl start docker.service Docker version 1.9.1, build a34a1d5
完美运行.
下一篇将介绍一键部署docker tomcat服务!