centos7.5安装minikube时要求先安装VirtualBox
1.准备repo文件
[root@localhost yum.repos.d]# pwd /etc/yum.repos.d [root@localhost yum.repos.d]# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo --2019-03-27 14:37:47-- http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo Resolving download.virtualbox.org (download.virtualbox.org)... 104.85.68.249 Connecting to download.virtualbox.org (download.virtualbox.org)|104.85.68.249|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 259 [text/plain] Saving to: ‘virtualbox.repo’ 100%[==================================================================================================================================>] 259 --.-K/s in 0s 2019-03-27 14:37:47 (33.8 MB/s) - ‘virtualbox.repo’ saved [259/259] [root@localhost yum.repos.d]# ll total 40 -rw-r--r--. 1 root root 1664 Nov 23 21:16 CentOS-Base.repo -rw-r--r--. 1 root root 1309 Nov 23 21:16 CentOS-CR.repo -rw-r--r--. 1 root root 649 Nov 23 21:16 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 Nov 23 21:16 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 Nov 23 21:16 CentOS-Media.repo -rw-r--r--. 1 root root 1331 Nov 23 21:16 CentOS-Sources.repo -rw-r--r--. 1 root root 5701 Nov 23 21:16 CentOS-Vault.repo -rw-r--r--. 1 root root 279 Mar 27 11:03 kubernetes.repo -rw-r--r--. 1 root root 259 Sep 30 2015 virtualbox.repo
2.查看virtualbox.repo
[root@localhost yum.repos.d]# cat virtualbox.repo [virtualbox] name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc [root@localhost yum.repos.d]#
3.安装VirtualBox
安装失败,并要求先安装gcc kernel
[root@localhost yum.repos.d]# yum install VirtualBox-5.1 Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cqu.edu.cn * extras: mirrors.nwsuaf.edu.cn * updates: mirrors.cqu.edu.cn base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 kubernetes | 1.4 kB 00:00:00 updates | 3.4 kB 00:00:00 virtualbox/7/x86_64/signature | 181 B 00:00:00 Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc Importing GPG key 0x98AB5139: Userid : "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>" Fingerprint: 7b0f ab3a 13b9 0743 5925 d9c9 5442 2a4b 98ab 5139 From : https://www.virtualbox.org/download/oracle_vbox.asc Is this ok [y/N]: y virtualbox/7/x86_64/signature | 2.9 kB 00:00:05 !!! virtualbox/7/x86_64/primary_db | 121 kB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package VirtualBox-5.1.x86_64 0:5.1.38_122592_el7-1 will be installed --> Processing Dependency: libSDL-1.2.so.0()(64bit) for package: VirtualBox-5.1-5.1.38_122592_el7-1.x86_64 --> Running transaction check ---> Package SDL.x86_64 0:1.2.15-14.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: VirtualBox-5.1 x86_64 5.1.38_122592_el7-1 virtualbox 76 M Installing for dependencies: SDL x86_64 1.2.15-14.el7 base 204 k Transaction Summary ============================================================================================================================================================================ Install 1 Package (+1 Dependent package) Total download size: 76 M Installed size: 171 M Is this ok [y/d/N]: y Downloading packages: (1/2): SDL-1.2.15-14.el7.x86_64.rpm | 204 kB 00:00:00 warning: /var/cache/yum/x86_64/7/virtualbox/packages/VirtualBox-5.1-5.1.38_122592_el7-1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 98ab5139: NOKEY76 MB 00:00:00 ETA Public key for VirtualBox-5.1-5.1.38_122592_el7-1.x86_64.rpm is not installed (2/2): VirtualBox-5.1-5.1.38_122592_el7-1.x86_64.rpm | 76 MB 00:02:12 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 585 kB/s | 76 MB 00:02:12 Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc Importing GPG key 0x98AB5139: Userid : "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>" Fingerprint: 7b0f ab3a 13b9 0743 5925 d9c9 5442 2a4b 98ab 5139 From : https://www.virtualbox.org/download/oracle_vbox.asc Is this ok [y/N]: y Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : SDL-1.2.15-14.el7.x86_64 1/2 Installing : VirtualBox-5.1-5.1.38_122592_el7-1.x86_64 2/2 Creating group 'vboxusers'. VM users must be member of that group! vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong. ####安装失败 This system is not currently set up to build kernel modules (system extensions). Running the following commands should set the system up correctly: yum install gcc make ####要求先安装gcc yum install kernel-devel-3.10.0-957.el7.x86_64 ####要求先安装kernel (The last command may fail if your system is not fully updated.) yum install kernel-devel There were problems setting up VirtualBox. To re-start the set-up process, run /sbin/vboxconfig as root. Verifying : SDL-1.2.15-14.el7.x86_64 1/2 Verifying : VirtualBox-5.1-5.1.38_122592_el7-1.x86_64 2/2 Installed: VirtualBox-5.1.x86_64 0:5.1.38_122592_el7-1 Dependency Installed: SDL.x86_64 0:1.2.15-14.el7 Complete!
安装GCC
[root@localhost log]# yum install gcc make Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cqu.edu.cn * extras: mirrors.nwsuaf.edu.cn * updates: mirrors.cqu.edu.cn Package 1:make-3.82-23.el7.x86_64 already installed and latest version Resolving Dependencies --> Running transaction check ---> Package gcc.x86_64 0:4.8.5-36.el7_6.1 will be installed --> Processing Dependency: libgomp = 4.8.5-36.el7_6.1 for package: gcc-4.8.5-36.el7_6.1.x86_64 --> Processing Dependency: cpp = 4.8.5-36.el7_6.1 for package: gcc-4.8.5-36.el7_6.1.x86_64 --> Processing Dependency: libgcc >= 4.8.5-36.el7_6.1 for package: gcc-4.8.5-36.el7_6.1.x86_64 --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-36.el7_6.1.x86_64 --> Running transaction check ---> Package cpp.x86_64 0:4.8.5-36.el7_6.1 will be installed ---> Package glibc-devel.x86_64 0:2.17-260.el7_6.3 will be installed --> Processing Dependency: glibc-headers = 2.17-260.el7_6.3 for package: glibc-devel-2.17-260.el7_6.3.x86_64 --> Processing Dependency: glibc = 2.17-260.el7_6.3 for package: glibc-devel-2.17-260.el7_6.3.x86_64 --> Processing Dependency: glibc-headers for package: glibc-devel-2.17-260.el7_6.3.x86_64 ---> Package libgcc.x86_64 0:4.8.5-36.el7 will be updated ---> Package libgcc.x86_64 0:4.8.5-36.el7_6.1 will be an update ---> Package libgomp.x86_64 0:4.8.5-36.el7 will be updated ---> Package libgomp.x86_64 0:4.8.5-36.el7_6.1 will be an update --> Running transaction check ---> Package glibc.x86_64 0:2.17-260.el7 will be updated --> Processing Dependency: glibc = 2.17-260.el7 for package: glibc-common-2.17-260.el7.x86_64 ---> Package glibc.x86_64 0:2.17-260.el7_6.3 will be an update ---> Package glibc-headers.x86_64 0:2.17-260.el7_6.3 will be installed --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-260.el7_6.3.x86_64 --> Processing Dependency: kernel-headers for package: glibc-headers-2.17-260.el7_6.3.x86_64 --> Running transaction check ---> Package glibc-common.x86_64 0:2.17-260.el7 will be updated ---> Package glibc-common.x86_64 0:2.17-260.el7_6.3 will be an update ---> Package kernel-headers.x86_64 0:3.10.0-957.10.1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: gcc x86_64 4.8.5-36.el7_6.1 updates 16 M Installing for dependencies: cpp x86_64 4.8.5-36.el7_6.1 updates 5.9 M glibc-devel x86_64 2.17-260.el7_6.3 updates 1.1 M glibc-headers x86_64 2.17-260.el7_6.3 updates 683 k kernel-headers x86_64 3.10.0-957.10.1.el7 updates 8.0 M Updating for dependencies: glibc x86_64 2.17-260.el7_6.3 updates 3.7 M glibc-common x86_64 2.17-260.el7_6.3 updates 12 M libgcc x86_64 4.8.5-36.el7_6.1 updates 102 k libgomp x86_64 4.8.5-36.el7_6.1 updates 157 k Transaction Summary ============================================================================================================================================================================ Install 1 Package (+4 Dependent packages) Upgrade ( 4 Dependent packages) Total size: 47 M Total download size: 32 M Is this ok [y/d/N]: y Downloading packages: (1/5): glibc-headers-2.17-260.el7_6.3.x86_64.rpm | 683 kB 00:00:01 (2/5): glibc-devel-2.17-260.el7_6.3.x86_64.rpm | 1.1 MB 00:00:05 (3/5): cpp-4.8.5-36.el7_6.1.x86_64.rpm | 5.9 MB 00:00:13 (4/5): kernel-headers-3.10.0-957.10.1.el7.x86_64.rpm | 8.0 MB 00:00:17 (5/5): gcc-4.8.5-36.el7_6.1.x86_64.rpm | 16 MB 00:00:21 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 1.5 MB/s | 32 MB 00:00:21 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : libgcc-4.8.5-36.el7_6.1.x86_64 1/13 Updating : glibc-common-2.17-260.el7_6.3.x86_64 2/13 Updating : glibc-2.17-260.el7_6.3.x86_64 3/13 Updating : libgomp-4.8.5-36.el7_6.1.x86_64 4/13 Installing : cpp-4.8.5-36.el7_6.1.x86_64 5/13 Installing : kernel-headers-3.10.0-957.10.1.el7.x86_64 6/13 Installing : glibc-headers-2.17-260.el7_6.3.x86_64 7/13 Installing : glibc-devel-2.17-260.el7_6.3.x86_64 8/13 Installing : gcc-4.8.5-36.el7_6.1.x86_64 9/13 Cleanup : libgomp-4.8.5-36.el7.x86_64 10/13 Cleanup : glibc-common-2.17-260.el7.x86_64 11/13 Cleanup : glibc-2.17-260.el7.x86_64 12/13 Cleanup : libgcc-4.8.5-36.el7.x86_64 13/13 Verifying : glibc-devel-2.17-260.el7_6.3.x86_64 1/13 Verifying : gcc-4.8.5-36.el7_6.1.x86_64 2/13 Verifying : glibc-2.17-260.el7_6.3.x86_64 3/13 Verifying : glibc-common-2.17-260.el7_6.3.x86_64 4/13 Verifying : kernel-headers-3.10.0-957.10.1.el7.x86_64 5/13 Verifying : libgomp-4.8.5-36.el7_6.1.x86_64 6/13 Verifying : libgcc-4.8.5-36.el7_6.1.x86_64 7/13 Verifying : cpp-4.8.5-36.el7_6.1.x86_64 8/13 Verifying : glibc-headers-2.17-260.el7_6.3.x86_64 9/13 Verifying : glibc-2.17-260.el7.x86_64 10/13 Verifying : libgomp-4.8.5-36.el7.x86_64 11/13 Verifying : glibc-common-2.17-260.el7.x86_64 12/13 Verifying : libgcc-4.8.5-36.el7.x86_64 13/13 Installed: gcc.x86_64 0:4.8.5-36.el7_6.1 Dependency Installed: cpp.x86_64 0:4.8.5-36.el7_6.1 glibc-devel.x86_64 0:2.17-260.el7_6.3 glibc-headers.x86_64 0:2.17-260.el7_6.3 kernel-headers.x86_64 0:3.10.0-957.10.1.el7 Dependency Updated: glibc.x86_64 0:2.17-260.el7_6.3 glibc-common.x86_64 0:2.17-260.el7_6.3 libgcc.x86_64 0:4.8.5-36.el7_6.1 libgomp.x86_64 0:4.8.5-36.el7_6.1 Complete! [root@localhost log]#
安装kernel
[root@localhost log]# yum install kernel-devel-3.10.0-957.el7.x86_64 Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cqu.edu.cn * extras: mirrors.nwsuaf.edu.cn * updates: mirrors.cqu.edu.cn Resolving Dependencies --> Running transaction check ---> Package kernel-devel.x86_64 0:3.10.0-957.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: kernel-devel x86_64 3.10.0-957.el7 base 17 M Transaction Summary ============================================================================================================================================================================ Install 1 Package Total download size: 17 M Installed size: 37 M Is this ok [y/d/N]: y Downloading packages: No Presto metadata available for base kernel-devel-3.10.0-957.el7.x86_64.rpm | 17 MB 00:00:12 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : kernel-devel-3.10.0-957.el7.x86_64 1/1 Verifying : kernel-devel-3.10.0-957.el7.x86_64 1/1 Installed: kernel-devel.x86_64 0:3.10.0-957.el7 Complete!
[root@localhost log]# uname -r
3.10.0-957.el7.x86_64
删除并重新安装
[root@localhost log]# yum remove VirtualBox-5.1 Loaded plugins: fastestmirror, langpacks Resolving Dependencies --> Running transaction check ---> Package VirtualBox-5.1.x86_64 0:5.1.38_122592_el7-1 will be erased --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Removing: VirtualBox-5.1 x86_64 5.1.38_122592_el7-1 @virtualbox 170 M Transaction Summary ============================================================================================================================================================================ Remove 1 Package Installed size: 170 M Is this ok [y/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : VirtualBox-5.1-5.1.38_122592_el7-1.x86_64 1/1 Verifying : VirtualBox-5.1-5.1.38_122592_el7-1.x86_64 1/1 Removed: VirtualBox-5.1.x86_64 0:5.1.38_122592_el7-1 Complete! [root@localhost log]# yum install VirtualBox-5.1 Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cqu.edu.cn * extras: mirrors.nwsuaf.edu.cn * updates: mirrors.cqu.edu.cn Resolving Dependencies --> Running transaction check ---> Package VirtualBox-5.1.x86_64 0:5.1.38_122592_el7-1 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: VirtualBox-5.1 x86_64 5.1.38_122592_el7-1 virtualbox 76 M Transaction Summary ============================================================================================================================================================================ Install 1 Package Total download size: 76 M Installed size: 170 M Is this ok [y/d/N]: y Downloading packages: VirtualBox-5.1-5.1.38_122592_el7-1.x86_64.rpm | 76 MB 00:00:51 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : VirtualBox-5.1-5.1.38_122592_el7-1.x86_64 1/1 Creating group 'vboxusers'. VM users must be member of that group! Verifying : VirtualBox-5.1-5.1.38_122592_el7-1.x86_64 1/1 Installed: VirtualBox-5.1.x86_64 0:5.1.38_122592_el7-1 Complete!
查看状态
[root@localhost log]# systemctl status vboxdrv.service ● vboxdrv.service - VirtualBox Linux kernel module Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: disabled) Active: active (exited) since Wed 2019-03-27 15:11:07 CST; 24s ago Process: 32580 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=0/SUCCESS) Tasks: 0 Memory: 0B Mar 27 15:11:07 localhost.localdomain systemd[1]: Starting VirtualBox Linux kernel module... Mar 27 15:11:07 localhost.localdomain vboxdrv.sh[32580]: vboxdrv.sh: Starting VirtualBox services. Mar 27 15:11:07 localhost.localdomain systemd[1]: Started VirtualBox Linux kernel module. [root@localhost log]# service vboxdrv status Redirecting to /bin/systemctl status vboxdrv.service ● vboxdrv.service - VirtualBox Linux kernel module Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: disabled) Active: active (exited) since Wed 2019-03-27 15:11:07 CST; 30s ago Process: 32580 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=0/SUCCESS) Tasks: 0 Memory: 0B Mar 27 15:11:07 localhost.localdomain systemd[1]: Starting VirtualBox Linux kernel module... Mar 27 15:11:07 localhost.localdomain vboxdrv.sh[32580]: vboxdrv.sh: Starting VirtualBox services. Mar 27 15:11:07 localhost.localdomain systemd[1]: Started VirtualBox Linux kernel module. [root@localhost log]#
4.查看日志
[root@localhost log]# view /var/log/vbox-install.log
find /tmp/vbox.0/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost -m -a -i ./Module.symvers -I /tmp/vbox.0/Module.symvers -o /tmp/vbox.0/Module.symvers -w -s -T -
gcc -Wp,-MD,/tmp/vbox.0/.vboxpci.mod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -std=gnu89 -O2 -m64 -mno-mmx -mno-sse -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -Wframe-larger-than=2048 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -I/lib/modules/3.10.0-957.el7.x86_64/build/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxpci/ -I/tmp/vbox.0/vboxpci/include -I/tmp/vbox.0/vboxpci/r0drv/linux -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS -fno-pie -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(vboxpci.mod)" -D"KBUILD_MODNAME=KBUILD_STR(vboxpci)" -DMODULE -c -o /tmp/vbox.0/vboxpci.mod.o /tmp/vbox.0/vboxpci.mod.c
ld -r -m elf_x86_64 -T ./scripts/module-common.lds --build-id -o /tmp/vbox.0/vboxpci.ko /tmp/vbox.0/vboxpci.o /tmp/vbox.0/vboxpci.mod.o
[root@localhost log]#