欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

VMware虚拟机中Centos7安装VirtualBox和docker-machine

程序员文章站 2022-04-14 13:41:13
...

目的

学习docker-machine,安装Oracle VM VirtualBox。

安装环境

Windows10个人版,买小米游戏本自带的操作系统。
VMware Workstation Pro 12版本
Oracle VM VirtualBox 6.1.4
Centos7 8
能连接外部网络

大致步骤介绍记录

第一步:下载CentOS-7-x86_64-DVD-1810 .iso,官网下载,放在windows本地机器上。
第二步:在VMware上安装centos7操作系统,百度的步骤,选中模式为服务器UI模式,方便复制粘贴操作。
第三步:安装VirtualBox6.0。

参考网址:

https://blog.csdn.net/u014010342/article/details/89471345
https://www.jianshu.com/p/a40c07f9f456
https://wiki.centos.org/zh/HowTos/Virtualization/VirtualBox
https://www.cnblogs.com/sztom/p/9449226.html

不能一次安装成功。

踩坑综合总结:

1、内核版本必须一致,没有的使用yum install 安装 (截图保存)

内核升级,参考:

https://www.cnblogs.com/ding2016/p/10429640.html

按提示检查内核并安装

rpm -qa |grep kernel
yum install kernel-devel 
----注意是最新的版本,可能版本不一致,全部升级即可
----为了方便我使用了yum update操作
yum install kernel-headers
rpm -qa gcc
rpm -qa make
rpm -qa perl
rpm -qa |grep libelf
如果没有执行以下命令,例如:
yum install gcc
yum install elfutils-libelf-devel

VMware虚拟机中Centos7安装VirtualBox和docker-machine

[aaa@qq.com ~]# rpm -qa |grep kernel
kernel-tools-libs-3.10.0-1062.12.1.el7.x86_64
abrt-addon-kerneloops-2.1.11-52.el7.centos.x86_64
kernel-headers-3.10.0-1062.12.1.el7.x86_64
kernel-3.10.0-1062.12.1.el7.x86_64
kernel-devel-3.10.0-1062.12.1.el7.x86_64
kernel-debug-devel-3.10.0-1062.12.1.el7.x86_64
kernel-tools-3.10.0-1062.12.1.el7.x86_64
kernel-3.10.0-957.el7.x86_64
[aaa@qq.com ~]# rpm -qa |grep gcc
gcc-4.8.5-39.el7.x86_64
libgcc-4.8.5-39.el7.x86_64
[aaa@qq.com ~]# rpm -qa |grep make
make-3.82-23.el7.x86_64
[aaa@qq.com ~]# rpm -qa |grep libelf
elfutils-libelf-0.176-2.el7.x86_64
elfutils-libelf-devel-0.176-2.el7.x86_64
[aaa@qq.com ~]# uname -a
Linux localhost 3.10.0-1062.12.1.el7.x86_64 #1 SMP Tue Feb 4 23:02:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

升级内核后,一定要重启机器生效。
再次运行

/sbin/vboxconfig

显示结果

[aaa@qq.com ~]# /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.

VMware虚拟机中Centos7安装VirtualBox和docker-machine


64位虚拟操作配置
VMware虚拟机中Centos7安装VirtualBox和docker-machine


centos8下最后发现 没有elfutils-libelf-devel
下载rpm源文件 ,然后安装,下载地址
https://pkgs.org/download/elfutils-libelf-devel
安装版本:elfutils-libelf-devel-0.176-5.el8.x86_64.rpm
yum install elfutils-libelf-devel
最后使用docker-machine成功安装虚拟机。
https://www.jianshu.com/p/a40c07f9f456

[aaa@qq.com ~]# docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER    ERRORS
default   -        virtualbox   Stopped                 Unknown 

[aaa@qq.com ~]# docker-machine start default
Starting "default"...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
[aaa@qq.com ~]# docker-machine ssh default
   ( '>')
  /) TC (\   Core is distributed with ABSOLUTELY NO WARRANTY.
 (/-_--_-\)           www.tinycorelinux.net

aaa@qq.com:~$ uname
Linux
aaa@qq.com:~$ uname -a                                                     
Linux default 4.14.154-boot2docker #1 SMP Thu Nov 14 19:19:08 UTC 2019 x86_64 GNU/Linux
aaa@qq.com:~$                           

VMware虚拟机中Centos7安装VirtualBox和docker-machine
虚拟机图形界面管理信息
VMware虚拟机中Centos7安装VirtualBox和docker-machine

相关标签: 容器技术